]> git.koha-community.org Git - koha.git/commit
Bug 29741: (follow-up) Make DELETE /patrons use the new validation method
authorTomas Cohen Arazi <tomascohen@theke.io>
Mon, 20 Dec 2021 18:11:02 +0000 (15:11 -0300)
committerFridolin Somers <fridolin.somers@biblibre.com>
Wed, 5 Jan 2022 23:33:46 +0000 (13:33 -1000)
commitdbd69d66506fbde8a6b8a2b2120d962561bd32b6
treed6a08f94d07e3a9ef01029674b3e64d41b9c362e
parentb3f19f1e95fff652fdc889e01ff2f75b38055bae
Bug 29741: (follow-up) Make DELETE /patrons use the new validation method

This patch adapts the route so it uses the newly introduced
Koha::Patron->safe_to_delete method.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/patrons.t
=> SUCCESS: Tests pass
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests still pass!
4. Sign off :-D

Note: There's a trivial behavior change, in which the 'anonymous patron'
use case is caugh eariler than the ->delete call. I left the exception
catch block just in case, who knows :-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/REST/V1/Patrons.pm
t/db_dependent/api/v1/patrons.t