From 0b82e2ad0f502eaf9fdc5c267568913201b44f78 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 27 May 2025 10:07:12 +0200 Subject: [PATCH] Bug 40002: Fix filtering of patrons by 'Browse by last name' We cannot longer filter patrons by first letter, the browser errors "Uncaught TypeError: v.replace is not a function" Signed-off-by: Emmi Takkinen --- koha-tmpl/intranet-tmpl/prog/js/datatables.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js index 8a691f0616..dcfef3cf7a 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js +++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js @@ -714,9 +714,13 @@ function _dt_default_ajax(params) { } else if (f == "-and") { if (v) and_query_parameters.push(v); } else if (v) { - additional_filters[k] = v - .replace(/^\^/, "") - .replace(/\$$/, ""); + if (typeof v === "string") { + additional_filters[k] = v + .replace(/^\^/, "") + .replace(/\$$/, ""); + } else { + additional_filters[k] = v; + } } } if (Object.keys(additional_filters).length) { -- 2.34.1