From cf4b49d27c366a407d14c268c531592383060a77 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 13 Nov 2020 13:53:15 +0000 Subject: [PATCH] Bug 27002: Update callers for changed return Signed-off-by: David Nind Signed-off-by: Tomas Cohen Arazi Signed-off-by: Jonathan Druart Signed-off-by: Jonathan Druart (cherry picked from commit 9935c0bdbfc22096640b79e998cf39118deb969e) Signed-off-by: Andrew Fuerste-Henry --- Koha/REST/V1/Holds.pm | 2 +- Koha/Template/Plugin/Branches.pm | 4 ++-- t/db_dependent/Koha/Biblio.t | 2 +- t/db_dependent/Template/Plugin/Branches.t | 3 ++- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Koha/REST/V1/Holds.pm b/Koha/REST/V1/Holds.pm index 678dca59b5..a96b84dd00 100644 --- a/Koha/REST/V1/Holds.pm +++ b/Koha/REST/V1/Holds.pm @@ -417,7 +417,7 @@ sub pickup_locations { my @pickup_locations = $hold->itemnumber ? @{ $hold->item->pickup_locations( { patron => $hold->patron } )->as_list() } - : @{ $hold->biblio->pickup_locations( { patron => $hold->patron } ) }; + : @{ $hold->biblio->pickup_locations( { patron => $hold->patron } )->as_list() }; @pickup_locations = map { $_->to_api } @pickup_locations; diff --git a/Koha/Template/Plugin/Branches.pm b/Koha/Template/Plugin/Branches.pm index f0bbf40cd7..80ef90e83c 100644 --- a/Koha/Template/Plugin/Branches.pm +++ b/Koha/Template/Plugin/Branches.pm @@ -123,13 +123,13 @@ sub pickup_locations { elsif ($biblio) { $biblio = Koha::Biblios->find($biblio) unless ref($biblio) eq 'Koha::Biblio'; - @libraries = @{ $biblio->pickup_locations( { patron => $patron } ) } + @libraries = $biblio->pickup_locations( { patron => $patron } ) if defined $biblio; } } @libraries = Koha::Libraries->search( { pickup_location => 1 }, - { order_by => ['branchname'] } )->as_list + { order_by => ['branchname'] } ) unless @libraries; @libraries = map { $_->unblessed } @libraries; diff --git a/t/db_dependent/Koha/Biblio.t b/t/db_dependent/Koha/Biblio.t index 4283460699..485b31a14e 100644 --- a/t/db_dependent/Koha/Biblio.t +++ b/t/db_dependent/Koha/Biblio.t @@ -382,7 +382,7 @@ subtest 'pickup_locations' => sub { my ( $cbranch, $biblio, $patron, $results ) = @_; t::lib::Mocks::mock_preference('ReservesControlBranch', $cbranch); - my @pl = @{ $biblio->pickup_locations( { patron => $patron} ) }; + my @pl = $biblio->pickup_locations( { patron => $patron } ); foreach my $pickup_location (@pl) { next diff --git a/t/db_dependent/Template/Plugin/Branches.t b/t/db_dependent/Template/Plugin/Branches.t index 4c149dfc69..377a36e061 100644 --- a/t/db_dependent/Template/Plugin/Branches.t +++ b/t/db_dependent/Template/Plugin/Branches.t @@ -155,7 +155,8 @@ subtest 'pickup_locations() tests' => sub { $biblio_class->mock( 'pickup_locations', sub { - return [$library_2]; + return Koha::Libraries->search( + { branchcode => $library_2->branchcode } ); } ); -- 2.39.5