Bug 42915: Use coded value for library filtering in holds table
This patch adds coded_values for libraries to the holds table
and sets the data type in the pickup library column definition.
This enables searching holds by pickup location.
1. Have holds on a bib for different patrons and pickup locations
2. Try filtering by a pickup library name or branchcode
3. See 'No matching records found'
4. Apply patch and repeat step 2
5. Filtering works!
6. Note: if two libraries share the same beginning text
both results are returned :)
For example: 'Fair' returns holds for pickup at Fairview and Fairfield
Sponsored-by: CLAMS
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
parent
e5aa0c0737
commit
e4a9f1f531
|
|
@ -1,6 +1,7 @@
|
|||
[% USE Koha %]
|
||||
[% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
|
||||
[% USE AuthorisedValues %]
|
||||
[% USE raw %]
|
||||
|
||||
<table id="patron_holds_table_[% biblio_id | html %]_[% split_data | html %]" class="holds_table" data-total-holds="[% total_holds | html %]">
|
||||
<thead>
|
||||
|
|
@ -21,3 +22,10 @@
|
|||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<script nonce="[% Koha.CSPNonce | $raw %]">
|
||||
let all_libraries = [% To.json(Branches.all) | $raw %].map(e => {
|
||||
e['_id'] = e.branchcode;
|
||||
e['_str'] = e.branchname;
|
||||
return e;
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -105,6 +105,10 @@ function display_pickup_location(state) {
|
|||
};
|
||||
})(jQuery);
|
||||
|
||||
var coded_values = {
|
||||
library: new Map(all_libraries.map(l => [l.branchname, l.branchcode])),
|
||||
};
|
||||
|
||||
/* global __ borrowernumber SuspendHoldsIntranet */
|
||||
$(document).ready(function () {
|
||||
let patron_page = holds_table_patron_page();
|
||||
|
|
@ -147,6 +151,11 @@ $(document).ready(function () {
|
|||
var holds = new Array();
|
||||
if (!holdsTable) {
|
||||
var title;
|
||||
|
||||
let filters_options = {
|
||||
libraries: all_libraries,
|
||||
};
|
||||
|
||||
holdsTable = $("#holds-table").kohaTable(
|
||||
{
|
||||
autoWidth: false,
|
||||
|
|
@ -1598,8 +1607,9 @@ async function load_patron_holds_table(biblio_id, split_data) {
|
|||
},
|
||||
{
|
||||
data: "pickup_library_id",
|
||||
datatype: "coded_value:library",
|
||||
orderable: true,
|
||||
searchable: false,
|
||||
searchable: true,
|
||||
render: function (data, type, row, meta) {
|
||||
var branchSelect =
|
||||
"<select priority=" +
|
||||
|
|
|
|||
Loading…
Reference in New Issue