forked from Wavyzz/dolibarr
Merge branch '3.6' of git@github.com:Dolibarr/dolibarr.git into 3.6
This commit is contained in:
@@ -16,3 +16,4 @@ printEatby= Eat-by: %s
|
|||||||
printSellby= Sell-by: %s
|
printSellby= Sell-by: %s
|
||||||
printQty= Qty: %d
|
printQty= Qty: %d
|
||||||
AddDispatchBatchLine=Add a line for Shelf Life dispatching
|
AddDispatchBatchLine=Add a line for Shelf Life dispatching
|
||||||
|
BatchDefaultNumber= Undefined
|
||||||
@@ -14,4 +14,6 @@ DetailBatchFormat= C:%s UO: %s LOT: %s (Qté : %d)
|
|||||||
printBatch= Lot: %s
|
printBatch= Lot: %s
|
||||||
printEatby= DLC: %s
|
printEatby= DLC: %s
|
||||||
printSellby= DLUO: %s
|
printSellby= DLUO: %s
|
||||||
printQty= Qté: %d
|
printQty= Qté: %d
|
||||||
|
AddDispatchBatchLine=Ajouter une ligne de dispatch
|
||||||
|
BatchDefaultNumber= Indéfini
|
||||||
@@ -589,6 +589,39 @@ class Product extends CommonObject
|
|||||||
|
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
|
if (empty($this->oldcopy))
|
||||||
|
{
|
||||||
|
$org=new self($this->db);
|
||||||
|
$org->fetch($this->id);
|
||||||
|
$this->oldcopy=$org;
|
||||||
|
}
|
||||||
|
// test if batch management is activated on existing product
|
||||||
|
if ($this->hasbatch() && !$this->oldcopy->hasbatch())
|
||||||
|
{
|
||||||
|
$this->load_stock();
|
||||||
|
foreach ($this->stock_warehouse as $idW => $ObjW)
|
||||||
|
{
|
||||||
|
$qty_batch = 0;
|
||||||
|
foreach ($ObjW->detail_batch as $detail)
|
||||||
|
{
|
||||||
|
$qty_batch += $detail->qty;
|
||||||
|
}
|
||||||
|
// Quantities in batch details are not same same as stock quantity
|
||||||
|
// So we add a default batch record
|
||||||
|
if ($ObjW->real <> $qty_batch)
|
||||||
|
{
|
||||||
|
$ObjBatch = new Productbatch($this->db);
|
||||||
|
$ObjBatch->batch = $langs->trans('BatchDefaultNumber');
|
||||||
|
$ObjBatch->qty = $ObjW->real - $qty_batch;
|
||||||
|
$ObjBatch->fk_product_stock = $ObjW->id;
|
||||||
|
if ($ObjBatch->create($user,1) < 0)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$this->errors=$ObjBatch->errors;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// For automatic creation
|
// For automatic creation
|
||||||
if ($this->barcode == -1) $this->barcode = $this->get_barcode($this,$this->barcode_type_code);
|
if ($this->barcode == -1) $this->barcode = $this->get_barcode($this,$this->barcode_type_code);
|
||||||
|
|
||||||
@@ -2918,6 +2951,7 @@ class Product extends CommonObject
|
|||||||
$this->stock_warehouse[$row->fk_entrepot] = new stdClass();
|
$this->stock_warehouse[$row->fk_entrepot] = new stdClass();
|
||||||
$this->stock_warehouse[$row->fk_entrepot]->real = $row->reel;
|
$this->stock_warehouse[$row->fk_entrepot]->real = $row->reel;
|
||||||
$this->stock_warehouse[$row->fk_entrepot]->pmp = $row->pmp;
|
$this->stock_warehouse[$row->fk_entrepot]->pmp = $row->pmp;
|
||||||
|
$this->stock_warehouse[$row->fk_entrepot]->id = $row->rowid;
|
||||||
if ($this->hasbatch()) $this->stock_warehouse[$row->fk_entrepot]->detail_batch=Productbatch::findAll($this->db,$row->rowid,1);
|
if ($this->hasbatch()) $this->stock_warehouse[$row->fk_entrepot]->detail_batch=Productbatch::findAll($this->db,$row->rowid,1);
|
||||||
$this->stock_reel+=$row->reel;
|
$this->stock_reel+=$row->reel;
|
||||||
$i++;
|
$i++;
|
||||||
|
|||||||
Reference in New Issue
Block a user