Bugzilla – Attachment 183908 Details for
Bug 40335
Holds queue does not allow multiselect
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40335: Add ability to multi select collections and locations for holds queue
Bug-40335-Add-ability-to-multi-select-collections-.patch (text/plain), 8.52 KB, created by
Lucas Gass (lukeg)
on 2025-07-09 23:01:34 UTC
(
hide
)
Description:
Bug 40335: Add ability to multi select collections and locations for holds queue
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2025-07-09 23:01:34 UTC
Size:
8.52 KB
patch
obsolete
>From 63845bc9a0857befe16ccd190b9a37d08e5fc268 Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >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 %] > <option value="[% av.authorised_value | html %]" selected="selected">[% av.lib | html %]</option> > [% ELSE %] > <option value="[% av.authorised_value | html %]">[% av.lib | html %]</option> >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; >+ } > </style> > </head> > >@@ -69,8 +77,25 @@ > >[% total | html %] <span>items found for</span> > [% IF ( branchlimit ) %][% Branches.GetName( branchlimit ) | html %][% ELSE %]<span>All libraries</span>[% END %] > [% IF ( itemtypeslimit ) %]<span>and item type: [% ItemTypes.GetDescription( itemtypeslimit ) | html %]</span>[% END %] >- [% IF ( ccodeslimit ) %]<span>and collection: [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode' authorised_value = ccodeslimit ) | html %]</span>[% END %] >- [% IF ( locationslimit ) %]<span>and shelving location: [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location' authorised_value = locationslimit ) | html %]</span>[% END %] >+ [% IF ( ccodeslimit ) %] >+ <span >+ >and collection: >+ [% FOREACH ccode IN ccodeslimit %] >+ [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode' authorised_value = ccode ) | html %] >+ [% UNLESS loop.last %],[% END %] >+ [% END %] >+ </span> >+ [% END %] >+ >+ [% IF ( locationslimit ) %] >+ <span >+ >and shelving location: >+ [% FOREACH loc IN locationslimit %] >+ [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location' authorised_value = loc ) | html %] >+ [% UNLESS loop.last %],[% END %] >+ [% END %] >+ </span> >+ [% END %] > </div> > [% ELSE %] > <div class="alert alert-info">No items found.</div> >@@ -324,16 +349,16 @@ > </li> > <li> > <label for="ccodeslimit">Collection: </label> >- <select name="ccodeslimit" id="ccodeslimit"> >+ <select name="ccodeslimit" id="ccodeslimit" multiple="multiple"> > <option value="">All</option> >- [% 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 %] > </select> > </li> > <li> > <label for="locationslimit">Shelving location: </label> >- <select name="locationslimit" id="locationslimit"> >+ <select name="locationslimit" id="locationslimit" multiple="multiple"> > <option value="">All</option> >- [% 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 %] > </select> > </li> > </ol> >@@ -346,9 +371,18 @@ > [% END %] > > [% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'select2.inc' %] > [% INCLUDE 'datatables.inc' %] > <script> > $(document).ready(function() { >+ // Apply select2 to all select fields having a "multiple" attribute >+ let selectFields = document.querySelectorAll('select[multiple]'); >+ selectFields.forEach((selectField) => { >+ $(selectField).select2({ >+ width: "100%", >+ allowClear: true, >+ }); >+ }); > var holdst; > > // Setup filters before DataTables initialisation, in case some columns are >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 40335
:
183908
|
183909
|
183911
|
183912
|
183913
|
184460
|
184480
|
184481
|
184482