From c0a9d615fa1cd5b4bd73aa269bf4f621ee75ef0d Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Fri, 5 Jun 2026 17:58:22 +0200 Subject: [PATCH] Properly handle double quotes in product picker product name matching (fixes #2930) --- changelog/82_UNRELEASED_xxxx-xx-xx.md | 1 + public/viewjs/components/productpicker.js | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/changelog/82_UNRELEASED_xxxx-xx-xx.md b/changelog/82_UNRELEASED_xxxx-xx-xx.md index a5538250..dd224879 100644 --- a/changelog/82_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/82_UNRELEASED_xxxx-xx-xx.md @@ -11,6 +11,7 @@ ### Stock - The product picker now searches product names accent insensitive +- Fixed that the product picker workflow dialog was not displayed when the entered value contained double quotes - Fixed that changing the location on the purchase page re-initialized the due date based on product defaults (if any) - Fixed that when undoing a product consume or transfer transaction, the store of the corresponding stock entry wasn't restored - This will only apply to new consume / transfer transactions, not when undoing transactions made before using this release diff --git a/public/viewjs/components/productpicker.js b/public/viewjs/components/productpicker.js index efba2167..6106ff83 100644 --- a/public/viewjs/components/productpicker.js +++ b/public/viewjs/components/productpicker.js @@ -98,10 +98,10 @@ if (prefillProduct2) } if (typeof prefillProduct !== "undefined") { - var possibleOptionElement = $("#product_id option[data-additional-searchdata*=\"" + prefillProduct + "\"]").first(); + var possibleOptionElement = $("#product_id option[data-additional-searchdata*='" + prefillProduct.replace("'", "\\'") + "']").first(); if (possibleOptionElement.length === 0) { - possibleOptionElement = $("#product_id option:contains(\"" + prefillProduct + "\")").first(); + possibleOptionElement = $("#product_id option:contains('" + prefillProduct.replace("'", "\\'") + "')").first(); } if (possibleOptionElement.length > 0) @@ -172,7 +172,7 @@ $('#product_id_text_input').on('blur', function (e) } else // Normal product barcode handling { - possibleOptionElement = $("#product_id option[data-additional-searchdata*=\"" + input.toLowerCase() + ",\"]").first(); + possibleOptionElement = $("#product_id option[data-additional-searchdata*='" + input.toLowerCase().replace("'", "\\'") + ",']").first(); } if (GetUriParam('flow') === undefined && input.length > 0 && possibleOptionElement.length > 0)