From ab5181d50ce3054b6f1741a3f949983a6298ea24 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Thu, 16 May 2024 22:54:23 +0000 Subject: [PATCH] Bug 36871: Honor DefaultHoldPickupLocation when placing holds for multiple items at once To test: 0. Make sure the DefaultHoldPickupLocation system preference is set to logged in library. 1. In the staff interface, search the catalog with a term that will return a couple of items (e.g. Shakespeare) 2. In the search results, select two or more results 3. Click Place hold 4. Search for a patron (e.g. Acevedo) --> "Pickup location" is empty and the staff member must select the library 5. APPLY PATCH and restart_all 6. Try again, the default should be set according to the DefaultHoldPickupLocation system preference Signed-off-by: Caroline Cyr La Rose Signed-off-by: Paul Derscheid --- .../prog/en/modules/reserve/request.tt | 5 +---- reserve/request.pl | 16 +++++++++------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt index c22eae2fb5..25cb4077ff 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -1132,10 +1132,7 @@ data-biblio-id="[% biblioloo.biblionumber | html %]" data-patron-id="[% patron.borrowernumber | html %]" data-pickup-locations='[% biblioloo.pickup_locations_codes.json | $raw %]'> - - [% FOREACH pickup_location IN biblioloo.pickup_locations %] - - [% END %] + [% PROCESS options_for_libraries libraries => Branches.pickup_locations({ search_params => { biblio => biblionumber, patron => patron }, selected => biblioloo.default_pickup_branch }) %] [% END %] diff --git a/reserve/request.pl b/reserve/request.pl index 5d0887764d..a710e1e2fd 100755 --- a/reserve/request.pl +++ b/reserve/request.pl @@ -565,6 +565,15 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) if ($item->{ccode}) { $itemdata_ccode = 1; } + if ( $patron && $multi_hold ) { + + # Add the valid pickup locations + my @pickup_locations = $biblio->pickup_locations( { patron => $patron } ) + ->search( { branchcode => $default_pickup_branch } )->as_list; + $biblioloopiter{default_pickup_branch} = $default_pickup_branch; + $biblioloopiter{pickup_locations} = \@pickup_locations; + $biblioloopiter{pickup_locations_codes} = [ map { $_->branchcode } @pickup_locations ]; + } } push @{ $biblioloopiter{itemloop} }, $item; @@ -692,13 +701,6 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) $template->param( reserveloop => \@reserveloop ); } - if ( $patron && $multi_hold ) { - # Add the valid pickup locations - my @pickup_locations = $biblio->pickup_locations({ patron => $patron })->as_list; - $biblioloopiter{pickup_locations} = \@pickup_locations; - $biblioloopiter{pickup_locations_codes} = [ map { $_->branchcode } @pickup_locations ]; - } - $num_bibs_available++ unless $biblioloopiter{none_avail}; push @biblioloop, \%biblioloopiter; } -- 2.46.0