https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43508 --- Comment #1 from Chloé Zermatten <chloe.zermatten@openfifth.co.uk> --- Created attachment 206805 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206805&action=edit Bug 43508: refactor(Account): extract add_lost_replacement_fee For the purposes of bug 39756, we need a modern OOP method which keeps: - the deduplication logic - the useDefaultReplacementCost fallback - the lost_item_processing_fee rule lookup - both add_debit calls (PROCESSING and LOST) Extract Koha::Account->add_lost_replacement_fee from chargelostitem. However, partly for SRP and mostly for compatibility with bug 39756's trigger-based overdue circulation rules, we reduce the scope of the routine's repsonsibilities and remove branch resolution, and issue-id discovery, leaving those to the caller. We also remove the reliance on userenv. For testing: expect no changes to existing features. Test plan: 1) run prove -t t/db_dependent/Accounts.t (regression check) 2) run prove -t t/db_dependent/Koha/Account.t (tests added, see following commit) 3) Charge a lost item through LostItem: a) Set the WhenLostChargeReplacementFee system preference to 'Charge'. b) Edit the item you will use in your testing: give it a "v - Cost, replacement price". c) Navigate to /cgi-bin/koha/admin/smart-rules.pl, and under "Default lost item fee policy" set a "Lost item processing fee", for 'All' Item type. d) Check the item out to a test patron e) Edit your item again, and set '1 - Lost status' to 'Lost'. f) View your test patron's Accounting page to confirm a LOST debit was added for the replacement price, and a PROCESSING debit for the processing fee. Check that the staff member named on both is the staff member you used to carry out the testing. Go through part 3), steps a) to f), both before and after applying the patch: there should be no behaviour differences. 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.