diff --git a/public/viewjs/components/barcodescanner.js b/public/viewjs/components/barcodescanner.js index 45a9203e..82d3973e 100644 --- a/public/viewjs/components/barcodescanner.js +++ b/public/viewjs/components/barcodescanner.js @@ -136,6 +136,14 @@ $(document).on("click", "#barcodescanner-start-button", function(e) { e.preventDefault(); + var inputElement = $(e.currentTarget).prev(); + if (inputElement.hasAttr("disabled")) + { + // Do nothing and disable the barcode scanner start button + $(e.currentTarget).addClass("disabled"); + return; + } + bootbox.dialog({ message: '
', title: __t('Scan a barcode'), @@ -164,5 +172,15 @@ $(document).on("click", "#barcodescanner-start-button", function(e) setTimeout(function() { - $(".barcodescanner-input:visible").after(''); + $(".barcodescanner-input:visible").each(function() + { + if ($(this).hasAttr("disabled")) + { + $(this).after(''); + } + else + { + $(this).after(''); + } + }); }, 50);