Bug 29765: Make Koha::Patron->safe_to_delete use Koha::Result::Boolean
authorTomas Cohen Arazi <tomascohen@theke.io>
Thu, 23 Dec 2021 14:43:52 +0000 (11:43 -0300)
committerFridolin Somers <fridolin.somers@biblibre.com>
Wed, 5 Jan 2022 23:33:46 +0000 (13:33 -1000)
commited2acc9266bd3edd563243232d219ef2e3fadef9
tree20ed4976ba0248c4ff0120b56c36e72a1a58bc48
parent367a90ca189b0c3f49a7b3a87ce023070a7f05ea
Bug 29765: Make Koha::Patron->safe_to_delete use Koha::Result::Boolean

This patch makes the safe_to_delete method in Koha::Patron return this
new object type instead of a plain string. This way we have a consistent
way to deal with 'can_*'-like methods return values when feedback is
needed.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Patron.t
=> SUCCESS: The adjusted tests pass. Tests cover the boolean context
eval and also the carried messages, that include the same string code
that was returned originally.
3. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Koha/Patron.pm
t/db_dependent/Koha/Patron.t