From f0e65e8bdd259ba8aedc4cbc0d9a74e4a95833fd Mon Sep 17 00:00:00 2001 From: lainwir3d Date: Thu, 14 Apr 2022 00:37:26 +0400 Subject: [PATCH 1/2] FIX #20733 Inventory: Do not use batch qty even if present if batch module is disabled. --- htdocs/product/inventory/class/inventory.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index bb55bc1b143..c506204d3f0 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -306,9 +306,14 @@ class Inventory extends CommonObject $inventoryline->fk_warehouse = $obj->fk_warehouse; $inventoryline->fk_product = $obj->fk_product; $inventoryline->batch = $obj->batch; - $inventoryline->qty_stock = ($obj->batch ? $obj->qty : $obj->reel); // If there is batch detail, we take qty for batch, else global qty $inventoryline->datec = dol_now(); + if ($conf->productbatch->enabled) { + $inventoryline->qty_stock = ($obj->batch ? $obj->qty : $obj->reel); // If there is batch detail, we take qty for batch, else global qty + }else{ + $inventoryline->qty_stock = $obj->reel; + } + $resultline = $inventoryline->create($user); if ($resultline <= 0) { $this->error = $inventoryline->error; From 6ab88d0169572afbee05f63e8c41979260a62691 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 28 Apr 2022 10:09:02 +0000 Subject: [PATCH 2/2] Fixing style errors. --- htdocs/product/inventory/class/inventory.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index c506204d3f0..f49b262bc13 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -310,7 +310,7 @@ class Inventory extends CommonObject if ($conf->productbatch->enabled) { $inventoryline->qty_stock = ($obj->batch ? $obj->qty : $obj->reel); // If there is batch detail, we take qty for batch, else global qty - }else{ + } else { $inventoryline->qty_stock = $obj->reel; }