From: Bernd Bleßmann Date: Fri, 26 Nov 2021 15:32:39 +0000 (+0100) Subject: Anzahlungs-Rg.: Kommentare f. Todos X-Git-Tag: kivitendo-mebil_0.1-0~10^2~2^2~217^2~30 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=7b5fd5ed9dd504e1ef3dfe66d31b62de51b3432e;p=kivitendo-erp.git Anzahlungs-Rg.: Kommentare f. Todos --- diff --git a/SL/IS.pm b/SL/IS.pm index 39bb7936c..3bcc0dadd 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -1067,12 +1067,22 @@ SQL my $clearing_chart = SL::DB::Chart->new(id => $::instance_conf->get_advance_payment_clearing_chart_id)->load; die "No Clearing Chart for Advance Payment" unless ref $clearing_chart eq 'SL::DB::Chart'; foreach my $invoice_for_advance_payment (@$invoices_for_advance_payment) { - # delete ? post twice case ? + # 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( ...) + # --> helper table not nessessary because of mark in memo field + # # TODO: If final_invoice change (delete storno) delete all connectin acc_trans entries, if # period is not closed + # --> no problem because gldate of reverse booking is date of final invoice + # if deletion of final invoice is allowed, reverting bookings in invoices + # for advance payment are allowed, too. # $booking->id, $self->id in helper table $form->{amount}->{$invoice_for_advance_payment->id}->{$clearing_chart->accno} = -1 * $invoice_for_advance_payment->netamount; $form->{memo} ->{$invoice_for_advance_payment->id}->{$clearing_chart->accno} = 'reverse booking by final invoice'; @@ -2054,6 +2064,9 @@ sub _delete_invoice { # if we delete a final invoice, the reverse bookings for the clearing account in the invoice for advance payment # must be deleted as well my $invoices_for_advance_payment = $self->_get_invoices_for_advance_payment($form->{convert_from_ar_ids} || $form->{id}); + + # Todo: allow only if invoice for advance payment is not paid. + # die if any { $_->paid } for @$invoices_for_advance_payment; my @trans_ids_to_consider = map { $_->id } @$invoices_for_advance_payment; if (scalar @trans_ids_to_consider) { my $query = sprintf 'DELETE FROM acc_trans WHERE memo LIKE ? AND trans_id IN (%s)', join ', ', ("?") x scalar @trans_ids_to_consider;