Bug 39236: writeoff_debts.pl needs adjustments

From bug 22435 - we need to use 'CREATE' as the account_offset type
From bug 31095 - we need to 'use Koha::Patrons;'

To test:
1 - Add a fine to a patron account
2 - perl misc/cronjobs/writeoff_debts.pl -v -c --added-after 2025-01-01
3 - Cronjob dies
4 - Apply patch
5 - Rerun
6 - Job succeeds!
7 - Confirm patron's fine is written off
8 - Sign off

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 93e2a0953d)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Nick Clemens 2025-03-04 13:44:53 +00:00 committed by Paul Derscheid
parent 6de441e3f5
commit a2ab689aed
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
2 changed files with 2 additions and 1 deletions

View File

@ -23,6 +23,7 @@ use C4::Context;
use C4::Log qw( logaction );
use Koha::Database;
use Koha::Patrons;
use Koha::Patron::Restriction::Types;
use Koha::Patron::Restrictions;

View File

@ -113,7 +113,7 @@ while ( my $line = $lines->next ) {
my $writeoff_offset = Koha::Account::Offset->new(
{
credit_id => $writeoff->accountlines_id,
type => 'WRITEOFF',
type => 'CREATE',
amount => $line->amountoutstanding
}
)->store();