From dd9eb282303e97948d2716faafb36dce9418d9fa Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Tue, 20 Jul 2021 14:43:36 +0200 Subject: [PATCH] Barcode scanner tool update --- htdocs/core/class/html.formother.class.php | 4 - htdocs/langs/en_US/stocks.lang | 3 + htdocs/product/inventory/inventory.php | 159 ++++++++++++++------- 3 files changed, 109 insertions(+), 57 deletions(-) diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 93aee37987f..5f00ed6877b 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -92,10 +92,6 @@ class FormOther $out .= ''; $out .= '
'; - $out .= ''.$langs->trans("FeatureNotYetAvailable").''; - - // TODO Add call of javascript $jstoexecuteonadd so each scan will add qty into the inventory page + an ajax save. - $out .= ''; + tabproduct.forEach(product => { + if(product.Qty!=0){ + console.log("We change #"+product.Id+"_input to match input in scanner box"); + $("#"+product.Id+"_input")[0].value = product.Qty*barcodeproductqty; + } + }) + document.forms["formrecord"].submit(); + } + }'; + print ''; + } include DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; $formother = new FormOther($db); print $formother->getHTMLScannerForm(); } + //Call method to undo changes in real qty + print ''; print '
'; //print '
'; @@ -722,9 +774,10 @@ if ($object->id > 0) { print ''; print ''; print ''; + print '  '; print ''.img_delete().''; print ''; - $qty_tmp = GETPOST("id_".$obj->rowid."_input_tmp") && price2num(GETPOST("id_".$obj->rowid."_input_tmp", 'MS')) >= 0 ? GETPOST("id_".$obj->rowid."_input_tmp") : $qty_view; + $qty_tmp = price2num(GETPOST("id_".$obj->rowid."_input_tmp", 'MS')) >= 0 ? GETPOST("id_".$obj->rowid."_input_tmp") : $qty_view; print ''; } else { print $obj->qty_view;