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
5 changed files with 9 additions and 8 deletions

View File

@@ -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)
{

View File

@@ -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 = "";

View File

@@ -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)
{

View File

@@ -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)