]> wagnertech.de Git - kivitendo-erp.git/blobdiff - SL/Controller/File.pm
ActionBar: nicht »continue«, sondern »next« für Short-Circuit einer Schleife
[kivitendo-erp.git] / SL / Controller / File.pm
index 05884dd4fad96126a7bcb5e79336ca5a49ded0a1..add213b04b270af20df40a4f4bd7aded4a5b57c9 100644 (file)
@@ -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;
 
@@ -604,7 +608,7 @@ SL::Controller::File - Controller for managing files
 
 =head1 DESCRIPTION
 
-This is a controller for handling files in a storage independant way.
+This is a controller for handling files in a storage independent way.
 The storage may be a Filesystem,a WebDAV, a Database or DMS.
 These backends must be configered in ClientConfig.
 This Controller use as intermediate layer for storage C<SL::File>.
@@ -619,7 +623,7 @@ More description of the intermediate layer see L<SL::File>.
 =head2 C<action_list>
 
 This loads a list of files on a webpage. This can be done with a normal submit or via an ajax/json call.
-Dependant of file_type different sources are available.
+Dependent of file_type different sources are available.
 
 For documents there are the 'created' source and the imports from scanners or email.
 For attachments and images only the 'uploaded' source available.
@@ -744,7 +748,7 @@ The ids of the files to delete. Only this files are deleted not all versions of
 
 =head2 C<action_ajax_unimport>
 
-Some files can be unimported, dependant of the source of the file. This means they are moved
+Some files can be unimported, dependent of the source of the file. This means they are moved
 back to the directory of the source
 
 Available C<FORM PARAMS>:
@@ -767,4 +771,3 @@ One file can be renamed. There can be some checks if the same filename still exi
 Martin Helmling E<lt>martin.helmling@opendynamic.deE<gt>
 
 =cut
-