From bfce1fea9652f84c2031f59e7213694b05e4ca8a Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 26 Apr 2019 12:04:57 +0000 Subject: [PATCH] Bug 15496: (QA follow-up) Fix new uses of Koha::Biblio::items in list context Signed-off-by: Nick Clemens --- C4/ILSDI/Services.pm | 2 +- Koha/Biblio.pm | 6 +++--- t/db_dependent/Koha/Biblio.t | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm index 56a2f18114..43935bbf8f 100644 --- a/C4/ILSDI/Services.pm +++ b/C4/ILSDI/Services.pm @@ -230,7 +230,7 @@ sub GetRecords { my $biblioitemnumber = $biblioitem->{'biblioitemnumber'}; my $holds = $biblio->current_holds->unblessed; my $issues = GetBiblioIssues($biblionumber); - my @items = $biblio->items; + my @items = $biblio->items->as_list; $biblioitem->{items}->{item} = []; diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index 688edc85ae..3cfce72192 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -154,7 +154,7 @@ sub can_be_transferred { my $limittype = C4::Context->preference('BranchTransferLimitsType'); my $items; - foreach my $item_of_bib ($self->items) { + foreach my $item_of_bib ($self->items->as_list) { next unless $item_of_bib->holdingbranch; next if $from && $from->branchcode ne $item_of_bib->holdingbranch; return 1 if $item_of_bib->holdingbranch eq $to->branchcode; @@ -207,7 +207,7 @@ sub hidden_in_opac { my $rules = $params->{rules} // {}; - return !(any { !$_->hidden_in_opac({ rules => $rules }) } $self->items); + return !(any { !$_->hidden_in_opac({ rules => $rules }) } $self->items->as_list); } =head3 article_request_type @@ -457,7 +457,7 @@ sub has_items_waiting_or_intransit { return 1; } - foreach my $item ( $self->items ) { + foreach my $item ( $self->items->as_list ) { return 1 if $item->get_transfer; } diff --git a/t/db_dependent/Koha/Biblio.t b/t/db_dependent/Koha/Biblio.t index 1e050ca68d..18b3bf2f44 100644 --- a/t/db_dependent/Koha/Biblio.t +++ b/t/db_dependent/Koha/Biblio.t @@ -101,7 +101,7 @@ subtest 'items() tests' => sub { is( ref($items), 'Koha::Items', 'Returns a Koha::Items resultset' ); is( $items->count, 2, 'Two items in resultset' ); - my @items = $biblio->items; + my @items = $biblio->items->as_list; is( scalar @items, 2, 'Same result, but in list context' ); $schema->storage->txn_rollback; -- 2.39.5