From d316a33de921f445049e879f05b166f3862272a2 Mon Sep 17 00:00:00 2001 From: Magnus Enger Date: Tue, 9 Nov 2021 10:13:05 +0000 Subject: [PATCH] Bug 28994: Fix logical errors with amount vs amoutoutstanding The writeoff debts script contained an error whereby we could writeoff more than the current outstanding debt of a charge. This patch corrects that mistake by passing amountoutstanding in place of amount in the writeoff and offset creation lines. Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- misc/cronjobs/writeoff_debts.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/misc/cronjobs/writeoff_debts.pl b/misc/cronjobs/writeoff_debts.pl index ae2ee9c0de..c29a2b8a43 100755 --- a/misc/cronjobs/writeoff_debts.pl +++ b/misc/cronjobs/writeoff_debts.pl @@ -72,10 +72,10 @@ while ( my $line = $lines->next ) { my $writeoff = Koha::Account::Line->new( { date => \'NOW()', - amount => 0 - $line->amount, + amount => 0 - $line->amountoutstanding, credit_type_code => 'WRITEOFF', status => 'ADDED', - amountoutstanding => 0 - $line->amount, + amountoutstanding => 0 - $line->amountoutstanding, manager_id => undef, borrowernumber => $line->borrowernumber, interface => 'intranet', @@ -87,7 +87,7 @@ while ( my $line = $lines->next ) { { credit_id => $writeoff->accountlines_id, type => 'WRITEOFF', - amount => $line->amount + amount => $line->amountoutstanding } )->store(); -- 2.39.5