X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/kivitendo-erp.git/blobdiff_plain/e61cd137aeee9dc354fa29a9d13398200a1baeca..7cd6d451d97d1f1e7f3c0f9db2de03735dc8c8f0:/SL/Controller/File.pm diff --git a/SL/Controller/File.pm b/SL/Controller/File.pm index 875478fb2..add213b04 100644 --- a/SL/Controller/File.pm +++ b/SL/Controller/File.pm @@ -173,21 +173,25 @@ sub action_ajax_rename { } else { # normal rename + my $res; + eval { - my $res = $file->rename($::form->{to}); + $res = $file->rename($::form->{to}); $main::lxdebug->message(LXDebug->DEBUG2(), "rename result=".$res); - if ($res > SL::File::RENAME_OK) { - $self->js->flash('error', - $res == SL::File::RENAME_EXISTS ? $::locale->text('File still exists !') - : $res == SL::File::RENAME_SAME ? $::locale->text('Same Filename !') - : $::locale->text('File not exists !'))->render; - return 1; - } 1; } or do { $self->js->flash( 'error', t8('internal error (see details)')) ->flash_detail('error', $@)->render; return; + }; + + if ($res != SL::File::RENAME_OK) { + $self->js->flash('error', + $res == SL::File::RENAME_EXISTS ? $::locale->text('File still exists !') + : $res == SL::File::RENAME_SAME ? $::locale->text('Same Filename !') + : $::locale->text('File not exists !')) + ->render; + return; } } $self->is_global($::form->{is_global}); @@ -309,8 +313,8 @@ sub action_download { sub check_object_params { my ($self) = @_; - my $id = $::form->{object_id} +0; - my $draftid = $::form->{draft_id} +0; + my $id = ($::form->{object_id} // 0) * 1; + my $draftid = ($::form->{draft_id} // 0) * 1; my $gldoc = 0; my $type = undef;