X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FInvoice.pm;h=44b81dfd09cd9ebc46dfa07eb830597297565578;hb=d7680dd2d045638fc4a1925406e0b7bc4cf1cdcf;hp=121f7659c1f04681d3ae026cb68fc7259fe6248c;hpb=d90966c715df9a2f454a9adc00cd01e61516a3bb;p=kivitendo-erp.git diff --git a/SL/DB/Invoice.pm b/SL/DB/Invoice.pm index 121f7659c..44b81dfd0 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; } @@ -557,6 +555,13 @@ sub abbreviation { return t8('Invoice (one letter abbreviation)'); } +sub oneline_summary { + my $self = shift; + + return sprintf("%s: %s %s %s (%s)", $self->abbreviation, $self->invnumber, $self->customer->name, + $::form->format_amount(\%::myconfig, $self->amount,2), $self->transdate->to_kivitendo); +} + sub date { goto &transdate; } @@ -579,6 +584,12 @@ sub link { return $html; } +sub mark_as_paid { + my ($self) = @_; + + $self->update_attributes(paid => $self->amount); +} + 1; __END__ @@ -762,6 +773,10 @@ Mandatory params are =back +=item C + +Marks the invoice as paid by setting its C member to the value of C. + =back =head1 TODO