From c48270dd341297d7a1f70fd7cb48683c011213f2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Fri, 12 Nov 2021 12:09:18 +0100 Subject: [PATCH] E-Mail-Versand: CC: nur kivi-Benutzer mit hinterlegter E-Mail-Adresse anzeigen --- SL/Controller/Order.pm | 9 +++++++-- bin/mozilla/io.pl | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index cdae561cd..55c037d15 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -14,6 +14,7 @@ use SL::MIME; use SL::Util qw(trim); use SL::YAML; use SL::DB::AdditionalBillingAddress; +use SL::DB::AuthUser; use SL::DB::History; use SL::DB::Order; use SL::DB::Default; @@ -426,13 +427,17 @@ sub action_save_and_show_email_dialog { my %files = $self->get_files_for_email_dialog(); - $self->{all_employees} = SL::DB::Manager::Employee->get_all_sorted(query => [ deleted => 0 ]); + my @employees_with_email = grep { + my $user = SL::DB::Manager::AuthUser->find_by(login => $_->login); + $user && !!trim($user->get_config_value('email')); + } @{ SL::DB::Manager::Employee->get_all_sorted(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}, + ALL_EMPLOYEES => \@employees_with_email, ); $self->js diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index 1ce4c18a2..d0e1f5717 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -54,7 +54,9 @@ use SL::IO; use SL::File; use SL::PriceSource; use SL::Presenter::Part; +use SL::Util qw(trim); +use SL::DB::AuthUser; use SL::DB::Contact; use SL::DB::Currency; use SL::DB::Customer; @@ -2113,7 +2115,10 @@ sub show_sales_purchase_email_dialog { $body_params{fallback_translation_type} = "preset_text_invoice"; } - $::form->{all_employees} = SL::DB::Manager::Employee->get_all_sorted(query => [ deleted => 0 ]); + my @employees_with_email = grep { + my $user = SL::DB::Manager::AuthUser->find_by(login => $_->login); + $user && !!trim($user->get_config_value('email')); + } @{ SL::DB::Manager::Employee->get_all_sorted(query => [ deleted => 0 ]) }; my $email_form = { to => $email, @@ -2131,7 +2136,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}, + ALL_EMPLOYEES => \@employees_with_email, }); print $::form->ajax_response_header, $html; -- 2.20.1