Bug 29741: Add Koha::Patron->safe_to_delete
authorTomas Cohen Arazi <tomascohen@theke.io>
Mon, 20 Dec 2021 17:17:49 +0000 (14:17 -0300)
committerFridolin Somers <fridolin.somers@biblibre.com>
Wed, 5 Jan 2022 23:33:46 +0000 (13:33 -1000)
commitb3f19f1e95fff652fdc889e01ff2f75b38055bae
tree30ce08dd59d9e35486524da4fd7ae0554f87855c
parentb28f35efbfa85bf69b5eb784b887e9ded779bd0d
Bug 29741: Add Koha::Patron->safe_to_delete

This patchset adds a handy method for checking if a patron meets the
conditions to be deleted. This conditions are:

- Has no linked guarantees
- Has no pending debts
- Has no current checkouts
- Is not the system-configured anonymous user

To test:
1. Apply the unit tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Patron.t
=> FAIL: Of course heh
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass, conditions are validated and the right string is
returned on each case
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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