X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/54ce51443886623bb785e7c54492ecbc8dc9b3aa..639066d179464ead41625a9a901b165ce9a5eb06:/SL/BackgroundJob/CreatePeriodicInvoices.pm?ds=sidebyside diff --git a/SL/BackgroundJob/CreatePeriodicInvoices.pm b/SL/BackgroundJob/CreatePeriodicInvoices.pm index c8b16ab4b..b7b3e3305 100644 --- a/SL/BackgroundJob/CreatePeriodicInvoices.pm +++ b/SL/BackgroundJob/CreatePeriodicInvoices.pm @@ -61,11 +61,14 @@ sub run { push @invoices_to_print, $data if $config->print; push @invoices_to_email, $data if $config->send_email; - # last; + my $inactive_ordnumber = $config->disable_one_time_config; + if ($inactive_ordnumber) { + # disable one time configs and skip eventual invoices + _log_msg("Order " . $inactive_ordnumber . " deavtivated \n"); + push @disabled_orders, $inactive_ordnumber; + last; + } } - # disable one time configs (periodicity is only one time). - my $inactive_ordnumber = $config->disable_one_time_config; - push @disabled_orders, $inactive_ordnumber if $inactive_ordnumber; } foreach my $inv ( @invoices_to_print ) { $self->_print_invoice($inv); } @@ -397,14 +400,19 @@ sub _email_invoice { ); } + my $global_bcc = SL::DB::Default->get->global_bcc; + for my $recipient (@recipients) { my $mail = Mailer->new; + $mail->{record_id} = $data->{invoice}->id, + $mail->{record_type} = 'invoice', $mail->{from} = $data->{config}->email_sender || $::lx_office_conf{periodic_invoices}->{email_from}; $mail->{to} = $recipient; + $mail->{bcc} = $global_bcc; $mail->{subject} = $data->{config}->email_subject; $mail->{message} = $data->{config}->email_body; $mail->{attachments} = [{ - filename => $pdf_file_name, + path => $pdf_file_name, name => sprintf('%s %s.pdf', $::locale->text('Invoice'), $data->{invoice}->invnumber), }];