From a96b6e954640c26516962ad7cee25a98b90eb883 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Fri, 14 May 2021 10:32:37 +0200 Subject: [PATCH] E-Mail-Versand: CC an andere kivi-Benutzer per Auswahlliste --- SL/Controller/Order.pm | 2 ++ SL/Form.pm | 8 ++++++++ bin/mozilla/io.pl | 2 ++ doc/changelog | 2 ++ templates/webpages/common/_send_email_dialog.html | 7 +++++++ 5 files changed, 21 insertions(+) diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index 5a7d58eb8..952d90e57 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -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 diff --git a/SL/Form.pm b/SL/Form.pm index 921cb253e..239f7b938 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -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}>|; diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index 7c7fa49d6..9982d9eb5 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -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; diff --git a/doc/changelog b/doc/changelog index a8b4d8145..e47f57e27 100644 --- a/doc/changelog +++ b/doc/changelog @@ -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 diff --git a/templates/webpages/common/_send_email_dialog.html b/templates/webpages/common/_send_email_dialog.html index b58e762c4..79b984c81 100644 --- a/templates/webpages/common/_send_email_dialog.html +++ b/templates/webpages/common/_send_email_dialog.html @@ -40,6 +40,13 @@ + [%- IF ALL_EMPLOYEES.size %] + + [% LxERP.t8("CC to Employee") %] + [% L.select_tag('email_form.cc_employee', ALL_EMPLOYEES, value_key='login' title_key='safe_name', with_empty=1, style=style) %] + + [%- END %] + [% LxERP.t8("Cc") %] [% L.input_tag("email_form.cc", email_form.cc, size="80") %] -- 2.20.1