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)
committerKyle Hall <kyle@bywatersolutions.com>
Fri, 7 Jan 2022 11:27:56 +0000 (06:27 -0500)
commit5a04907c54971ee2830ceb3827e020fc37c6bb01
tree394724b8d8a46ca497138802fca32e2a8e650a04
parent17b446ca74b2b333db98b53c4003d860b4ed57f3
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