From f46d6a8785db490ec9067ba6964b5172e06ee848 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 20 Oct 2017 08:11:38 +0200 Subject: [PATCH] Bug 16187: (QA follow-up) Additional fixes Fix: Can't locate object method "next" via package "13" (perhaps you forgot to load "13"?) at misc/cronjobs/holds/cancel_unfilled_holds.pl line 119. Undefined subroutine &main::CancelReserve called at misc/cronjobs/holds/cancel_unfilled_holds.pl line 143. The script does not use Koha::Object's get_column correctly for getting the branch codes. The call to CancelReserve is obsolete. Was moved in the meantime to Koha::Hold->cancel. Signed-off-by: Marcel de Rooy Signed-off-by: Jonathan Druart --- misc/cronjobs/holds/cancel_unfilled_holds.pl | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/misc/cronjobs/holds/cancel_unfilled_holds.pl b/misc/cronjobs/holds/cancel_unfilled_holds.pl index 29e7472ea0..08c2029b66 100755 --- a/misc/cronjobs/holds/cancel_unfilled_holds.pl +++ b/misc/cronjobs/holds/cancel_unfilled_holds.pl @@ -112,12 +112,7 @@ warn "Running in test mode, no actions will be taken" unless ($confirm); $verbose and warn "Looking for unfilled holds placed $days or more days ago\n"; -unless ( scalar @branchcodes > 0 ) { - my $branches = Koha::Libraries->search->get_column('branchcode'); - while ( my $branch = $branches->next ) { - push @branchcodes, $branch->branchcode; - } -} +@branchcodes = Koha::Libraries->search->get_column('branchcode') if !@branchcodes; $verbose and warn "Running for branch(es): " . join( "|", @branchcodes ) . "\n"; foreach my $branch (@branchcodes) { @@ -144,7 +139,7 @@ foreach my $branch (@branchcodes) { . $hold->borrowernumber . " on biblio: " . $hold->biblionumber . "\n"; - CancelReserve( { reserve_id => $hold->reserve_id } ) if $confirm; + $hold->cancel if $confirm; } } -- 2.39.5