From b9ba0e131aa974fba10af3b296de29d0d2e73f17 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Tue, 1 Mar 2022 14:00:27 +0000 Subject: [PATCH] Bug 19532: (QA follow-up) Fix few Koha::Recalls->search occurrences Due to the wantarray change, we should fix this call in list context. We should either use an iterator now or append as_list. Signed-off-by: Marcel de Rooy Signed-off-by: Fridolin Somers --- opac/opac-user.pl | 4 ++-- recalls/recalls_to_pull.pl | 4 ++-- recalls/recalls_waiting.pl | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/opac/opac-user.pl b/opac/opac-user.pl index 35d52498a8..dc440dced5 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -307,8 +307,8 @@ if ( $pending_checkouts->count ) { # Useless test $issue->{MySummaryHTML} = $my_summary_html; } - my @maybe_recalls = Koha::Recalls->search({ biblionumber => $issue->{biblionumber}, itemnumber => [ undef, $issue->{itemnumber} ], old => undef }); - foreach my $recall ( @maybe_recalls ) { + my $maybe_recalls = Koha::Recalls->search({ biblionumber => $issue->{biblionumber}, itemnumber => [ undef, $issue->{itemnumber} ], old => undef }); + while( my $recall = $maybe_recalls->next ) { if ( $recall->checkout and $recall->checkout->issue_id == $issue->{issue_id} ) { $issue->{recall} = 1; last; diff --git a/recalls/recalls_to_pull.pl b/recalls/recalls_to_pull.pl index 7ac95be349..73d1d294f5 100755 --- a/recalls/recalls_to_pull.pl +++ b/recalls/recalls_to_pull.pl @@ -45,7 +45,7 @@ if ( $op eq 'cancel' ) { } if ( $op eq 'list' ) { - my @recalls = Koha::Recalls->search({ status => [ 'R','O','T' ] }); + my @recalls = Koha::Recalls->search({ status => [ 'R','O','T' ] })->as_list; my @pull_list; my %seen_bib; foreach my $recall ( @recalls ) { @@ -57,7 +57,7 @@ if ( $op eq 'list' ) { $seen_bib{$recall->biblionumber}++; # get recall data about this biblio - my @this_bib_recalls = Koha::Recalls->search({ biblionumber => $recall->biblionumber, status => [ 'R','O','T' ] }, { order_by => { -asc => 'recalldate' } }); + my @this_bib_recalls = Koha::Recalls->search({ biblionumber => $recall->biblionumber, status => [ 'R','O','T' ] }, { order_by => { -asc => 'recalldate' } })->as_list; my $recalls_count = scalar @this_bib_recalls; my @unique_patrons = do { my %seen; grep { !$seen{$_->borrowernumber}++ } @this_bib_recalls }; my $patrons_count = scalar @unique_patrons; diff --git a/recalls/recalls_waiting.pl b/recalls/recalls_waiting.pl index 874129a4b2..9581117293 100755 --- a/recalls/recalls_waiting.pl +++ b/recalls/recalls_waiting.pl @@ -51,7 +51,7 @@ if ( $op eq 'modify' ) { } if ( $op eq 'list' ) { - my @recalls = Koha::Recalls->search({ status => 'W' }); + my @recalls = Koha::Recalls->search({ status => 'W' })->as_list; my $borrower = Koha::Patrons->find( $loggedinuser ); my @over; my $maxdelay = C4::Context->preference('RecallsMaxPickUpDelay') || 7; -- 2.39.5