https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43504 --- Comment #1 from Chloé Zermatten <chloe.zermatten@openfifth.co.uk> --- Created attachment 206650 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206650&action=edit Bug 43504: refactor: extract forgive_debit from _FixOverduesOnReturn In preparation for bug 39756, the forgive_debit method is introduced to Account.pm The choice of location is due to it calling Koha::Account::add_credit. This also removes the reliance on userenv. Test plan: 1) run prove -t t/db_dependent/Koha/Account.t (see next commit for the new tests) 2) run prove -t t/db_dependent/Circulation.t (regression check, targets '_FixOverduesOnReturn') 3) manually test forgiving a fine to ensure no regression was introduced. a) Set finesMode to 'Calculate and charge'. Give your staff user the updatecharges => writeoff permission. b) At admin/circulation-rules.pl, for the patron category, item type and library you will use, set: - Fine amount: 1 - Fine charging interval: 1 - Fine grace period: 0 c) Check an item out to a patron and backdate the due date by a week. d) perl misc/cronjobs/fines.pl -v Confirm an OVERDUE accountline with status UNRETURNED exists. e) Return the item with 'Forgive overdue charges' ticked on the returns page. f) Confirm a FORGIVEN credit exists for the amount outstanding and the overdue line is settled and now has status RETURNED. g) In accountlines, confirm the FORGIVEN credit's manager_id is your staff user's borrowernumber and branchcode is the library you are logged in at. h) Repeat step c) and d), and this time do not tick 'Forgive overdue charges'. i) Confirm the fine created in i) was left untouched Sponsored-by: Black Hills Library Consortium- http://www.rcgov.org/Library/ Assisted-by: Claude Opus 5 (Anthropic) -- You are receiving this mail because: You are watching all bug changes.