Browse Source

Bug 14708: Enforce restriction in delete_patrons.pl

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
20.11.x
Kyle Hall 2 years ago
committed by Jonathan Druart
parent
commit
b0ce0d6463
  1. 8
      misc/cronjobs/delete_patrons.pl

8
misc/cronjobs/delete_patrons.pl

@ -94,6 +94,7 @@ unless ($confirm) {
say scalar(@$members) . " patrons to delete" if $verbose;;
my $anonymous_patron = C4::Context->preference("AnonymousPatron");
my $deleted = 0;
for my $member (@$members) {
print "Trying to delete patron $member->{borrowernumber}... "
@ -110,6 +111,13 @@ for my $member (@$members) {
next;
}
if ( $anonymous_patron ) {
if ( $patron->id eq $anonymous_patron ) {
say "Failed to delete patron $borrowernumber: patron is AnonymousPatron";
next;
}
}
if ( $confirm ) {
my $deleted = eval { $patron->move_to_deleted; };
if ($@ or not $deleted) {

Loading…
Cancel
Save