From f51ab91f734780fa152816773a4c7b363bfb2db9 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 Signed-off-by: Owen Leonard --- circ/view_holdsqueue.pl | 23 ++++++---- .../prog/en/includes/html_helpers.inc | 19 +++++++- .../prog/en/modules/circ/view_holdsqueue.tt | 46 ++++++++++++++++--- 3 files changed, 70 insertions(+), 18 deletions(-) diff --git a/circ/view_holdsqueue.pl b/circ/view_holdsqueue.pl index 7bc73f6da6..7e52b821bf 100755 --- a/circ/view_holdsqueue.pl +++ b/circ/view_holdsqueue.pl @@ -39,28 +39,31 @@ my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( } ); -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 $params = $query->Vars; +my $run_report = $params->{'run_report'}; +my $branchlimit = $params->{'branchlimit'}; +my $itemtypeslimit = $params->{'itemtypeslimit'}; +my @locationslimits = $query->multi_param('locationslimit'); +my @ccodeslimits = $query->multi_param('ccodeslimit'); + +my $locationslimit = @locationslimits ? \@locationslimits : undef; +my $ccodeslimit = @ccodeslimits ? \@ccodeslimits : undef; if ($run_report) { my $items = GetHoldsQueueItems( { branchlimit => $branchlimit, itemtypeslimit => $itemtypeslimit, - ccodeslimit => $ccodeslimit, - locationslimit => $locationslimit + ccodeslimit => $locationslimit, + locationslimit => $ccodeslimit, } ); $template->param( branchlimit => $branchlimit, itemtypeslimit => $itemtypeslimit, - ccodeslimit => $ccodeslimit, - locationslimit => $locationslimit, + ccodeslimit => $locationslimit, + locationslimit => $ccodeslimit, total => $items->count, itemsloop => $items, run_report => $run_report, 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 214b29cf40..879aaacfa3 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,24 @@ [% 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 %] + [% FOREACH sel IN selected_av %] + [% IF sel == av.authorised_value %] + [% is_selected = 1 %] + [% LAST %] + [% END %] + [% END %] + [% ELSE %] + [% 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 9eb6e71496..4cd29e7aba 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' %]