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 <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Marcel de Rooy 2017-10-20 08:11:38 +02:00 committed by Jonathan Druart
parent 0afe6eca76
commit f46d6a8785

View file

@ -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;
}
}