From ba892d39d2e197cc9fad942ac5202d0706ef505f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 6 Jan 2020 22:10:16 +0100 Subject: [PATCH] Bug 24350: Fix Branches.pickup_locations This will fix the following error: Template process failed: undef error - Not a HASH reference at /home/vagrant/kohaclone/Koha/Template/Plugin/Branches.pm line 96. at /home/vagrant/kohaclone/C4/Templates.pm line 122 Koha::Libraries->pickup_locations does not always return an array, but arrayref if $biblio is not a Koha::Biblio object. I do not think it's the correct fix, the pattern in Koha::Libraries->pickup_locations is wrong: we should not expect 2 different types for a given parameter, biblio should always be a Koha::Biblio (idem for item btw). That could be fixed easily if the template had the Koha::Biblio object sent. Signed-off-by: Caroline Cyr La Rose Signed-off-by: Martin Renvoize --- Koha/Template/Plugin/Branches.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Koha/Template/Plugin/Branches.pm b/Koha/Template/Plugin/Branches.pm index bdb19707de..d677ccdcf0 100644 --- a/Koha/Template/Plugin/Branches.pm +++ b/Koha/Template/Plugin/Branches.pm @@ -90,9 +90,9 @@ sub pickup_locations { my $search_params = $params->{search_params} || {}; my $selected = $params->{selected}; - my @libraries = map { $_->unblessed } Koha::Libraries->pickup_locations($search_params); + my $libraries = Koha::Libraries->pickup_locations($search_params)->unblessed; - for my $l (@libraries) { + for my $l (@$libraries) { if ( defined $selected and $l->{branchcode} eq $selected or not defined $selected and C4::Context->userenv @@ -102,7 +102,7 @@ sub pickup_locations { } } - return \@libraries; + return $libraries; } 1; -- 2.20.1