E-Mail-Versand: CC an andere kivi-Benutzer per Auswahlliste
authorJan Büren <jan@kivitendo.de>
Fri, 14 May 2021 08:32:37 +0000 (10:32 +0200)
committerJan Büren <jan@kivitendo.de>
Fri, 14 May 2021 08:32:37 +0000 (10:32 +0200)
SL/Controller/Order.pm
SL/Form.pm
bin/mozilla/io.pl
doc/changelog
templates/webpages/common/_send_email_dialog.html

index 5a7d58e..952d90e 100644 (file)
@@ -423,11 +423,13 @@ sub action_save_and_show_email_dialog {
   $email_form->{js_send_function}    = 'kivi.Order.send_email()';
 
   my %files = $self->get_files_for_email_dialog();
+  $self->{all_employees} = SL::DB::Manager::Employee->get_all(query => [ deleted => 0 ]);
   my $dialog_html = $self->render('common/_send_email_dialog', { output => 0 },
                                   email_form  => $email_form,
                                   show_bcc    => $::auth->assert('email_bcc', 'may fail'),
                                   FILES       => \%files,
                                   is_customer => $self->cv eq 'customer',
+                                  ALL_EMPLOYEES => $self->{all_employees},
   );
 
   $self->js
index 921cb25..239f7b9 100644 (file)
@@ -1002,6 +1002,14 @@ sub send_email {
   map { $mail->{$_} = $self->{$_} }
     qw(cc subject message format);
 
+  if ($self->{cc_employee}) {
+    my ($user, $my_emp_cc);
+    $user        = SL::DB::Manager::AuthUser->find_by(login => $self->{cc_employee});
+    $my_emp_cc   = $user->get_config_value('email') if ref $user eq 'SL::DB::AuthUser';
+    $mail->{cc} .= ", "       if $mail->{cc};
+    $mail->{cc} .= $my_emp_cc if $my_emp_cc;
+  }
+
   $mail->{bcc}    = $self->get_bcc_defaults($myconfig, $self->{bcc});
   $mail->{to}     = $self->{EMAIL_RECIPIENT} ? $self->{EMAIL_RECIPIENT} : $self->{email};
   $mail->{from}   = qq|"$myconfig->{name}" <$myconfig->{email}>|;
index 7c7fa49..9982d9e 100644 (file)
@@ -2100,6 +2100,7 @@ sub show_sales_purchase_email_dialog {
     $body_params{fallback_translation_type} = "preset_text_invoice";
   }
 
+  $::form->{all_employees} = SL::DB::Manager::Employee->get_all(query => [ deleted => 0 ]);
   my $email_form = {
     to                  => $email,
     cc                  => $email_cc,
@@ -2116,6 +2117,7 @@ sub show_sales_purchase_email_dialog {
     FILES       => \%files,
     is_customer => $::form->{vc} eq 'customer',
     is_invoice_mail => ($record_email && $::form->{type} eq 'invoice'),
+    ALL_EMPLOYEES   => $::form->{all_employees},
   });
 
   print $::form->ajax_response_header, $html;
index a8b4d81..e47f57e 100644 (file)
@@ -36,6 +36,8 @@ Mittelgroße neue Features:
      Mahnung
 
 Kleinere neue Features und Detailverbesserungen:
+  - E-Mail-Versand: Neben dem Freitext CC-Feld kann jetzt auch ein
+    kivitendo Benutzer mittels einer Auswahlliste in CC gesetzt werden
   - Falls der Mandant zu jeder Buchung einen Beleg hinzufügen möchte,
     ist dies jetzt in der Mandantenkonfiguration einstellbar und falls
     zusätzlich die DMS Funktion aktiv ist, bleibt der Bearbeiter nach
index b58e762..79b984c 100644 (file)
    </td>
   </tr>
 
+ [%- IF ALL_EMPLOYEES.size %]
+  <tr class="hidden" data-toggle-recipients="1">
+   <th align="right" nowrap>[% LxERP.t8("CC to Employee") %]</th>
+   <td>[% L.select_tag('email_form.cc_employee',  ALL_EMPLOYEES, value_key='login' title_key='safe_name', with_empty=1, style=style) %]</td>
+  </tr>
+ [%- END %]
+
   <tr class="hidden" data-toggle-recipients="1">
    <th align="right" nowrap>[% LxERP.t8("Cc") %]</th>
    <td>[% L.input_tag("email_form.cc", email_form.cc, size="80") %]</td>