From 424ec0dc753bce1c18d161f0c62e66edf074c2f5 Mon Sep 17 00:00:00 2001 From: Shi Yao Wang Date: Tue, 28 Jun 2022 15:42:16 -0400 Subject: [PATCH] Bug 31060: Fine duplicates when returning item with accountline status marked as lost Fine duplicates when returning an overdue item with Fine(Lost) fee. To test: 1- System preferences: finesMode: Calculate and charge CalculateFinesOnReturn: Do WhenLostChargeReplacementFee: Don't charge MarkLostItemsAsReturned: uncheck from the items tab of the catalog module 2- Have a circulation rule with defined non-zero Fine amount and Fine charging interval. (Will have to use the patron category and item type associated to this circulation rule to test) 3- Checkout a document from the patron with backdated due date (backdated enough depending on the Fine charging interval set) 4- Run ./misc/cronjobs/fines.pl 5- There should be a Fine(Accruing) in accounting tab of the patron 6- Go to the checked out item detail and set Lost status: Long overdue (Lost) and click Set status 7- Now, Fine(Accruing) changed to Fine(Lost) in the accounting tab of the patron 8- In item detail, set Lost status: Choose and click Set status 9- Notice Fine(Lost) did not switch back to Fine(Accruing) in the accounting tab 10- Check in the item 11- Notice there is a duplicate fee Fine(Returned) and Fine(Lost) is still there 12- Apply the patch 13- Write off all fines of the patron 14- Repeat step 3 to 10 15- Notice there is only Fine(Lost) and no duplicate --- C4/Overdues.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/C4/Overdues.pm b/C4/Overdues.pm index a31d2b4f7b..c26425523a 100644 --- a/C4/Overdues.pm +++ b/C4/Overdues.pm @@ -557,7 +557,7 @@ sub UpdateFine { # - accumulate fines for other items # so we can update $itemnum fine taking in account fine caps while (my $overdue = $overdues->next) { - if ( defined $overdue->issue_id && $overdue->issue_id == $issue_id && $overdue->status eq 'UNRETURNED' ) { + if ( defined $overdue->issue_id && $overdue->issue_id == $issue_id && ($overdue->status eq 'UNRETURNED' || $overdue->status eq 'LOST') ) { if ($accountline) { Koha::Logger->get->debug("Not a unique accountlines record for issue_id $issue_id"); # FIXME Do we really need to log that? #FIXME Should we still count this one in total_amount ?? -- 2.25.1