Fixed product Grocycode handling on /purchase (references #2571)

This commit is contained in:
Bernd Bestel
2024-08-24 11:32:15 +02:00
parent 7080ec9a8f
commit 1246f402e5
2 changed files with 2 additions and 1 deletions

View File

@@ -358,7 +358,7 @@ if (Grocy.Components.ProductPicker !== undefined)
Grocy.Api.Get('objects/product_barcodes?query[]=barcode=' + document.getElementById("product_id").getAttribute("barcode"),
function(barcodeResult)
{
if (barcodeResult)
if (barcodeResult && barcodeResult.length > 0)
{
var barcode = barcodeResult[0];
$("#purchase-form").attr("data-used-barcode", barcode.id);