diff --git a/changelog/58_UNRELEASED_2020-xx-xx.md b/changelog/58_UNRELEASED_2020-xx-xx.md index 118ceca0..49e80743 100644 --- a/changelog/58_UNRELEASED_2020-xx-xx.md +++ b/changelog/58_UNRELEASED_2020-xx-xx.md @@ -8,6 +8,7 @@ ### Stock improvements/fixes - When creating a new product, the "QU id stock" is now preset by the "QU id purchase" (because most of the time that's most probably the same) (thanks @Mik-) - Clarified the row-button colors and toolips on the stock entries page +- Added a camera-barcode-scanning-button to the barcode(s) field on the product edit page to be able to also scan barcodes by the device camera there - Fixed that the aggregated parent product amount (displayed on the stock overview page and on the product card) did not respect quantity unit conversions when the parent/sub products had different stock quantity units (the unit conversion needs to be globally defined, or as an override on the sub product) - Fixed the conversion factor hint to display also decimal places on the purchase page (only displayed when the product has a different purchase/stock quantity unit) - Fixed that the stock entries page was broken when there were product userfields defined with enabled "Show as column in tables" diff --git a/public/viewjs/barcodescannertesting.js b/public/viewjs/barcodescannertesting.js index 2639ac91..15a86dc1 100644 --- a/public/viewjs/barcodescannertesting.js +++ b/public/viewjs/barcodescannertesting.js @@ -85,7 +85,12 @@ function OnBarcodeScanned(barcode) }, 200); } -$(document).on("Grocy.BarcodeScanned", function(e, barcode) +$(document).on("Grocy.BarcodeScanned", function(e, barcode, target) { + if (target !== "#scanned_barcod") + { + return; + } + OnBarcodeScanned(barcode); }); diff --git a/public/viewjs/components/barcodescanner.js b/public/viewjs/components/barcodescanner.js index dc21c717..440ae3b6 100644 --- a/public/viewjs/components/barcodescanner.js +++ b/public/viewjs/components/barcodescanner.js @@ -149,7 +149,7 @@ Quagga.onDetected(function(result) if (Grocy.Components.BarcodeScanner.DecodedCodesErrorCount / Grocy.Components.BarcodeScanner.DecodedCodesCount < 0.15) { Grocy.Components.BarcodeScanner.StopScanning(); - $(document).trigger("Grocy.BarcodeScanned", [result.codeResult.code]); + $(document).trigger("Grocy.BarcodeScanned", [result.codeResult.code, Grocy.Components.BarcodeScanner.CurrentTarget]); } }); @@ -195,6 +195,8 @@ $(document).on("click", "#barcodescanner-start-button", function(e) return; } + Grocy.Components.BarcodeScanner.CurrentTarget = inputElement.attr("data-target"); + bootbox.dialog({ message: '