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>
$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) {
. $hold->borrowernumber
. " on biblio: "
. $hold->biblionumber . "\n";
- CancelReserve( { reserve_id => $hold->reserve_id } ) if $confirm;
+ $hold->cancel if $confirm;
}
}