fetch_optionals must be included into a fetch

This commit is contained in:
Laurent Destailleur 2020-07-20 00:24:14 +02:00
parent e5688e2641
commit 9d9f865f37

View File

@ -2776,18 +2776,16 @@ class ContratLigne extends CommonObjectLine
* Load object in memory from database * Load object in memory from database
* *
* @param int $id Id object * @param int $id Id object
* @param string $ref Ref of contract * @param string $ref Ref of contract line
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function fetch($id, $ref = '') public function fetch($id, $ref = '')
{ {
// Check parameters // Check parameters
if (empty($id) && empty($ref)) return -1; if (empty($id) && empty($ref)) return -1;
$sql = "SELECT"; $sql = "SELECT";
$sql .= " t.rowid,"; $sql .= " t.rowid,";
$sql .= " t.tms,"; $sql .= " t.tms,";
$sql .= " t.fk_contrat,"; $sql .= " t.fk_contrat,";
$sql .= " t.fk_product,"; $sql .= " t.fk_product,";
@ -2888,10 +2886,14 @@ class ContratLigne extends CommonObjectLine
$this->fk_user_cloture = $obj->fk_user_cloture; $this->fk_user_cloture = $obj->fk_user_cloture;
$this->commentaire = $obj->commentaire; $this->commentaire = $obj->commentaire;
$this->fk_fournprice = $obj->fk_fournprice; $this->fk_fournprice = $obj->fk_fournprice;
$marginInfos = getMarginInfos($obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, $this->fk_fournprice, $obj->pa_ht); $marginInfos = getMarginInfos($obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, $this->fk_fournprice, $obj->pa_ht);
$this->pa_ht = $marginInfos[0]; $this->pa_ht = $marginInfos[0];
$this->fk_unit = $obj->fk_unit; $this->fk_unit = $obj->fk_unit;
$this->fetch_optionals();
} }
$this->db->free($resql); $this->db->free($resql);
return 1; return 1;