From bd28f2bc6ab70d09c263ff2b6556c9dffe513447 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 15 Aug 2018 14:27:45 -0400 Subject: [PATCH] Bug 7614: Consider transfer limits in Koha::Template::Plugin::Branches Consider transfer limits in Koha::Template::Plugin::Branches->pickup_locations. This patch modified the mentioned method to consider branch transfer limits and does not include any library in the returned list of libraries in case a branch transfer limit applies for a given book or item. To be tested in following patches. --- Koha/Template/Plugin/Branches.pm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Koha/Template/Plugin/Branches.pm b/Koha/Template/Plugin/Branches.pm index 1f50ef3d4b..58b13d2fc5 100644 --- a/Koha/Template/Plugin/Branches.pm +++ b/Koha/Template/Plugin/Branches.pm @@ -85,4 +85,25 @@ sub InIndependentBranchesMode { return ( not C4::Context->preference("IndependentBranches") or C4::Context::IsSuperLibrarian ); } +sub pickup_locations { + my ( $self, $params ) = @_; + $params->{search_params} ||= {}; + $params->{search_params}->{pickup_location} = 1; + return $self->all($params); + + my $selected = $params->{selected}; + my $libraries = Koha::Libraries->pickup_locations($params); + for my $l (@$libraries) { + if ( defined $selected and $l->{branchcode} eq $selected + or not defined $selected + and C4::Context->userenv + and $l->{branchcode} eq C4::Context->userenv->{branch} ) + { + $l->{selected} = 1; + } + } + + return $libraries; +} + 1; -- 2.11.0