From d334d9ebaaba598c7ed55cda43df84556565b909 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Wed, 11 Jun 2025 13:22:17 +0000 Subject: [PATCH] Bug 40118: Only concat ^ and $ if table is ajax Test plan, k-t-d, before applying patches: 1) Place a hold (next available) to biblio 76 and 437: http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=76 http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=437 2) Visit the 'holds to pull' page: http://localhost:8081/cgi-bin/koha/circ/pendingreserves.pl 3) Notice the 'Libraries' filter contains 'Centervile' twice. Notice the filtering never works regardless of option picked. 4) Apply patches. Repeat test plan. Notice 'Centerville' only shows once. Notice filtering works. Signed-off-by: Owen Leonard Signed-off-by: Paul Derscheid Signed-off-by: Lucas Gass (cherry picked from commit bd4f4547167ba971202d810c5451393b70bc318e) Signed-off-by: Paul Derscheid --- koha-tmpl/intranet-tmpl/prog/js/datatables.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js index dcfef3cf7a..58dc8567ea 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js +++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js @@ -1058,12 +1058,14 @@ function _dt_add_filters(table_node, table_dt, filters_options = {}) { filters_options[i] = filters_options[i](table_dt); } $(filters_options[i]).each(function () { + let optionValue = + table_dt.settings()[0].ajax !== null + ? `^${this._id}$` + : this._id; let o = $( - ''.format( - this._id, - this._str - ) + `` ); + // Compare with lc, or selfreg won't match ^SELFREG$ for instance, see bug 32517 // This is only for category, we might want to apply it only in this case. existing_search = existing_search.toLowerCase(); @@ -1142,7 +1144,6 @@ function _dt_add_delay_filters(table_dt, table_node) { .find("select") .unbind() .bind("keyup change", function () { - let value = this.value.length ? "^" + this.value + "$" : ""; col_select_search(i, this.value); }); });