CreatePeriodicInvoices-Job: for anstelle von map für reine Nebeneffekt-Schleifen
authorMoritz Bunkus <m.bunkus@linet-services.de>
Thu, 5 Feb 2015 08:59:30 +0000 (09:59 +0100)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Thu, 5 Feb 2015 09:37:21 +0000 (10:37 +0100)
SL/BackgroundJob/CreatePeriodicInvoices.pm

index 4777025..1abe8c3 100644 (file)
@@ -58,7 +58,7 @@ sub run {
     }
   }
 
-  map { _print_invoice(@{ $_ }) } @invoices_to_print;
+  _print_invoice(@{ $_ }) for @invoices_to_print;
 
   _send_email(\@new_invoices, [ map { $_->[0] } @invoices_to_print ]) if @new_invoices;
 
@@ -154,10 +154,10 @@ sub _create_periodic_invoice {
                                 employee     => $order->employee, # new_from sets employee to import user
                                );
 
-    map { _replace_vars($invoice, $time_period_vars, $_) } qw(notes intnotes transaction_description);
+    _replace_vars($invoice, $time_period_vars, $_) for qw(notes intnotes transaction_description);
 
     foreach my $item (@{ $invoice->items }) {
-      map { _replace_vars($item, $time_period_vars, $_) } qw(description longdescription);
+      _replace_vars($item, $time_period_vars, $_) for qw(description longdescription);
     }
 
     $invoice->post(ar_id => $config->ar_chart_id) || die;