From 63845bc9a0857befe16ccd190b9a37d08e5fc268 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Wed, 9 Jul 2025 22:56:55 +0000 Subject: [PATCH] Bug 40335: Add ability to multi select collections and locations for holds queue To test: 0. APPLY PATCH and restart_all 1. Place some holds with different shelving locations and collection codes. 2. Build the holds queue 3. Go to Circulation > Holds queue 4. Notice that shelfing location and collection code are now multi select2 dropdowns 5. Try searching for various combos of shelfing locations and collection codes. 6. Make sure the results are correct. 7. After making selections and running the search make sure your selections are retained in the search form in the left nav bar --- circ/view_holdsqueue.pl | 10 ++-- .../prog/en/includes/html_helpers.inc | 21 ++++++++- .../prog/en/modules/circ/view_holdsqueue.tt | 46 ++++++++++++++++--- 3 files changed, 66 insertions(+), 11 deletions(-) diff --git a/circ/view_holdsqueue.pl b/circ/view_holdsqueue.pl index 7bc73f6da60..ce630171e1a 100755 --- a/circ/view_holdsqueue.pl +++ b/circ/view_holdsqueue.pl @@ -43,8 +43,12 @@ my $params = $query->Vars; my $run_report = $params->{'run_report'}; my $branchlimit = $params->{'branchlimit'}; my $itemtypeslimit = $params->{'itemtypeslimit'}; -my $ccodeslimit = $params->{'ccodeslimit'}; -my $locationslimit = $params->{'locationslimit'}; + +my @ccodeslimits = grep { $_ && $_ ne '' } $query->multi_param('ccodeslimit'); +my $ccodeslimit = @ccodeslimits ? \@ccodeslimits : undef; + +my @locationslimits = grep { $_ && $_ ne '' } $query->multi_param('locationslimit'); +my $locationslimit = @locationslimits ? \@locationslimits : undef; if ($run_report) { my $items = GetHoldsQueueItems( @@ -52,7 +56,7 @@ if ($run_report) { branchlimit => $branchlimit, itemtypeslimit => $itemtypeslimit, ccodeslimit => $ccodeslimit, - locationslimit => $locationslimit + locationslimit => $locationslimit, } ); diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc index 214b29cf401..9ad0548442c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc @@ -47,9 +47,26 @@ [% END %] [% END %] -[% BLOCK options_for_authorised_values %] +[% BLOCK options_for_authorised_values_multiselect %] [% FOREACH av IN authorised_values %] - [% IF av.authorised_value == selected_av %] + [% is_selected = 0 %] + [% IF selected_av %] + [% IF selected_av.defined && selected_av.size.defined %] + [% # selected_av is an array reference %] + [% FOREACH sel IN selected_av %] + [% IF sel == av.authorised_value %] + [% is_selected = 1 %] + [% LAST %] + [% END %] + [% END %] + [% ELSE %] + [% # selected_av is a single value %] + [% IF av.authorised_value == selected_av %] + [% is_selected = 1 %] + [% END %] + [% END %] + [% END %] + [% IF is_selected %] [% ELSE %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt index 9eb6e71496b..4cd29e7aba9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt @@ -20,6 +20,14 @@ p { margin-top: 0; } + #locationslimit + .select2-container, + #itemtypeslimit + .select2-container { + max-width: 300px !important; + } + .main .col-md-10 #branchlimit, + .main .col-md-10 #itemtypeslimit { + width: 300px; + } @@ -69,8 +77,25 @@ >[% total | html %] items found for [% IF ( branchlimit ) %][% Branches.GetName( branchlimit ) | html %][% ELSE %]All libraries[% END %] [% IF ( itemtypeslimit ) %]and item type: [% ItemTypes.GetDescription( itemtypeslimit ) | html %][% END %] - [% IF ( ccodeslimit ) %]and collection: [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode' authorised_value = ccodeslimit ) | html %][% END %] - [% IF ( locationslimit ) %]and shelving location: [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location' authorised_value = locationslimit ) | html %][% END %] + [% IF ( ccodeslimit ) %] + and collection: + [% FOREACH ccode IN ccodeslimit %] + [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode' authorised_value = ccode ) | html %] + [% UNLESS loop.last %],[% END %] + [% END %] + + [% END %] + + [% IF ( locationslimit ) %] + and shelving location: + [% FOREACH loc IN locationslimit %] + [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location' authorised_value = loc ) | html %] + [% UNLESS loop.last %],[% END %] + [% END %] + + [% END %] [% ELSE %]
No items found.
@@ -324,16 +349,16 @@
  • - - [% PROCESS options_for_authorised_values authorised_values => AuthorisedValues.GetAuthValueDropbox( 'CCODE' ), selected_av => ccodeslimit %] + [% PROCESS options_for_authorised_values_multiselect authorised_values => AuthorisedValues.GetAuthValueDropbox( 'CCODE' ), selected_av => ccodeslimit %]
  • - - [% PROCESS options_for_authorised_values authorised_values => AuthorisedValues.GetAuthValueDropbox( 'LOC' ), selected_av => locationslimit %] + [% PROCESS options_for_authorised_values_multiselect authorised_values => AuthorisedValues.GetAuthValueDropbox( 'LOC' ), selected_av => locationslimit %]
  • @@ -346,9 +371,18 @@ [% END %] [% MACRO jsinclude BLOCK %] + [% INCLUDE 'select2.inc' %] [% INCLUDE 'datatables.inc' %]