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;
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
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;
$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,
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;