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