From d59b0f518fb5b50bfcf8acb00228236d00ebe1fe 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 --- 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 1f1a9e8b2f..64e196b388 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.20.1