Dateianhänge aus Projekten auch in E-Mail anzeigen
authorJan Büren <jan@kivitendo.de>
Fri, 16 Apr 2021 06:45:20 +0000 (08:45 +0200)
committerJan Büren <jan@kivitendo.de>
Fri, 16 Apr 2021 06:45:20 +0000 (08:45 +0200)
In Anlehnung an odyn fa2f21bb7d9247782f5e
Im E-Mail-Dialog werden hochgeladene Dateianhänge aus einem
globalen Projekt angeboten und sind vorausgewählt.

SL/Controller/Order.pm
bin/mozilla/io.pl
js/kivi.SalesPurchase.js
templates/webpages/common/_send_email_dialog.html

index 15df158..27e8946 100644 (file)
@@ -1965,6 +1965,7 @@ sub get_files_for_email_dialog {
     $files{versions} = [ SL::File->get_all_versions(object_id => $self->order->id,              object_type => $self->order->type, file_type => 'document') ];
     $files{files}    = [ SL::File->get_all(         object_id => $self->order->id,              object_type => $self->order->type, file_type => 'attachment') ];
     $files{vc_files} = [ SL::File->get_all(         object_id => $self->order->{$self->cv}->id, object_type => $self->cv,          file_type => 'attachment') ];
+    $files{project_files} = [ SL::File->get_all(    object_id => $self->order->globalproject_id, object_type => 'project',         file_type => 'attachment') ];
   }
 
   my @parts =
index 0a6b861..7c7fa49 100644 (file)
@@ -2021,7 +2021,7 @@ sub setup_sales_purchase_print_options {
 }
 
 sub _get_files_for_email_dialog {
-  my %files = map { ($_ => []) } qw(versions files vc_files part_files);
+  my %files = map { ($_ => []) } qw(versions files vc_files part_files project_files);
 
   return %files if !$::instance_conf->get_doc_storage;
 
@@ -2030,6 +2030,8 @@ sub _get_files_for_email_dialog {
     $files{files}    = [ SL::File->get_all(         object_id => $::form->{id},    object_type => $::form->{type}, file_type => 'attachment') ];
     $files{vc_files} = [ SL::File->get_all(         object_id => $::form->{vc_id}, object_type => $::form->{vc},   file_type => 'attachment') ]
       if $::form->{vc} && $::form->{"vc_id"};
+    $files{project_files} = [ SL::File->get_all(object_id => $::form->{project_id}, object_type => 'project',file_type => 'attachment') ]
+      if $::form->{project_id};
   }
 
   my @parts =
index 2b63a1a..98a538c 100644 (file)
@@ -286,6 +286,7 @@ namespace('kivi.SalesPurchase', function(ns) {
       type:         $('#type').val(),
       vc:           vc,
       vc_id:        $('#' + vc + '_id').val(),
+      project_id:  $('#globalproject_id').val(),
     };
 
     $('[name^=id_],[name^=partnumber_]').each(function(idx, elt) {
index 9f03f7e..b58e762 100644 (file)
              files = FILES.part_files
              checked = INSTANCE_CONF.get_email_attachment_part_files_checked
              label = LxERP.t8("Files from parts") %]
+
+  [% PROCESS attach_file_list
+             files = FILES.project_files
+             label = LxERP.t8("Files from projects") %]
 [% END %]
  </tbody>
 </table>