@@ -, +, @@ --- 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(-) --- a/Koha/REST/V1/Holds.pm +++ a/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; --- a/Koha/Template/Plugin/Branches.pm +++ a/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; --- a/t/db_dependent/Koha/Biblio.t +++ a/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' ); --- a/t/db_dependent/Template/Plugin/Branches.t +++ a/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 } ); } ); --