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
*
* @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;