mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 12:20:22 +00:00
Add amount to barcode created by the workflow InplaceAddBarcodeToExistingProduct on /purchase (closes #2085)
This commit is contained in:
@@ -17,7 +17,7 @@ Grocy.Components.ProductAmountPicker.Reload = function(productId, destinationQuI
|
||||
|
||||
// Only conversions related to the destination QU are needed
|
||||
// + only add one conversion per to_qu_id (multiple ones can be a result of contradictory definitions = user input bullshit)
|
||||
if (conversion.from_qu_id == destinationQuId && !$('#qu_id option[value="' + conversion.to_qu_id + '"]').length)
|
||||
if ((conversion.from_qu_id == destinationQuId || conversion.to_qu_id == destinationQuId) && !$('#qu_id option[value="' + conversion.to_qu_id + '"]').length)
|
||||
{
|
||||
$("#qu_id").append('<option value="' + conversion.to_qu_id + '" data-qu-factor="' + factor + '" data-qu-name-plural="' + conversion.to_qu_name_plural + '">' + conversion.to_qu_name + '</option>');
|
||||
}
|
||||
|
@@ -434,13 +434,13 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
|
||||
if (barcode != null)
|
||||
{
|
||||
if (barcode.amount != null && !barcode.amount.isEmpty())
|
||||
if (barcode.amount != null)
|
||||
{
|
||||
$("#display_amount").val(barcode.amount);
|
||||
$("#display_amount").select();
|
||||
}
|
||||
|
||||
if (barcode.qu_id != null && !barcode.qu_id.isEmpty())
|
||||
if (barcode.qu_id != null)
|
||||
{
|
||||
Grocy.Components.ProductAmountPicker.SetQuantityUnit(barcode.qu_id);
|
||||
}
|
||||
|
@@ -277,13 +277,13 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
|
||||
if (barcode != null)
|
||||
{
|
||||
if (barcode.amount != null && !barcode.amount.isEmpty())
|
||||
if (barcode.amount != null)
|
||||
{
|
||||
$("#display_amount").val(barcode.amount);
|
||||
$("#display_amount").select();
|
||||
}
|
||||
|
||||
if (barcode.qu_id != null && !barcode.qu_id.isEmpty())
|
||||
if (barcode.qu_id != null)
|
||||
{
|
||||
Grocy.Components.ProductAmountPicker.SetQuantityUnit(barcode.qu_id);
|
||||
}
|
||||
|
@@ -99,6 +99,8 @@ $('#save-purchase-button').on('click', function(e)
|
||||
jsonDataBarcode.barcode = GetUriParam("barcode");
|
||||
jsonDataBarcode.product_id = jsonForm.product_id;
|
||||
jsonDataBarcode.shopping_location_id = jsonForm.shopping_location_id;
|
||||
jsonDataBarcode.qu_id = jsonForm.qu_id;
|
||||
jsonDataBarcode.amount = jsonForm.display_amount;
|
||||
|
||||
Grocy.Api.Post('objects/product_barcodes', jsonDataBarcode,
|
||||
function(result)
|
||||
@@ -361,13 +363,13 @@ if (Grocy.Components.ProductPicker !== undefined)
|
||||
|
||||
if (barcode != null)
|
||||
{
|
||||
if (barcode.amount != null && !barcode.amount.isEmpty())
|
||||
if (barcode.amount != null)
|
||||
{
|
||||
$("#display_amount").val(barcode.amount);
|
||||
$("#display_amount").select();
|
||||
}
|
||||
|
||||
if (barcode.qu_id != null && !barcode.qu_id.isEmpty())
|
||||
if (barcode.qu_id != null)
|
||||
{
|
||||
Grocy.Components.ProductAmountPicker.SetQuantityUnit(barcode.qu_id);
|
||||
}
|
||||
|
@@ -222,13 +222,13 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
|
||||
if (barcode != null)
|
||||
{
|
||||
if (barcode.amount != null && !barcode.amount.isEmpty())
|
||||
if (barcode.amount != null)
|
||||
{
|
||||
$("#display_amount").val(barcode.amount);
|
||||
$("#display_amount").select();
|
||||
}
|
||||
|
||||
if (barcode.qu_id != null && !barcode.qu_id.isEmpty())
|
||||
if (barcode.qu_id != null)
|
||||
{
|
||||
Grocy.Components.ProductAmountPicker.SetQuantityUnit(barcode.qu_id);
|
||||
}
|
||||
|
Reference in New Issue
Block a user