From ff1b3bd12f846bcabf21a9e91965e5c384f2c8af Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 15 Sep 2021 15:27:45 +0100 Subject: [PATCH] Bug 15157: Update for reworked bug 15156 This patch updates the script to use filter_by_amount_owed. We could add a series of options to the script to allow more fine grained control. --- misc/debarrBorrowersWithFines.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) mode change 100644 => 100755 misc/debarrBorrowersWithFines.pl diff --git a/misc/debarrBorrowersWithFines.pl b/misc/debarrBorrowersWithFines.pl old mode 100644 new mode 100755 index fb46a6f351..1cf12d44c4 --- a/misc/debarrBorrowersWithFines.pl +++ b/misc/debarrBorrowersWithFines.pl @@ -60,14 +60,14 @@ elsif (not($file) && not(length($message) > 20)) { exit 1; } -my $badBorrowers = Koha::Patrons->search->search_patrons_with_unpaid_fines(); +my $badBorrowers = Koha::Patrons->filter_by_amount_owed( { more_than => 0 } ); $message = getMessageContent(); -foreach my $bb (@$badBorrowers) { +while (my $bb = $badBorrowers->next ) { #Don't crash, but keep debarring as long as you can! eval { my $success = Koha::Patron::Debarments::AddDebarment({ - borrowernumber => $bb->{borrowernumber}, + borrowernumber => $bb->borrowernumber, expiration => $expiration, type => 'MANUAL', comment => $message, @@ -88,4 +88,4 @@ sub getMessageContent { my @msg = <$FH>; close $FH; return join("",@msg); -} \ No newline at end of file +} -- 2.20.1