From 6f89c02844879a064cfb9c1d62f0bfd5f99fd517 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 25 Jun 2020 07:13:55 -0400 Subject: [PATCH] Bug 25877: Error libraryNotPickupLocation when placing a hold if logged in branchcode is not a pickup location On the staff side, if the librarian is logged in as a branch that is not a hold pickup location, that branch is still used as the default pickup location for the rules, resulting in the item not holdable reason libraryNotPickupLocation, while the pulldown shows the first branch that can actually be used as a pickup location. Test Plan: 1) Log in to Koha 2) Set your logged in branch to not be a pickup location 3) Attempt to place a hold 4) Note the error message 5) Apply this patch 6) Restart plack 7) Reload the page 8) Note the error is gone! Signed-off-by: Andrew Fuerste-Henry --- reserve/request.pl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/reserve/request.pl b/reserve/request.pl index 92f75b2c26..bebd7784ed 100755 --- a/reserve/request.pl +++ b/reserve/request.pl @@ -70,6 +70,12 @@ my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user( my $showallitems = $input->param('showallitems'); my $pickup = $input->param('pickup') || C4::Context->userenv->{'branch'}; +my $pickup_branch = Koha::Libraries->find( $pickup ); +unless ( $pickup_branch->pickup_location ) { + $pickup_branch = Koha::Libraries->search({ pickup_location => 1 })->next; + $pickup = $pickup_branch ? $pickup_branch->id : undef; +} + my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } }; # Select borrowers infos -- 2.11.0