From 9d9f865f3732d94f864291bb2fb4838fa4a33465 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Jul 2020 00:24:14 +0200 Subject: [PATCH] fetch_optionals must be included into a fetch --- htdocs/contrat/class/contrat.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index c2200a411c2..12ad603ea14 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2776,18 +2776,16 @@ class ContratLigne extends CommonObjectLine * Load object in memory from database * * @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 */ public function fetch($id, $ref = '') { - // Check parameters if (empty($id) && empty($ref)) return -1; $sql = "SELECT"; $sql .= " t.rowid,"; - $sql .= " t.tms,"; $sql .= " t.fk_contrat,"; $sql .= " t.fk_product,"; @@ -2888,10 +2886,14 @@ class ContratLigne extends CommonObjectLine $this->fk_user_cloture = $obj->fk_user_cloture; $this->commentaire = $obj->commentaire; $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); $this->pa_ht = $marginInfos[0]; $this->fk_unit = $obj->fk_unit; + + $this->fetch_optionals(); } + $this->db->free($resql); return 1;