Improve setOrigin on Receipt for line_id_object_src & line_id_object_origin (#35091)

In Receipt validate, close... we have setOrigin that not set data line_id_object_src & line_id_object_origin, that variable is very important when we working with custom hook. I checked also on shipment it already implemented.
This commit is contained in:
hermans
2025-09-03 05:29:45 +07:00
committed by GitHub
parent 2e8bf5eb94
commit d7761168ea

View File

@@ -620,7 +620,7 @@ class Reception extends CommonObject
$sql = "SELECT cd.fk_product, cd.subprice, cd.remise_percent,";
$sql .= " ed.rowid, ed.qty, ed.fk_entrepot,";
$sql .= " ed.eatby, ed.sellby, ed.batch,";
$sql .= " ed.cost_price";
$sql .= " ed.fk_elementdet, ed.cost_price";
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,";
$sql .= " ".MAIN_DB_PREFIX."receptiondet_batch as ed";
$sql .= " WHERE ed.fk_reception = ".((int) $this->id);
@@ -644,7 +644,7 @@ class Reception extends CommonObject
//var_dump($this->lines[$i]);
$mouvS = new MouvementStock($this->db);
$mouvS->origin = &$this;
$mouvS->setOrigin($this->element, $this->id);
$mouvS->setOrigin($this->element, $this->id, $obj->fk_elementdet, $obj->rowid);
if (empty($obj->batch)) {
// line without batch detail
@@ -1738,7 +1738,7 @@ class Reception extends CommonObject
$sql = "SELECT cd.fk_product, cd.subprice,";
$sql .= " ed.rowid, ed.qty, ed.fk_entrepot,";
$sql .= " ed.eatby, ed.sellby, ed.batch,";
$sql .= " ed.cost_price";
$sql .= " ed.fk_elementdet, ed.cost_price";
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,";
$sql .= " ".MAIN_DB_PREFIX."receptiondet_batch as ed";
$sql .= " WHERE ed.fk_reception = ".((int) $this->id);
@@ -1762,7 +1762,7 @@ class Reception extends CommonObject
$mouvS = new MouvementStock($this->db);
$mouvS->origin = &$this;
$mouvS->setOrigin($this->element, $this->id);
$mouvS->setOrigin($this->element, $this->id, $obj->fk_elementdet, $obj->rowid);
if (empty($obj->batch)) {
// line without batch detail
@@ -1897,7 +1897,7 @@ class Reception extends CommonObject
$sql = "SELECT ed.fk_product, cd.subprice,";
$sql .= " ed.rowid, ed.qty, ed.fk_entrepot,";
$sql .= " ed.eatby, ed.sellby, ed.batch,";
$sql .= " ed.cost_price";
$sql .= " ed.fk_elementdet, ed.cost_price";
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,";
$sql .= " ".MAIN_DB_PREFIX."receptiondet_batch as ed";
$sql .= " WHERE ed.fk_reception = ".((int) $this->id);
@@ -1920,7 +1920,7 @@ class Reception extends CommonObject
//var_dump($this->lines[$i]);
$mouvS = new MouvementStock($this->db);
$mouvS->origin = &$this;
$mouvS->setOrigin($this->element, $this->id);
$mouvS->setOrigin($this->element, $this->id, $obj->fk_elementdet, $obj->rowid);
if (empty($obj->batch)) {
// line without batch detail
@@ -2032,7 +2032,7 @@ class Reception extends CommonObject
$sql = "SELECT cd.fk_product, cd.subprice,";
$sql .= " ed.rowid, ed.qty, ed.fk_entrepot,";
$sql .= " ed.eatby, ed.sellby, ed.batch,";
$sql .= " ed.cost_price";
$sql .= " ed.fk_elementdet, ed.cost_price";
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,";
$sql .= " ".MAIN_DB_PREFIX."receptiondet_batch as ed";
$sql .= " WHERE ed.fk_reception = ".((int) $this->id);
@@ -2056,7 +2056,7 @@ class Reception extends CommonObject
//var_dump($this->lines[$i]);
$mouvS = new MouvementStock($this->db);
$mouvS->origin = &$this;
$mouvS->setOrigin($this->element, $this->id);
$mouvS->setOrigin($this->element, $this->id, $obj->fk_elementdet, $obj->rowid);
if (empty($obj->batch)) {
// line without batch detail