add porduct inventory but qty_view bug

This commit is contained in:
lmarcouiller 2021-12-01 12:10:57 +01:00
parent f39dd30a7f
commit 7512305b44
2 changed files with 9 additions and 8 deletions

View File

@ -51,8 +51,9 @@ $fk_entrepot = GETPOST("fk_entrepot", "int");
$fk_inventory = GETPOST("fk_inventory", "int");
$fk_product = GETPOST("fk_product", "int");
$reelqty = GETPOST("reelqty", "int");
$qtyview = GETPOST("Qty", "int");
$qtyview = GETPOST("qty", "int");
$batch = GETPOST("batch", "int");
$mode = GETPOST("mode", "aZ");
$warehousefound = 0;
$warehouseid = 0;
@ -106,7 +107,9 @@ if ($action == "addnewlineproduct") {
$inventoryline->fk_product = $fk_product;
$inventoryline->qty_stock = $reelqty;
$inventoryline->qty_view = $qtyview;
$inventoryline->batch = $batch;
if ($mode == "lotserial") {
$inventoryline->batch = $batch;
}
$inventoryline->datec = dol_now();
$result = $inventoryline->create($user);

View File

@ -548,8 +548,8 @@ if ($object->id > 0) {
var barcodeproductqty = $("input[name=barcodeproductqty]").val();
var textarea = $("textarea[name=barcodelist]").val();
var textarray = textarea.split("\n");
var tabproduct = [];
if(textarray[0] != ""){
var tabproduct = [];
$(".expectedqty").each(function(){
id = this.id;
warehouse = $("#"+id+"_warehouse").children().first().text();
@ -579,7 +579,7 @@ if ($object->id > 0) {
barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,selectaddorreplace,"barcode",true);
barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,selectaddorreplace,"lotserial",true);
break;
case "barcodeforproduct": //TODO: create product !exist + ajout
case "barcodeforproduct":
barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,selectaddorreplace,"barcode");
break;
case "barcodeforlotserial":
@ -595,7 +595,7 @@ if ($object->id > 0) {
console.log("We change #"+product.Id+"_input to match input in scanner box");
if(product.hasOwnProperty("reelqty")){
$.ajax({ url: \''.DOL_URL_ROOT.'/product/inventory/ajax/searchfrombarcode.php\',
data: { "action":"addnewlineproduct","fk_entrepot":product.Warehouse,"batch":Batch,"fk_inventory":'.dol_escape_js($object->id).',"fk_product":product.fk_product,"reelqty":product.reelqty,"qty":product.Qty},
data: { "action":"addnewlineproduct","fk_entrepot":product.Warehouse,"batch":product.Batch,"fk_inventory":'.dol_escape_js($object->id).',"fk_product":product.fk_product,"reelqty":product.reelqty,"qty":product.Qty},
type: \'POST\',
async: false,
success: function(response) {
@ -666,10 +666,8 @@ if ($object->id > 0) {
}
})
if(BarcodeIsInProduct==0 && newproductrow){
//addproduct to tabproduct
tabproduct.push({\'Id\':tabproduct.length-1,\'Warehouse\':newproductrow.fk_warehouse,\'Barcode\':element,\'Batch\':"",\'Qty\':1,\'fetched\':true,\'reelqty\':object.reelqty});
tabproduct.push({\'Id\':tabproduct.length-1,\'Warehouse\':newproductrow.fk_warehouse,\'Barcode\':element,\'Batch\':element,\'Qty\':barcodeproductqty,\'fetched\':true,\'reelqty\':newproductrow.reelqty,\'fk_product\':newproductrow.fk_product,\'mode\':mode});
}
return tabproduct;
}
';
print '</script>';