diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 36162e8b9aa..25b04c7c1e2 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1615,11 +1615,14 @@ class Propal extends CommonObject /** * Load array lines * - * @param int $only_product Return only physical products + * @param int $only_product Return only physical products + * @param int $loadalsotranslation Return translation for products + * * @return int <0 if KO, >0 if OK */ - public function fetch_lines($only_product = 0) + public function fetch_lines($only_product = 0, $loadalsotranslation = 0) { + global $langs, $conf; // phpcs:enable $this->lines=array(); @@ -1712,6 +1715,13 @@ class Propal extends CommonObject $line->multicurrency_total_ttc = $objp->multicurrency_total_ttc; $line->fetch_optionals(); + + // multilangs + if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($objp->fk_product) && ! empty($loadalsotranslation)) { + $line = new Product($this->db); + $line->fetch($objp->fk_product); + $line->getMultiLangs(); + } $this->lines[$i] = $line; //dol_syslog("1 ".$line->fk_product); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 4eb3b3236e0..8469dc0cd1f 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1888,10 +1888,12 @@ class Commande extends CommonOrder * Load array lines * * @param int $only_product Return only physical products + * @param int $loadalsotranslation Return translation for products * @return int <0 if KO, >0 if OK */ - public function fetch_lines($only_product = 0) + public function fetch_lines($only_product = 0, $loadalsotranslation = 0) { + global $langs, $conf; // phpcs:enable $this->lines=array(); @@ -1983,6 +1985,13 @@ class Commande extends CommonOrder $line->multicurrency_total_ttc = $objp->multicurrency_total_ttc; $line->fetch_optionals(); + + // multilangs + if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($objp->fk_product) && ! empty($loadalsotranslation)) { + $line = new Product($this->db); + $line->fetch($objp->fk_product); + $line->getMultiLangs(); + } $this->lines[$i] = $line; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index f249443ac66..a502b885ab3 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1467,10 +1467,14 @@ class Facture extends CommonInvoice /** * Load all detailed lines into this->lines * + * @param int $only_product Return only physical products + * @param int $loadalsotranslation Return translation for products + * * @return int 1 if OK, < 0 if KO */ - public function fetch_lines() + public function fetch_lines($only_product = 0, $loadalsotranslation = 0) { + global $langs, $conf; // phpcs:enable $this->lines=array(); @@ -1559,6 +1563,13 @@ class Facture extends CommonInvoice $line->multicurrency_total_ttc = $objp->multicurrency_total_ttc; $line->fetch_optionals(); + + // multilangs + if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($objp->fk_product) && ! empty($loadalsotranslation)) { + $line = new Product($this->db); + $line->fetch($objp->fk_product); + $line->getMultiLangs(); + } $this->lines[$i] = $line; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 91a373743c4..e16187412a0 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -716,10 +716,14 @@ class Contrat extends CommonObject * Load lines array into this->lines. * This set also nbofserviceswait, nbofservicesopened, nbofservicesexpired and nbofservicesclosed * + * @param int $only_product Return only physical products + * @param int $loadalsotranslation Return translation for products + * * @return ContratLigne[] Return array of contract lines */ - public function fetch_lines() + public function fetch_lines($only_product = 0, $loadalsotranslation = 0) { + global $langs, $conf; // phpcs:enable $this->nbofserviceswait=0; $this->nbofservicesopened=0; @@ -828,6 +832,13 @@ class Contrat extends CommonObject // Retreive all extrafields for contract // fetch optionals attributes and labels $line->fetch_optionals(); + + // multilangs + if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($objp->fk_product) && ! empty($loadalsotranslation)) { + $line = new Product($this->db); + $line->fetch($objp->fk_product); + $line->getMultiLangs(); + } $this->lines[$pos] = $line; $this->lines_id_index_mapper[$line->id] = $pos;