From 4bc3fe1c72602c6e3886725836558af8f7b370f2 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 17 Apr 2020 12:24:24 +0200 Subject: [PATCH] Bug 25157: Silent patron deletion cmd line script Without -v the script will no longer display messages unless the error is major. Signed-off-by: Katrin Fischer Signed-off-by: Marcel de Rooy Signed-off-by: Martin Renvoize Signed-off-by: Joy Nelson --- misc/cronjobs/delete_patrons.pl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/misc/cronjobs/delete_patrons.pl b/misc/cronjobs/delete_patrons.pl index e8e90dd00e..24a0f92377 100755 --- a/misc/cronjobs/delete_patrons.pl +++ b/misc/cronjobs/delete_patrons.pl @@ -57,9 +57,10 @@ my $members = GetBorrowersToExpunge( unless ($confirm) { say "Doing a dry run; no patron records will actually be deleted."; say "Run again with --confirm to delete the records."; + $verbose ||= 1; } -say scalar(@$members) . " patrons to delete"; +say scalar(@$members) . " patrons to delete" if $verbose;; my $deleted = 0; for my $member (@$members) { @@ -73,14 +74,14 @@ for my $member (@$members) { next; } if ( my $charges = $patron->account->non_issues_charges ) { # And what if we owe to this patron? - say "Failed to delete patron $borrowernumber: patron has $charges in fines"; + say "Failed to delete patron $borrowernumber: patron has $charges in fines" if $verbose; next; } if ( $confirm ) { my $deleted = eval { $patron->move_to_deleted; }; if ($@ or not $deleted) { - say "Failed to delete patron $borrowernumber, cannot move it" . ( $@ ? ": ($@)" : "" ); + say "Failed to delete patron $borrowernumber, cannot move it" . ( $@ ? ": ($@)" : "" ) if $verbose; next; } @@ -94,7 +95,7 @@ for my $member (@$members) { say "OK" if $verbose; } -say "$deleted patrons deleted"; +say "$deleted patrons deleted" if $verbose; =head1 NAME -- 2.39.5