From b36ff31a13d2cb93cbb56cd201e30e73c0704cfa Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 21 Jan 2022 16:21:29 +0000 Subject: [PATCH] Bug 15157: (follow-up) Add ability to set lower limit --- misc/cronjobs/debar_patrons_with_fines.pl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/misc/cronjobs/debar_patrons_with_fines.pl b/misc/cronjobs/debar_patrons_with_fines.pl index f41987e989..005b544499 100755 --- a/misc/cronjobs/debar_patrons_with_fines.pl +++ b/misc/cronjobs/debar_patrons_with_fines.pl @@ -41,6 +41,11 @@ debt to the library. Display the help message and exit +=item B<-a|--amount> + +Sets the minimum amount the patron owes before we debar them. +Defaults to 0, meaning anyone that owes anything will be debared. + =item B<-m|--message> Add the passed message in the debarment comment @@ -74,6 +79,7 @@ use C4::Log qw( cronlogaction ); my ( $help, $confirm, $message, $expiration, $file ); GetOptions( + 'a|amount' => \$amount, 'h|help' => \$help, 'c|confirm:s' => \$confirm, 'm|message:s' => \$message, @@ -84,7 +90,7 @@ pod2usage(1) if $help; pod2usage(1) unless ( $confirm && ( $message || $file )); cronlogaction(); -my $badBorrowers = Koha::Patrons->filter_by_amount_owed( { more_than => 0 } ); +my $badBorrowers = Koha::Patrons->filter_by_amount_owed( { more_than => $amount // 0 } ); $message = getMessageContent(); while ( my $bb = $badBorrowers->next ) { -- 2.20.1