From 242119d5c072981ca16fdaef4546ce2e1b8cc314 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Fri, 26 Nov 2021 16:35:13 +0100 Subject: [PATCH] =?utf8?q?Anzahlungs-Rg.:=20keine=20weitere=20R=C3=BCckbuc?= =?utf8?q?hung=20bei=20erneutem=20Buchen=20einer=20Schluss-Rg?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/IS.pm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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( ...) -- 2.20.1