From: Bernd Bleßmann Date: Fri, 26 Nov 2021 15:35:13 +0000 (+0100) Subject: Anzahlungs-Rg.: keine weitere Rückbuchung bei erneutem Buchen einer Schluss-Rg X-Git-Tag: kivitendo-mebil_0.1-0~10^2~2^2~217^2~29 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=242119d5c072981ca16fdaef4546ce2e1b8cc314;p=kivitendo-erp.git Anzahlungs-Rg.: keine weitere Rückbuchung bei erneutem Buchen einer Schluss-Rg --- diff --git a/SL/IS.pm b/SL/IS.pm index 3bcc0dadd..1340fcbfc 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -734,6 +734,8 @@ sub _post_invoice { my $all_units = AM->retrieve_units($myconfig, $form); + my $already_booked = !!$form->{id}; + if (!$payments_only) { if ($form->{storno}) { _delete_transfers($dbh, $form, $form->{storno_id}); @@ -1060,7 +1062,7 @@ SQL my $taxdate = $form->{tax_point} ||$form->{deliverydate} || $form->{invdate}; # better type? maybe define Invoice->invoice_type - if ($form->{type} ne 'invoice_for_advance_payment') { + if (!$already_booked && $form->{type} ne 'invoice_for_advance_payment') { my $invoices_for_advance_payment = $self->_get_invoices_for_advance_payment($form->{convert_from_ar_ids} || $form->{id}); if (scalar @$invoices_for_advance_payment > 0) { # reverse booking for invoices for advance payment @@ -1070,9 +1072,6 @@ SQL # delete ? # --> is implemented below (bookings are marked in memo field) # - # post twice case ? - # ? - # # TODO: helper table acc_trans_advance_payment # trans_id for final invoice connects to acc_trans_id here # my $booking = SL::DB::AccTrans->new( ...)