Bug 25996: Make AddDebarment() use Koha::Patron::Restriction
authorTomas Cohen Arazi <tomascohen@theke.io>
Mon, 22 Apr 2024 03:07:30 +0000 (00:07 -0300)
committerKatrin Fischer <katrin.fischer@bsz-bw.de>
Fri, 3 May 2024 16:02:16 +0000 (18:02 +0200)
commit2b106c1181fd970e9aeef53bf6ab19592f61592c
tree208b358e7e7423ab17d00bca4137deaa3de4822e
parent307acdf96b28c722a0027c1eeadb4c98ab38eeef
Bug 25996: Make AddDebarment() use Koha::Patron::Restriction

This patch makes the AddDebarment() method use the Koha::Object-based
class to ease the next steps. The current codebase makes the feature
fragile otherwise, as adding a new row and then querying for the latest
row of that kind seems risky,

With this approach the result is the same, but we have the
Koha::Patron::Restriction object for using it later in logging.

I opted to return 1 as it does now. The whole module deserves to be
removed in the future but it is out of the scope of this report.

To test:
1. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Patron/Borrower_Debarments.t
=> SUCCESS: Tests pass
2. Apply this tiny refactoring patch
3. Repeat 1
=> SUCCESS: Tests still pass!
4. Sign off :-D

Sponsored-by: Karlsruhe Institute of Technology (KIT)
Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Koha/Patron/Debarments.pm