We have the system preferences CalculateFinesOnReturn and CalculateFinesOnBackdate to make Koha calculate overdue fines as an item is returned, either in place of or in addition to the fines cron. However, if one marks an item as lost and has MarkLostItemAsReturned enabled, the issue will be ended without an overdue fine being calculated. We should add the option to calculate an overdue fine at the moment of marking an item lost.
Created attachment 191937 [details] [review] Bug 29800: Add new system preference WhenLostUpdateFine
Created attachment 191938 [details] [review] Bug 29800: Add calculation and update of fine to LostItem This patch adds a call to 'CalculateAndUpdateFine' to LostItem, checking if the new syspref WhenLostUpdateFine is enabled
Test plan: 1 - define a circ rule with an overdue fine, confirm FinesMode is set to "Calculate and charge." 2 - check out an item with a due date in the past such that it would incur an overdue fine if checked in 3 - edit your item to apply a lost status, 4 - confirm no fine is generated 5 - check out an item with a due date in the past such that it would incur an overdue fine if checked in 6 - mark your item lost via the longoverdue cron 7 - confirm no fine is generated 8 - check out an item with a due date in the past such that it would incur an overdue fine if checked in 9 - run fines.pl, confirm an accruing fine has been generated 10 - edit your circ rule to change the fine amount 11 - edit your item to apply a lost status 12 - confirm your fine is now marked "Lost" rather than "Accruing" but the amount has not updated to reflect your changes from step 10 13 - apply patch, updatedatabse, restart_all 14 - confirm new system preference WhenLostUpdateFine is set to No 15 - repeat steps 2 - 12, confirm no change in behavior 16 - set WhenLostUpdateFine to Yes 17 - check out an item with a due date in the past such that it would incur an overdue fine if checked in 18 - edit your item to apply a lost status, 19 - confirm a fine is generated 20 - check out an item with a due date in the past such that it would incur an overdue fine if checked in 21 - mark your item lost via the longoverdue cron 22 - confirm a fine is generated 23 - check out an item with a due date in the past such that it would incur an overdue fine if checked in 24 - run fines.pl, confirm an accruing fine has been generated 25 - edit your circ rule to change the fine amount 26 - edit your item to apply a lost status 27 - confirm your fine is now marked "Lost" rather than "Accruing" and the amount has updated to reflect your changes from step 25
Created attachment 191968 [details] [review] Bug 29800: Add new system preference WhenLostUpdateFine
Created attachment 191969 [details] [review] Bug 29800: Add calculation and update of fine to LostItem This patch adds a call to 'CalculateAndUpdateFine' to LostItem, checking if the new syspref WhenLostUpdateFine is enabled Test plan: 1 - define a circ rule with an overdue fine, confirm FinesMode is set to "Calculate and charge." 2 - check out an item with a due date in the past such that it would incur an overdue fine if checked in 3 - edit your item to apply a lost status, 4 - confirm no fine is generated 5 - check out an item with a due date in the past such that it would incur an overdue fine if checked in 6 - mark your item lost via the longoverdue cron 7 - confirm no fine is generated 8 - check out an item with a due date in the past such that it would incur an overdue fine if checked in 9 - run fines.pl, confirm an accruing fine has been generated 10 - edit your circ rule to change the fine amount 11 - edit your item to apply a lost status 12 - confirm your fine is now marked "Lost" rather than "Accruing" but the amount has not updated to reflect your changes from step 10 13 - apply patch, updatedatabse, restart_all 14 - confirm new system preference WhenLostUpdateFine is set to No 15 - repeat steps 2 - 12, confirm no change in behavior 16 - set WhenLostUpdateFine to Yes 17 - check out an item with a due date in the past such that it would incur an overdue fine if checked in 18 - edit your item to apply a lost status, 19 - confirm a fine is generated 20 - check out an item with a due date in the past such that it would incur an overdue fine if checked in 21 - mark your item lost via the longoverdue cron 22 - confirm a fine is generated 23 - check out an item with a due date in the past such that it would incur an overdue fine if checked in 24 - run fines.pl, confirm an accruing fine has been generated 25 - edit your circ rule to change the fine amount 26 - edit your item to apply a lost status 27 - confirm your fine is now marked "Lost" rather than "Accruing" and the amount has updated to reflect your changes from step 25