From 1b8bcfc560103be06570600061d1fd2d7b3959ac Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 25 Mar 2019 14:00:59 +0000 Subject: [PATCH] Bug 22539: Reset fines for backdated returns Fixed fines should be 'unfixed' for backdated returns that specify a return date prior to the lastreneweddate. Signed-off-by: Kyle M Hall --- C4/Circulation.pm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 7ab1db7e82..d15e4709aa 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1938,6 +1938,15 @@ sub AddReturn { $patron or warn "AddReturn without current borrower"; $is_overdue = $issue->is_overdue( $return_date ); + # Fixup fines if renewed on dropbox day + if (defined($issue->lastreneweddate) && ( $issue->lastreneweddate > $return_date ) ) { + my $fines = Koha::Account::Lines->search( { issue_id => $issue->issue_id }, { order_by => { '-asc' => 'date' } } ); + if ($fines->count) { + my $fine = $fines->next; + $fine->accounttype('FU')->store; + } + } + if ($patron) { eval { MarkIssueReturned( $borrowernumber, $item->itemnumber, $return_date, $patron->privacy ); -- 2.20.1