From f6b6db352b282a3d9c8af0b93e0b4fc231dde7fc Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 23 Jan 2019 14:54:07 -0500 Subject: [PATCH] Bug 22200 - Forgiving a fine (FFOR) does not update the accountline date Each time a fine is incremented, the date column is updated. When that fine is forgiven ( often via the "Forgive fines" option on the checkin page ), it does not update the column. It makes sense that if updating a fine sets the date column, forgiving it should do so as well. Test Plan: 1) Find a checkout that is overdue with fines, where the date is not today 2) Note the date in the accountlines table 3) Check it in, note the date is not updated 4) Apply this patch 5) Repeat steps 1-2 6) Note the date is updated! --- C4/Circulation.pm | 1 + t/db_dependent/Circulation.t | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 5581a84f5a..b7fe9e6d30 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2343,6 +2343,7 @@ sub _FixOverduesOnReturn { $accountline->accounttype('FFOR'); $accountline->amountoutstanding(0); + $accountline->date( dt_from_string() ); Koha::Account::Offset->new( { diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index 0e3fd43c8a..1740f06887 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -2360,7 +2360,7 @@ subtest '_FixAccountForLostAndReturned' => sub { }; subtest '_FixOverduesOnReturn' => sub { - plan tests => 10; + plan tests => 11; # Generate test biblio my $title = 'Koha for Dummies'; @@ -2391,6 +2391,7 @@ subtest '_FixOverduesOnReturn' => sub { amount => 99.00, amountoutstanding => 99.00, lastincrement => 9.00, + date => '1981-06-10', } )->store(); @@ -2419,6 +2420,7 @@ subtest '_FixOverduesOnReturn' => sub { is( $accountline->accounttype, 'FFOR', 'Open fine ( account type FU ) has been set to fine forgiven ( account type FFOR )'); is( ref $offset, "Koha::Account::Offset", "Found matching offset for fine reduction via forgiveness" ); is( $offset->amount, '-99.000000', "Amount of offset is correct" ); + is( $accountline->date, output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }), 'Accountline date is updated correctly' ); ## Run again, with dropbox mode enabled $accountline->set( -- 2.17.2 (Apple Git-113)