From 2ca099d72cb1a49e994cd11f59b8e0c04a060cbc 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 Signed-off-by: Lucas Gass Signed-off-by: Katrin Fischer (cherry picked from commit ea359a10a9e7f8386930311e3190f3441b87a4e7) Signed-off-by: Paul Derscheid (cherry picked from commit 61f9a253e4c5fe4625759759bcdb772b59718998) Signed-off-by: Fridolin Somers --- 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 f0af7c86cf..dace4a257d 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js +++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js @@ -606,9 +606,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 ) {