To recreate: 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
Created attachment 136694 [details] [review] 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
Actually, unit tests doesn't seem happy with this: prove t/db_dependent/Circulation.t >t/db_dependent/Circulation.t .. 17/61 # No tests run! >t/db_dependent/Circulation.t .. 18/61 ># Failed test 'No tests run for subtest "GetUpcomingDueIssues"' ># at t/db_dependent/Circulation.t line 1594. >Exception 'Koha::Exceptions::Account::UnrecognisedType' thrown 'Update type not >allowed on this debit_type' ># Looks like your test exited with 255 just after 18. >t/db_dependent/Circulation.t .. Dubious, test returned 255 (wstat 65280, 0xff00) >Failed 44/61 subtests Maybe a better solution is to make accountlines with status=LOST to switch back to UNRETURNED at step 9.
Created attachment 137312 [details] [review] Bug 31060: Fine duplicates when returning item with accountline status marked as lost Make unpaid accountline switch from 'LOST' to 'UNRETURNED' when unsetting lost status from an item. 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 and notice step 9 is not true anymore 15- Notice there is only Fine(Returned) and no duplicate
I'm pretty sure this is by design actually. It's not a duplicate fine.. it's a new fine... there are more preferences and circulation rules that play into this. I would take a look at the 'Lost item fee refund on return policy' section of the circulation rules. We describe what to do with these fines and lost fees there.. i.e should we restore them, or charge a new fee.. perhaps there needs to be further options there? I don't think we should just undo the LOST status of the fine however.. that could trigger refunds should the user have already paid for example.
Looks like this needs some more discussions/considerations.