Fixed product copy source / default value prefilling handling (fixes #1179)

This commit is contained in:
Bernd Bestel 2020-12-16 17:51:05 +01:00
parent 1567b9d9d9
commit d9a3c5169e
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300

View File

@ -266,24 +266,6 @@ $("#delete-current-product-picture-button").on("click", function(e)
$("#product-picture-label-none").removeClass("d-none");
});
if (Grocy.EditMode === 'create')
{
if (Grocy.UserSettings.product_presets_location_id.toString() !== '-1')
{
$("#location_id").val(Grocy.UserSettings.product_presets_location_id);
}
if (Grocy.UserSettings.product_presets_product_group_id.toString() !== '-1')
{
$("#product_group_id").val(Grocy.UserSettings.product_presets_product_group_id);
}
if (Grocy.UserSettings.product_presets_qu_id.toString() !== '-1')
{
$("select.input-group-qu").val(Grocy.UserSettings.product_presets_qu_id);
}
}
var quConversionsTable = $('#qu-conversions-table-products').DataTable({
'order': [[1, 'asc']],
"orderFixed": [[4, 'asc']],
@ -470,3 +452,20 @@ if (Grocy.EditMode == "create" && GetUriParam("copy-of") != undefined)
}
);
}
else if (Grocy.EditMode === 'create')
{
if (Grocy.UserSettings.product_presets_location_id.toString() !== '-1')
{
$("#location_id").val(Grocy.UserSettings.product_presets_location_id);
}
if (Grocy.UserSettings.product_presets_product_group_id.toString() !== '-1')
{
$("#product_group_id").val(Grocy.UserSettings.product_presets_product_group_id);
}
if (Grocy.UserSettings.product_presets_qu_id.toString() !== '-1')
{
$("select.input-group-qu").val(Grocy.UserSettings.product_presets_qu_id);
}
}