From cc1d8dd36f9e44052dca93c1a426097135c0d718 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 2 Jul 2026 15:37:41 +0200 Subject: [PATCH] Bug 42981: Prevent toLowerCase to fail when comparing int and string If stateSave is turned on and one of the option has a value with _id set to an Integer, toLowerCase is not available and a JS error is raised: Uncaught (in promise) TypeError: this._id.toLowerCase is not a function Test plan: 1.) Admin - table settings: cgi-bin/koha/admin/columns_settings.pl#eholdings|packages Activate checkbox "Save search state on page change" 2.) Go to ERM : cgi-bin/koha/erm/eholdings/local/packages And create two packages: - One package with My Vendor assigned. - One package without a vendor. 3.) Filter the package results list by My Vendor. --> List is filtered to one package 4.) Leave the page, for example by navigating to Agreements. Return to the Packages list and you will see the issue (See also attached Screenshot) => Without the patch The package results list becomes unresponsive / hangs after returning to the page. => With the patch The package results list should load and display the filtered results correctly. Signed-off-by: Michaela Sieber Signed-off-by: Matt Blenkinsop Signed-off-by: Lucas Gass --- koha-tmpl/intranet-tmpl/prog/js/datatables.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js index a8714fbf6c..96817862cc 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js +++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js @@ -1163,7 +1163,10 @@ function _dt_add_filters(table_node, table_dt, filters_options = {}) { if ( existing_search === this._id || (existing_search && - this._id.toLowerCase().match(existing_search)) + this._id + .toString() + .toLowerCase() + .match(existing_search)) ) { o.prop("selected", "selected"); }