Browse Source

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 <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
21.11/bug30761
Magnus Enger 2 years ago
committed by Jonathan Druart
parent
commit
88e9cca359
  1. 6
      misc/cronjobs/writeoff_debts.pl

6
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();

Loading…
Cancel
Save