https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43508

--- Comment #4 from Frédéric Demians <[email protected]> ---
Created attachment 207940
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207940&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)
Signed-off-by: Frédéric Demians <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to