From 7fa7c0fdcc02c992fedbe7acbea9608fe2d4fbf4 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Wed, 15 Nov 2023 20:49:06 +0000 Subject: [PATCH] Bug 31415: Exclude found holds and fix hold ID call --- misc/cronjobs/recalls/convert_holds_to_recalls.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/misc/cronjobs/recalls/convert_holds_to_recalls.pl b/misc/cronjobs/recalls/convert_holds_to_recalls.pl index 79bd0f9bc0e..90669f998ed 100755 --- a/misc/cronjobs/recalls/convert_holds_to_recalls.pl +++ b/misc/cronjobs/recalls/convert_holds_to_recalls.pl @@ -92,7 +92,7 @@ foreach my $bib ( @bib_holds ) { if ( $bib->{bibcount} >= $min ) { # If there are $min or more holds on the same record, convert the oldest hold to a recall - my @holds = Koha::Holds->search({ biblionumber => $bib->{biblionumber} }, { order_by => { -asc => 'reservedate' } })->as_list; + my @holds = Koha::Holds->search({ biblionumber => $bib->{biblionumber}, found => undef }, { order_by => { -asc => 'reservedate' } })->as_list; my $hold_to_convert = $holds[0]; foreach my $res ( @holds ) { if ( dt_from_string($res->reservedate) < dt_from_string($hold_to_convert->reservedate) ) { @@ -126,7 +126,7 @@ foreach my $bib ( @bib_holds ) { $hold_to_convert->cancel({ cancellation_reason => 'RECALLED' }); $count++; if ( $verbose ) { - my $hold_id = $hold_to_convert->hold_id; + my $hold_id = $hold_to_convert->reserve_id; my $biblionumber = $hold_to_convert->biblionumber; print "$count. Hold converted to recall (hold_id: $hold_id, biblionumber: $biblionumber).\n"; } -- 2.30.2