X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FInvoice.pm;h=fab4974f3490acfba58a044a4b92472c5fb93f88;hb=832dce93297e0577b2f7acf6be3612adca7334d9;hp=121f7659c1f04681d3ae026cb68fc7259fe6248c;hpb=d90966c715df9a2f454a9adc00cd01e61516a3bb;p=kivitendo-erp.git 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; }