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 <oleonard@myacpl.org> Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
64e1083e04
commit
1226bb645f
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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 %]
|
||||
<option value="[% av.authorised_value | html %]" selected="selected">[% av.lib | html %]</option>
|
||||
[% ELSE %]
|
||||
<option value="[% av.authorised_value | html %]">[% av.lib | html %]</option>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
@ -328,16 +353,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>
|
||||
|
|
@ -352,10 +377,19 @@
|
|||
[% INCLUDE 'hold-group-modal.inc' %]
|
||||
|
||||
[% MACRO jsinclude BLOCK %]
|
||||
[% INCLUDE 'select2.inc' %]
|
||||
[% INCLUDE 'datatables.inc' %]
|
||||
[% Asset.js("js/hold-group.js") | $raw %]
|
||||
<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
|
||||
|
|
|
|||
Loading…
Reference in New Issue