update inventory to be jquerry

This commit is contained in:
lmarcouiller 2021-07-20 15:06:33 +02:00
parent dd9eb28230
commit 60f0eeaea2

View File

@ -549,17 +549,13 @@ if ($object->id > 0) {
var tabproduct = []; var tabproduct = [];
$(".expectedqty").each(function(){ $(".expectedqty").each(function(){
id = this.id; id = this.id;
warehouse = $("#"+id+"_warehouse")[0].firstChild.lastChild.data; warehouse = $("#"+id+"_warehouse").children().first().text();
productbarcode = $("#"+id+"_product").children().first().attr("title");
productbarcode = $("#"+id+"_product")[0].firstChild.title;
productbarcode = productbarcode.split("<br>"); productbarcode = productbarcode.split("<br>");
productbarcode = productbarcode.filter(barcode => barcode.includes("'.$langs->trans('BarCode').'"))[0]; productbarcode = productbarcode.filter(barcode => barcode.includes("'.$langs->trans('BarCode').'"))[0];
productbarcode = productbarcode.slice(productbarcode.indexOf("</b> ")+5); productbarcode = productbarcode.slice(productbarcode.indexOf("</b> ")+5);
productbatchcode = $("#"+id+"_batch")[0].firstChild; productbatchcode = $("#"+id+"_batch").text();
if(productbatchcode != null){
productbatchcode = productbatchcode.data;
}
if(barcodemode != "barcodeforproduct"){ if(barcodemode != "barcodeforproduct"){
tabproduct.forEach(product=>{ tabproduct.forEach(product=>{
if(product.Batch == productbatchcode){ if(product.Batch == productbatchcode){
@ -626,7 +622,7 @@ if ($object->id > 0) {
tabproduct.forEach(product => { tabproduct.forEach(product => {
if(product.Qty!=0){ if(product.Qty!=0){
console.log("We change #"+product.Id+"_input to match input in scanner box"); console.log("We change #"+product.Id+"_input to match input in scanner box");
$("#"+product.Id+"_input")[0].value = product.Qty*barcodeproductqty; $("#"+product.Id+"_input").val(product.Qty*barcodeproductqty);
} }
}) })
document.forms["formrecord"].submit(); document.forms["formrecord"].submit();