X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/e5a76ed158219e3d2b19f142213f8a80c11627f1..96670fe82a38116ac10592a6ccbd34800f8ad9f8:/SL/DB/Invoice.pm?ds=inline diff --git a/SL/DB/Invoice.pm b/SL/DB/Invoice.pm index 121f7659c..fab4974f3 100644 --- a/SL/DB/Invoice.pm +++ b/SL/DB/Invoice.pm @@ -252,7 +252,7 @@ sub post { $params{ar_id} = $chart->id; } - my $worker = sub { + if (!$self->db->with_transaction(sub { my %data = $self->calculate_prices_and_taxes; $self->_post_create_assemblyitem_entries($data{assembly_items}); @@ -267,11 +267,9 @@ sub post { $self->_post_update_allocated($data{allocated}); $self->_post_book_rounding($data{rounding}); - }; - if ($self->db->in_transaction) { - $worker->(); - } elsif (!$self->db->do_transaction($worker)) { + 1; + })) { $::lxdebug->message(LXDebug->WARN(), "convert_to_invoice failed: " . join("\n", (split(/\n/, $self->db->error))[0..2])); return undef; }