From 4baae1989e3355e5b76c9e865b6565cd5aaee5eb Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 17 Mar 2017 11:09:32 +0100 Subject: [PATCH] Kreditorenbuchungen: Storno von bezahlten Rechnungen verhindern MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Das Action-Bar-Setup nutzt den Wert $::form->{totalpaid} als Indikator dafür, ob bereits Zahlungen verbucht wurden. Ist das der Fall, so darf die Rechnung nicht storniert werden können. Daher muss dieser Wert berechnet werden, bevor das Action-Bar-Setup durchgeführt wird. --- bin/mozilla/ap.pl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index 038c5741f..8dc258460 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.pl @@ -435,6 +435,11 @@ sub form_header { my $transdate = $::form->{transdate} ? DateTime->from_kivitendo($::form->{transdate}) : DateTime->today_local; my $first_taxchart; + # $form->{totalpaid} is used by the action bar setup to determine + # whether or not canceling is allowed. Therefore it must be + # calculated prior to the action bar setup. + $form->{totalpaid} = sum map { $form->{"paid_${_}"} } (1..$form->{paidaccounts}); + setup_ap_display_form_action_bar(); $form->header(); @@ -483,8 +488,6 @@ sub form_header { $form->{invtotal_unformatted} = $form->{invtotal}; $form->{invtotal} = $form->format_amount(\%myconfig, $form->{invtotal}, 2); - $form->{totalpaid} = 0; - _sort_payments(); if ( $form->{'paid_'. $form->{paidaccounts}} ) { @@ -495,8 +498,6 @@ sub form_header { $form->{accno_arap} = IS->get_standard_accno_current_assets(\%myconfig, \%$form); for my $i (1 .. $form->{paidaccounts}) { - $form->{totalpaid} += $form->{"paid_$i"}; - # format amounts if ($form->{"paid_$i"}) { $form->{"paid_$i"} = $form->format_amount(\%myconfig, $form->{"paid_$i"}, 2); -- 2.20.1