X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/42bf1ae9263b1a94ea70a1c2f9a5f34efbb71c89..2a1e7ba222323c441f55da0c192413a471c0b4cb:/SL/BackgroundJob/CreatePeriodicInvoices.pm?ds=inline diff --git a/SL/BackgroundJob/CreatePeriodicInvoices.pm b/SL/BackgroundJob/CreatePeriodicInvoices.pm index ad16949b5..490f21ea3 100644 --- a/SL/BackgroundJob/CreatePeriodicInvoices.pm +++ b/SL/BackgroundJob/CreatePeriodicInvoices.pm @@ -65,8 +65,8 @@ sub run { } } - $self->_print_invoice($_) for @invoices_to_print; - $self->_email_invoice($_) for @invoices_to_email; + foreach my $inv ( @invoices_to_print ) { $self->_print_invoice($inv); } + foreach my $inv ( @invoices_to_email ) { $self->_email_invoice($inv); } $self->_send_summary_email( [ map { $_->{invoice} } @new_invoices ], @@ -75,7 +75,7 @@ sub run { ); if (@{ $self->{job_errors} }) { - my $msg = @{ $self->{job_errors} }; + my $msg = join "\n", @{ $self->{job_errors} }; _log_msg("Errors: $msg"); die $msg; } @@ -205,7 +205,7 @@ sub _create_periodic_invoice { my $order = $config->order; my $invoice; - if (!$self->{db_obj}->db->do_transaction(sub { + if (!$self->{db_obj}->db->with_transaction(sub { 1; # make Emacs happy $invoice = SL::DB::Invoice->new_from($order); @@ -254,6 +254,8 @@ sub _create_periodic_invoice { _log_msg("_create_invoice created for period start date $period_start_date id " . $invoice->id . " number " . $invoice->invnumber . " netamount " . $invoice->netamount . " amount " . $invoice->amount); # die $invoice->transaction_description; + + 1; })) { $::lxdebug->message(LXDebug->WARN(), "_create_invoice failed: " . join("\n", (split(/\n/, $self->{db_obj}->db->error))[0..2])); return undef;