From e4a9f1f53188dab0b9323e1094430bd53505c19a Mon Sep 17 00:00:00 2001 From: Brendan Lawlor Date: Tue, 30 Jun 2026 13:52:23 +0000 Subject: [PATCH] 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 Signed-off-by: Martin Renvoize Signed-off-by: Pedro Amorim --- .../intranet-tmpl/prog/en/includes/holds_table.inc | 8 ++++++++ koha-tmpl/intranet-tmpl/prog/js/holds.js | 12 +++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc index 1614ec2c2f..9f5b18eba5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc @@ -1,6 +1,7 @@ [% USE Koha %] [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %] [% USE AuthorisedValues %] +[% USE raw %] @@ -21,3 +22,10 @@
+ diff --git a/koha-tmpl/intranet-tmpl/prog/js/holds.js b/koha-tmpl/intranet-tmpl/prog/js/holds.js index 4c3eef5109..9740c08974 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/holds.js +++ b/koha-tmpl/intranet-tmpl/prog/js/holds.js @@ -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 = "