From 9935c0bdbfc22096640b79e998cf39118deb969e 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 --- 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 60acb5ad61..30579caa40 100644 --- a/Koha/REST/V1/Holds.pm +++ b/Koha/REST/V1/Holds.pm @@ -419,7 +419,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 cf359edf32..d4aac6399d 100755 --- a/t/db_dependent/Koha/Biblio.t +++ b/t/db_dependent/Koha/Biblio.t @@ -387,7 +387,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) { is( ref($pickup_location), 'Koha::Library', 'Object type is correct' ); diff --git a/t/db_dependent/Template/Plugin/Branches.t b/t/db_dependent/Template/Plugin/Branches.t index 4c149dfc69..377a36e061 100755 --- 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