@@ -, +, @@
locations
constraint on the valid pickup locations for easier testing.
or 3 item home branches.
---
.../prog/en/modules/reserve/request.tt | 44 +++++++++++++++++--
reserve/placerequest.pl | 7 +--
reserve/request.pl | 14 ++++++
3 files changed, 59 insertions(+), 6 deletions(-)
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt
@@ -1,6 +1,7 @@
[% USE raw %]
[% USE To %]
[% USE Asset %]
+[% USE JSON.Escape %]
[% USE Koha %]
[% USE KohaDates %]
[% USE Branches %]
@@ -414,6 +415,7 @@
[% IF ( multi_hold ) %]
+
[% FOREACH biblioloo IN biblioloop %]
@@ -454,7 +456,10 @@
[% PROCESS options_for_libraries libraries => Branches.pickup_locations({ search_params => { biblio => biblionumber, patron => patron }, selected => pickup }) %]
[% ELSE %]
@@ -759,6 +764,7 @@
[% END %]
Priority |
Information |
+ Pickup location |
[% FOREACH biblioloo IN biblioloop %]
[% IF ( biblioloo.warn ) %]
@@ -822,6 +828,18 @@
[% END %]
[% END %]
+
+
+ |
[% END # /FOREACH biblioloo %]
@@ -1252,10 +1270,30 @@
templateResult: display_pickup_location
});
});
+
$("#pickup_multi").select2({
- width: 'style',
- allowClear: false
+ width: '30%',
+ allowClear: true
+ });
+
+ $('.multi_pickup_select').select2({
+ width: '100%',
+ allowClear: true
});
+
+ $("#pickup_multi").on("change", function() {
+ var selection = $(this).val();
+ if ( selection != '' ) {
+ $(".multi_pickup_select").each(function() {
+ var valid_pickup_locations = $(this).data('pickup-locations');
+ if ( valid_pickup_locations.includes(selection) ) {
+ $(this).val(selection);
+ $(this).trigger("change");
+ }
+ });
+ }
+ });
+
$("#pickup").each( function () {
var this_dropdown = $(this);
var patron_id = $(this).data('patron-id');
--- a/reserve/placerequest.pl
+++ a/reserve/placerequest.pl
@@ -67,8 +67,9 @@ my %bibinfos = ();
my @biblionumbers = split '/', $biblionumbers;
foreach my $bibnum (@biblionumbers) {
my %bibinfo = ();
- $bibinfo{title} = $input->param("title_$bibnum");
- $bibinfo{rank} = $input->param("rank_$bibnum");
+ $bibinfo{title} = $input->param("title_$bibnum");
+ $bibinfo{rank} = $input->param("rank_$bibnum");
+ $bibinfo{pickup} = $input->param("pickup_$bibnum");
$bibinfos{$bibnum} = \%bibinfo;
}
@@ -128,7 +129,7 @@ if ( $type eq 'str8' && $borrower ) {
if ( $can_override || CanBookBeReserved($borrower->{'borrowernumber'}, $biblionumber)->{status} eq 'OK' ) {
AddReserve(
{
- branchcode => $branch,
+ branchcode => $bibinfo->{pickup},
borrowernumber => $borrower->{'borrowernumber'},
biblionumber => $biblionumber,
priority => $bibinfo->{rank},
--- a/reserve/request.pl
+++ a/reserve/request.pl
@@ -286,6 +286,13 @@ $template->param(
# FIXME launch another time GetMember perhaps until (Joubu: Why?)
my $patron = Koha::Patrons->find( $borrowernumber_hold );
+if ( $patron && $multi_hold ) {
+ my @multi_pickup_locations =
+ Koha::Biblios->search( { biblionumber => \@biblionumbers } )
+ ->pickup_locations( { patron => $patron } );
+ $template->param( multi_pickup_locations => \@multi_pickup_locations );
+}
+
my $logged_in_patron = Koha::Patrons->find( $borrowernumber );
my $wants_check;
@@ -737,6 +744,13 @@ foreach my $biblionumber (@biblionumbers) {
$template->param( reserveloop => \@reserveloop );
}
+ if ( $patron ) {
+ # Add the valid pickup locations
+ my @pickup_locations = $biblio->pickup_locations({ patron => $patron });
+ $biblioloopiter{pickup_locations} = \@pickup_locations;
+ $biblioloopiter{pickup_locations_codes} = [ map { $_->branchcode } @pickup_locations ];
+ }
+
push @biblioloop, \%biblioloopiter;
}
--