Revert "DATEV:CSV nicht gesetztes Fälligkeitsdatum für Belegfeld2 akzeptieren"
[kivitendo-erp.git] / SL / Controller / Order.pm
index bb34a46..7c82105 100644 (file)
@@ -211,13 +211,18 @@ sub action_print {
     }
   }
   if ($self->order->ordnumber && $::instance_conf->get_doc_storage) {
-    SL::File->store( object_id     => $self->order->id,
+    eval {
+      SL::File->save(object_id     => $self->order->id,
                      object_type   => $self->type,
                      mime_type     => 'application/pdf',
                      source        => 'created',
                      file_type     => 'document',
                      file_name     => $pdf_filename,
                      file_contents => $pdf);
+      1;
+    } or do {
+      $self->js->flash('error', t8('Storing PDF in storage backend failed: #1', $@));
+    }
   }
   $self->js->render;
 }
@@ -1088,7 +1093,6 @@ sub _pre_render {
       type     => $self->type,
       number   => $self->order->ordnumber,
     );
-    my $webdav_path = $webdav->webdav_path;
     my @all_objects = $webdav->get_all_objects;
     @{ $self->{template_args}->{WEBDAV} } = map { { name => $_->filename,
                                                     type => t8('File'),
@@ -1117,7 +1121,6 @@ sub _setup_edit_action_bar {
         action => [
           t8('Save and Delivery Order'),
           call      => [ 'kivi.Order.save_and_delivery_order', $::instance_conf->get_order_warn_duplicate_parts ],
-          accesskey => 'enter',
         ],
 
       ], # end of combobox "Save"
@@ -1134,6 +1137,12 @@ sub _setup_edit_action_bar {
           t8('E-mail'),
           call => [ 'kivi.Order.email' ],
         ],
+        action => [
+          t8('Download attachments of all parts'),
+          call     => [ 'kivi.File.downloadOrderitemsFiles', $::form->{type}, $::form->{id} ],
+          disabled => !$self->order->id ? t8('This object has not been saved yet.') : undef,
+          only_if  => $::instance_conf->get_doc_storage,
+        ],
       ], # end of combobox "Export"
 
       action => [