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

--- Comment #3 from Tomás Cohen Arazi (tcohen) <[email protected]> ---
Created attachment 205246
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205246&action=edit
Bug 31457: Use the OO restriction API in all callers

This patch migrates all in-tree callers of the procedural
Koha::Patron::Debarments functions to the new object-oriented API on
Koha::Patron and Koha::Patron::Restriction(s).

Changes:
- C4::Circulation: SUSPENSION now uses $patron->add_or_update_restriction;
  the two OVERDUES removals reuse the $overdue_restrictions resultset
  already in scope ($overdue_restrictions->delete)
- Koha::Account::Line: $self->patron->restrictions->lift_after_payment
- Koha::Patron::merge_with: $self->_update_debarred_flags (and dropped the
  now-unneeded use Koha::Patron::Debarments)
- Koha::Patrons::Import, Koha::Patron::Discharge, Koha::Notice::Message:
  use $patron->add_restriction
- members/mod_debarment.pl, members/memberentry.pl, tools/modborrowers.pl:
  use $patron->add_restriction and $restriction->delete
- misc/cronjobs/overdue_notices.pl, debar_patrons_with_fines.pl: use
  $patron->add_or_update_restriction
- misc/cronjobs/cleanup_database.pl: Koha::Patron::Restrictions->find->delete
  (only a restriction id is available there)
- Migrated two incidental test calls that relied on Koha::Patron
  transitively loading Koha::Patron::Debarments (Restriction/Type.t and
  Borrower_Discharge.t)

The convention followed is to go through $patron->restrictions->search/find
(or a resultset already in scope), only using the class-level
Koha::Patron::Restrictions->find where just an id is available.

Test plan:
1. Apply patch
2. Run:
   $ ktd --shell
   k$ prove t/db_dependent/Patron/Borrower_Debarments.t \
            t/db_dependent/Circulation.t \
            t/db_dependent/Circulation/MarkIssueReturned.t \
            t/db_dependent/Circulation/maxsuspensiondays.t \
            t/db_dependent/Koha/Patron.t \
            t/db_dependent/Koha/Patron/Restriction/Type.t \
            t/db_dependent/Koha/Account/Lines.t \
            t/db_dependent/Members.t \
            t/db_dependent/Koha/Notices.t
=> SUCCESS: All tests pass!
3. 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