From 1f5263ef228ed6b95e45413867879f23eb20f977 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Mon, 27 Jan 2025 17:25:25 +0100 Subject: [PATCH] Escape DataTable regex searches (fixes #2654) --- changelog/78_UNRELEASED_xxxx-xx-xx.md | 6 ++++-- public/viewjs/products.js | 2 +- public/viewjs/stockjournalsummary.js | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/changelog/78_UNRELEASED_xxxx-xx-xx.md b/changelog/78_UNRELEASED_xxxx-xx-xx.md index 96be0e88..cfe22cd2 100644 --- a/changelog/78_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/78_UNRELEASED_xxxx-xx-xx.md @@ -6,11 +6,13 @@ ### New Feature: xxxx -- Fixed that the built-in Open Food Facts external barcode lookup plugin used the staging environment of the Open Food Facts API instead of the production one +- xxx ### Stock -- xxx +- Fixed that the built-in Open Food Facts external barcode lookup plugin used the staging environment of the Open Food Facts API instead of the production one +- Fixed that the product group filter on the products page (master data) didn't work when the selected product group contained special characters +- Fixed that the product filter on the stock journal summary page didn't work when the selected product contained special characters ### Shopping list diff --git a/public/viewjs/products.js b/public/viewjs/products.js index c94b9610..39deaa3c 100644 --- a/public/viewjs/products.js +++ b/public/viewjs/products.js @@ -32,7 +32,7 @@ $("#product-group-filter").on("change", function() } else { - productsTable.column(productsTable.colReorder.transpose(6)).search("^" + value + "$", true, false).draw(); + productsTable.column(productsTable.colReorder.transpose(6)).search("^" + $.fn.dataTable.util.escapeRegex(value) + "$", true, false).draw(); } }); diff --git a/public/viewjs/stockjournalsummary.js b/public/viewjs/stockjournalsummary.js index a0b63fc6..5a4f49d0 100644 --- a/public/viewjs/stockjournalsummary.js +++ b/public/viewjs/stockjournalsummary.js @@ -18,7 +18,7 @@ $("#product-filter").on("change", function() } else { - journalSummaryTable.column(journalSummaryTable.colReorder.transpose(1)).search("^" + text + "$", true, false).draw(); + journalSummaryTable.column(journalSummaryTable.colReorder.transpose(1)).search("^" + $.fn.dataTable.util.escapeRegex(text) + "$", true, false).draw(); } });