From d7761168eae00445d40644b2cd68e3d7a7fe84e4 Mon Sep 17 00:00:00 2001 From: hermans <938767+hermans@users.noreply.github.com> Date: Wed, 3 Sep 2025 05:29:45 +0700 Subject: [PATCH] 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. --- htdocs/reception/class/reception.class.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 3eba3cca46f..a6a645e8b60 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -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