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 <oleonard@myacpl.org>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit bd4f454716)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Pedro Amorim 2025-06-11 13:22:17 +00:00 committed by Paul Derscheid
parent 155432a91d
commit d334d9ebaa
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
1 changed files with 6 additions and 5 deletions

View File

@ -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 = $(
'<option value="^%s$">%s</option>'.format(
this._id,
this._str
)
`<option value="${optionValue}">${this._str}</option>`
);
// 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);
});
});