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

--- Comment #5 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 193261
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=193261&action=edit
Bug 41592: Add API endpoints for global account line search

This patch adds new REST API endpoints to support cross-register refund
functionality by allowing global searches of account lines (credits and debits)
across all patrons.

Changes:
- Add /api/v1/account/credits endpoint for searching credits globally
- Add /api/v1/account/debits endpoint for searching debits globally
- Support embedding of related debits in credits endpoint
- Allow searching by credit_number or accountlines_id
- Fix Koha::Account::Line credits() and debits() methods to return
  proper Koha::Account::Credits and Koha::Account::Debits objects
- Make patron_id nullable in credit and debit API definitions to support
  anonymous transactions

The new endpoints require the 'anonymous_refund' cash_management permission
and enable staff to search for and refund transactions made at any register.

Test plan:
1. Apply patch and run: yarn build && ktd --restart_all
2. Test API endpoint: GET /api/v1/account/credits?q={"credit_number":"CR-123"}
3. Test with embed: GET /api/v1/account/credits?q={"credit_number":"CR-123"}
   with header x-koha-embed: debits
4. Verify results include credit details and embedded debit information
5. Bonus points: Run the new and updated unit tests:
   prove -v t/db_dependent/api/v1/account.t
   prove -v t/db_dependent/Koha/Account/Line.t

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to