Fixed single quotes problem in all pickers (fixes #264)

This commit is contained in:
Bernd Bestel 2019-06-09 09:06:44 +02:00
parent a56f8be19e
commit 825be63b93
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
5 changed files with 9 additions and 8 deletions

View File

@ -4,5 +4,6 @@
- Fixed that tooltips were visible forever when consuming all products on the stock overview page - 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 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 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 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!) - Improved night mode CSS (done by @BlizzWave, thanks!)

View File

@ -43,7 +43,7 @@ $('.location-combobox').combobox({
var prefillByName = Grocy.Components.LocationPicker.GetPicker().parent().data('prefill-by-name').toString(); var prefillByName = Grocy.Components.LocationPicker.GetPicker().parent().data('prefill-by-name').toString();
if (typeof prefillByName !== "undefined") if (typeof prefillByName !== "undefined")
{ {
possibleOptionElement = $("#location_id option:contains('" + prefillByName + "')").first(); possibleOptionElement = $("#location_id option:contains(\"" + prefillByName + "\")").first();
if (possibleOptionElement.length > 0) if (possibleOptionElement.length > 0)
{ {

View File

@ -70,10 +70,10 @@ if (!prefillProduct2.isEmpty())
} }
if (typeof prefillProduct !== "undefined") 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) if (possibleOptionElement.length === 0)
{ {
possibleOptionElement = $("#product_id option:contains('" + prefillProduct + "')").first(); possibleOptionElement = $("#product_id option:contains(\"" + prefillProduct + "\")").first();
} }
if (possibleOptionElement.length > 0) 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 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) if (GetUriParam('addbarcodetoselection') === undefined && possibleOptionElement.length > 0)
{ {
@ -135,7 +135,7 @@ $('#product_id_text_input').on('blur', function(e)
return; 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") if (input.length > 0 && optionElement.length === 0 && typeof GetUriParam('addbarcodetoselection') === "undefined")
{ {
var addProductWorkflowsAdditionalCssClasses = ""; var addProductWorkflowsAdditionalCssClasses = "";

View File

@ -43,7 +43,7 @@ $('.recipe-combobox').combobox({
var prefillByName = Grocy.Components.RecipePicker.GetPicker().parent().data('prefill-by-name').toString(); var prefillByName = Grocy.Components.RecipePicker.GetPicker().parent().data('prefill-by-name').toString();
if (typeof prefillByName !== "undefined") if (typeof prefillByName !== "undefined")
{ {
possibleOptionElement = $("#recipe_id option:contains('" + prefillByName + "')").first(); possibleOptionElement = $("#recipe_id option:contains(\"" + prefillByName + "\")").first();
if (possibleOptionElement.length > 0) if (possibleOptionElement.length > 0)
{ {

View File

@ -42,10 +42,10 @@ $('.user-combobox').combobox({
var prefillUser = Grocy.Components.UserPicker.GetPicker().parent().data('prefill-by-username').toString(); var prefillUser = Grocy.Components.UserPicker.GetPicker().parent().data('prefill-by-username').toString();
if (typeof prefillUser !== "undefined") 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) if (possibleOptionElement.length === 0)
{ {
possibleOptionElement = $("#user_id option:contains('" + prefillUser + "')").first(); possibleOptionElement = $("#user_id option:contains(\"" + prefillUser + "\")").first();
} }
if (possibleOptionElement.length > 0) if (possibleOptionElement.length > 0)