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

--- Comment #2 from Tomás Cohen Arazi (tcohen) <[email protected]> ---
Created attachment 205245
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205245&action=edit
Bug 31457: Add OO restriction methods to Koha::Patron::Restriction(s) and
Koha::Patron

This patch adds an object-oriented API for managing patron restrictions,
replacing the procedural Koha::Patron::Debarments functions. The old module
is kept as a thin compatibility shim delegating to the new API so existing
callers continue to work with no behavior change.

Changes:
- Koha::Patron::Restriction: store() override (sets manager_id, updates
  debarred/debarredcomment quick-flags, logs CREATE/MODIFY_RESTRICTION);
  delete() override (logs DELETE_RESTRICTION, updates flags); patron()
  accessor
- Koha::Patron::Restrictions: filter_by_unique(), lift_after_payment()
- Koha::Patron::Restriction::Types: UNIQUE_TYPES constant (OVERDUES,
  SUSPENSION, FINES), filter_by_unique()
- Koha::Patron: add_restriction(), add_or_update_restriction() (upsert
  keyed on type, never shortens expiration), _update_debarred_flags()
  (raw SQL to avoid Koha::Patron->store side effects)
- Koha::Patron::Debarments: rewritten as deprecated shim delegating all
  exported functions to the OO API

Test plan:
1. Apply patch
2. Run:
   $ ktd --shell
   k$ prove t/db_dependent/Koha/Patron/Restriction.t \
            t/db_dependent/Koha/Patron/Restrictions.t \
            t/db_dependent/Koha/Patron/Restriction/Types.t \
            t/db_dependent/Koha/Patron.t \
            t/db_dependent/Patron/Borrower_Debarments.t
=> SUCCESS: All tests pass!
3. The existing Borrower_Debarments.t (40 tests) proves the shim
   preserves exact behavior through the new OO layer
4. New tests cover: store (create/modify/flags/logging), delete
   (remove/flags/logging), patron(), filter_by_unique, UNIQUE_TYPES,
   lift_after_payment, add_restriction, add_or_update_restriction
5. Sign off :-D

-- 
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