From e31dbdc105fbe366572160c77061a035d29d7263 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. --- 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 8129359aec..3d25cb743a 100755 --- a/misc/cronjobs/delete_patrons.pl +++ b/misc/cronjobs/delete_patrons.pl @@ -89,9 +89,10 @@ if (!defined $members and @file_members) { 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) { @@ -105,14 +106,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; } @@ -126,7 +127,7 @@ for my $member (@$members) { say "OK" if $verbose; } -say "$deleted patrons deleted"; +say "$deleted patrons deleted" if $verbose; =head1 NAME -- 2.20.1