From 31a93424aa2b21ed44eb51c40ea9cf8884a15630 Mon Sep 17 00:00:00 2001 From: Surya Paolo Date: Wed, 25 Jun 2025 17:48:44 +0200 Subject: [PATCH] =?UTF-8?q?-=20aggiunto=20filtro=20nella=20lista=20product?= =?UTF-8?q?table=20-=20ora=20compare=20il=20bottone=20aggiungi=20alla=20li?= =?UTF-8?q?sta=20solo=20se=20non=20=C3=A8=20presente.=20-=20corretto=20la?= =?UTF-8?q?=20ricerca=20con=20"#"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/models/product.js | 7 ++++++- src/server/version.txt | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/server/models/product.js b/src/server/models/product.js index fd90223..0c0faa5 100755 --- a/src/server/models/product.js +++ b/src/server/models/product.js @@ -286,6 +286,8 @@ module.exports.executeQueryTable = function (idapp, params) { module.exports.executeQueryPickup = async function (idapp, params) { let strfindInput = tools.removeAccents(params.search.trim().toLowerCase()); + strfindInput = strfindInput.replace(/#/g, ' '); // aggiungi spazio prima di # se vuoi conservarlo + // Rimuove le parole "il" e "la" e gli spazi, le @ e i tabulazioni // per non farli influire sulla ricerca strfindInput = strfindInput @@ -308,7 +310,10 @@ module.exports.executeQueryPickup = async function (idapp, params) { const cleanInput = tools.removeAccents(strfindInput.trim()); const words = cleanInput.split(/\s+/); - const escapeRegex = (w) => w.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + const escapeRegex = (w) => { + // Escape del carattere '#' e altri caratteri speciali + return w.replace(/[.*+?^${}()|[\]\\]/g, '\\$&').replace(/#/g, '\\#'); + }; // 🔹 Pattern per productInfo.name: tutte le parole devono essere presenti const patternAllWords = words.map((w) => `(?=.*\\b${escapeRegex(w)})`).join('') + '.*'; diff --git a/src/server/version.txt b/src/server/version.txt index 7664e79..b38ee02 100644 --- a/src/server/version.txt +++ b/src/server/version.txt @@ -1 +1 @@ -1.2.57 \ No newline at end of file +1.2.58 \ No newline at end of file