Revert "DATEV: Umsatz von 0 zulassen"
[kivitendo-erp.git] / SL / BackgroundJob / CreatePeriodicInvoices.pm
index 6d87fb6..45a41d0 100644 (file)
@@ -61,12 +61,13 @@ sub run {
       push @invoices_to_print, $data if $config->print;
       push @invoices_to_email, $data if $config->send_email;
 
-      # disalbe one timer only, if they are already processed
-      # 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;
-
-      # last;
+      if ($inactive_ordnumber) {
+        # disable one time configs and skip eventual invoices
+        _log_msg("Order " . $inactive_ordnumber . " deavtivated \n");
+        push @disabled_orders, $inactive_ordnumber;
+        last;
+      }
     }
   }
 
@@ -399,10 +400,13 @@ sub _email_invoice {
       );
     }
 
+    my $global_bcc = SL::DB::Default->get->global_bcc;
+
     for my $recipient (@recipients) {
       my $mail             = Mailer->new;
       $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} = [{