From 8f08dc873db1198fa262fc32104bf9ad98deaaf4 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! Signed-off-by: Genevieve Beaudry --- 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 fa082104a1..0aff60e733 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2324,6 +2324,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 707582d44a..f03208fb4b 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -2304,7 +2304,7 @@ subtest '_FixAccountForLostAndReturned' => sub { }; subtest '_FixOverduesOnReturn' => sub { - plan tests => 10; + plan tests => 11; my $biblio = $builder->build_sample_biblio({ author => 'Hall, Kylie' }); @@ -2330,6 +2330,7 @@ subtest '_FixOverduesOnReturn' => sub { amount => 99.00, amountoutstanding => 99.00, lastincrement => 9.00, + date => '1981-06-10', } )->store(); @@ -2358,6 +2359,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.11.0