diff --git a/changelog/49_2.4.2_xxxx-xx-xx.md b/changelog/49_2.4.2_xxxx-xx-xx.md index e06b2103..eaddeea7 100644 --- a/changelog/49_2.4.2_xxxx-xx-xx.md +++ b/changelog/49_2.4.2_xxxx-xx-xx.md @@ -4,5 +4,6 @@ - Fixed that tooltips were visible forever when consuming all products on the stock overview page - Fixed that login did not work when "Stay logged in permanently" was set on grocy runs on a 32-bit system (thanks @matejdro) - Fixed page reloads when "Auto reload on external changes" is enabled and there is unsaved form data (the detection did not work on forms in modal dialogs, e. g. when adding a entry to the meal plan) +- Fixed (again) that the product picker did not work properly when the product name contains single quotes - Improved that errors/messages from the API are shown properly when undoing a stock booking is not possible (stock journal page) - Improved night mode CSS (done by @BlizzWave, thanks!) diff --git a/public/viewjs/components/locationpicker.js b/public/viewjs/components/locationpicker.js index dcb4fdb6..4bb46b67 100644 --- a/public/viewjs/components/locationpicker.js +++ b/public/viewjs/components/locationpicker.js @@ -43,7 +43,7 @@ $('.location-combobox').combobox({ var prefillByName = Grocy.Components.LocationPicker.GetPicker().parent().data('prefill-by-name').toString(); if (typeof prefillByName !== "undefined") { - possibleOptionElement = $("#location_id option:contains('" + prefillByName + "')").first(); + possibleOptionElement = $("#location_id option:contains(\"" + prefillByName + "\")").first(); if (possibleOptionElement.length > 0) { diff --git a/public/viewjs/components/productpicker.js b/public/viewjs/components/productpicker.js index 284ef760..f987e072 100644 --- a/public/viewjs/components/productpicker.js +++ b/public/viewjs/components/productpicker.js @@ -70,10 +70,10 @@ if (!prefillProduct2.isEmpty()) } if (typeof prefillProduct !== "undefined") { - var possibleOptionElement = $("#product_id option[data-additional-searchdata*='" + prefillProduct.replace("'", "\\'") + "']").first(); + var possibleOptionElement = $("#product_id option[data-additional-searchdata*=\"" + prefillProduct + "\"]").first(); if (possibleOptionElement.length === 0) { - possibleOptionElement = $("#product_id option:contains('" + prefillProduct + "')").first(); + possibleOptionElement = $("#product_id option:contains(\"" + prefillProduct + "\")").first(); } if (possibleOptionElement.length > 0) @@ -120,7 +120,7 @@ $('#product_id_text_input').on('blur', function(e) } var input = $('#product_id_text_input').val().toString(); - var possibleOptionElement = $("#product_id option[data-additional-searchdata*='" + input.replace("'", "\\'") + "']").first(); + var possibleOptionElement = $("#product_id option[data-additional-searchdata*=\"" + input + "\"]").first(); if (GetUriParam('addbarcodetoselection') === undefined && possibleOptionElement.length > 0) { @@ -135,7 +135,7 @@ $('#product_id_text_input').on('blur', function(e) return; } - var optionElement = $("#product_id option:contains('" + input + "')").first(); + var optionElement = $("#product_id option:contains(\"" + input + "\")").first(); if (input.length > 0 && optionElement.length === 0 && typeof GetUriParam('addbarcodetoselection') === "undefined") { var addProductWorkflowsAdditionalCssClasses = ""; diff --git a/public/viewjs/components/recipepicker.js b/public/viewjs/components/recipepicker.js index 2096f88f..fca2b018 100644 --- a/public/viewjs/components/recipepicker.js +++ b/public/viewjs/components/recipepicker.js @@ -43,7 +43,7 @@ $('.recipe-combobox').combobox({ var prefillByName = Grocy.Components.RecipePicker.GetPicker().parent().data('prefill-by-name').toString(); if (typeof prefillByName !== "undefined") { - possibleOptionElement = $("#recipe_id option:contains('" + prefillByName + "')").first(); + possibleOptionElement = $("#recipe_id option:contains(\"" + prefillByName + "\")").first(); if (possibleOptionElement.length > 0) { diff --git a/public/viewjs/components/userpicker.js b/public/viewjs/components/userpicker.js index b4c2a20e..0ef8682c 100644 --- a/public/viewjs/components/userpicker.js +++ b/public/viewjs/components/userpicker.js @@ -42,10 +42,10 @@ $('.user-combobox').combobox({ var prefillUser = Grocy.Components.UserPicker.GetPicker().parent().data('prefill-by-username').toString(); if (typeof prefillUser !== "undefined") { - var possibleOptionElement = $("#user_id option[data-additional-searchdata*='" + prefillUser.replace("'", "\\'") + "']").first(); + var possibleOptionElement = $("#user_id option[data-additional-searchdata*=\"" + prefillUser + "\"]").first(); if (possibleOptionElement.length === 0) { - possibleOptionElement = $("#user_id option:contains('" + prefillUser + "')").first(); + possibleOptionElement = $("#user_id option:contains(\"" + prefillUser + "\")").first(); } if (possibleOptionElement.length > 0)