QUAL use fk_warehouse instead of deprecated entrepot_id in line batch

This commit is contained in:
VESSILLER 2025-02-14 16:47:08 +01:00
parent 46d94d25d3
commit 5d6d07745e
3 changed files with 10 additions and 8 deletions

View File

@ -612,11 +612,11 @@ class Expedition extends CommonObject
$tab = $line_ext->detail_batch;
// create stockLocation Qty array
foreach ($tab as $detbatch) {
if (!empty($detbatch->entrepot_id)) {
if (empty($stockLocationQty[$detbatch->entrepot_id])) {
$stockLocationQty[$detbatch->entrepot_id] = 0;
if (!empty($detbatch->fk_warehouse)) {
if (empty($stockLocationQty[$detbatch->fk_warehouse])) {
$stockLocationQty[$detbatch->fk_warehouse] = 0;
}
$stockLocationQty[$detbatch->entrepot_id] += $detbatch->qty;
$stockLocationQty[$detbatch->fk_warehouse] += $detbatch->qty;
}
}
// create shipment lines
@ -627,7 +627,7 @@ class Expedition extends CommonObject
} else {
// create shipment batch lines for stockLocation
foreach ($tab as $detbatch) {
if ($detbatch->entrepot_id == $stockLocation) {
if ($detbatch->fk_warehouse == $stockLocation) {
if (!($detbatch->create($line_id) > 0)) { // Create an ExpeditionLineBatch
$this->errors = $detbatch->errors;
$error++;
@ -1110,7 +1110,7 @@ class Expedition extends CommonObject
}
}
if (is_object($linebatch)) {
$line->entrepot_id = $linebatch->entrepot_id;
$line->entrepot_id = $linebatch->fk_warehouse;
}
$line->origin_line_id = $dbatch['ix_l']; // deprecated
$line->fk_elementdet = $dbatch['ix_l'];

View File

@ -603,7 +603,7 @@ class ExpeditionLigne extends CommonObjectLine
$shipmentLot->batch = $lot->batch;
$shipmentLot->eatby = $lot->eatby;
$shipmentLot->sellby = $lot->sellby;
$shipmentLot->entrepot_id = $this->detail_batch->entrepot_id;
$shipmentLot->fk_warehouse = $this->detail_batch->entrepot_id;
$shipmentLot->qty = $this->detail_batch->qty;
$shipmentLot->fk_origin_stock = (int) $batch_id;
if ($shipmentLot->create($this->id) < 0) {

View File

@ -63,6 +63,7 @@ class ExpeditionLineBatch extends CommonObject
public $dluo_qty;
/**
* @var int
* @deprecated, use fk_warehouse
*/
public $entrepot_id;
/**
@ -117,7 +118,8 @@ class ExpeditionLineBatch extends CommonObject
$this->sellby = $this->db->jdate($obj->sellby);
$this->eatby = $this->db->jdate($obj->eatby);
$this->batch = $obj->batch;
$this->entrepot_id = $obj->fk_entrepot;
$this->entrepot_id = $obj->fk_entrepot; // deprecated use fk_warehouse
$this->fk_warehouse = $obj->fk_entrepot;
$this->fk_origin_stock = (int) $id_stockdluo;
}
$this->db->free($resql);