From: Bernd Bleßmann Date: Fri, 12 Nov 2021 11:09:18 +0000 (+0100) Subject: E-Mail-Versand: CC: nur kivi-Benutzer mit hinterlegter E-Mail-Adresse anzeigen X-Git-Tag: kivitendo-mebil_0.1-0~10^2~2^2~297 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=c48270dd341297d7a1f70fd7cb48683c011213f2;p=kivitendo-erp.git E-Mail-Versand: CC: nur kivi-Benutzer mit hinterlegter E-Mail-Adresse anzeigen --- 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;