From 9e88bf1f1c5ca1037af27428b165e425bb452cfa Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 25 Jun 2019 15:41:20 +0200 Subject: [PATCH 01/10] NEW multilangs in fetch_lines --- htdocs/commande/class/commande.class.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 4eb3b3236e0..553d3c501c8 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1890,8 +1890,9 @@ class Commande extends CommonOrder * @param int $only_product Return only physical 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 +1984,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; From 66eec4da5297b67c59da27d62064b2c14fc25768 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 25 Jun 2019 15:46:12 +0200 Subject: [PATCH 02/10] Update facture.class.php --- htdocs/compta/facture/class/facture.class.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index f249443ac66..5eb7d43e348 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1469,8 +1469,9 @@ class Facture extends CommonInvoice * * @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 +1560,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; From df0d540ffb171601570a3f8ea007f99f1125b202 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 25 Jun 2019 15:47:16 +0200 Subject: [PATCH 03/10] Update propal.class.php --- htdocs/comm/propal/class/propal.class.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 36162e8b9aa..e148744660d 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1618,8 +1618,9 @@ class Propal extends CommonObject * @param int $only_product Return only physical 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 +1713,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); From a9adccabc3fedce5ec4ae67e255f5e6bf0ce2464 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 25 Jun 2019 15:48:41 +0200 Subject: [PATCH 04/10] Update contrat.class.php --- htdocs/contrat/class/contrat.class.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 91a373743c4..0c7eeb66d67 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -718,8 +718,9 @@ class Contrat extends CommonObject * * @return ContratLigne[] Return array of contract lines */ - public function fetch_lines() + public function fetch_lines($loadalsotranslation = 0) { + global $langs, $conf; // phpcs:enable $this->nbofserviceswait=0; $this->nbofservicesopened=0; @@ -828,6 +829,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; From 87d4e4e35640c88b4a112cb59bdb018d70b1f646 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 25 Jun 2019 15:49:47 +0200 Subject: [PATCH 05/10] Update contrat.class.php --- htdocs/contrat/class/contrat.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 0c7eeb66d67..ae4e485f87a 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -718,7 +718,7 @@ class Contrat extends CommonObject * * @return ContratLigne[] Return array of contract lines */ - public function fetch_lines($loadalsotranslation = 0) + public function fetch_lines($only_product = 0, $loadalsotranslation = 0) { global $langs, $conf; // phpcs:enable From 174e531d69584a89cf76a55565907b3f6cf28c02 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 25 Jun 2019 18:12:16 +0200 Subject: [PATCH 06/10] Update commande.class.php --- htdocs/commande/class/commande.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 553d3c501c8..8469dc0cd1f 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1888,6 +1888,7 @@ 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, $loadalsotranslation = 0) From c813c33e42cad2459587a2b824ba99378d7b9f0d Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 25 Jun 2019 18:13:53 +0200 Subject: [PATCH 07/10] Update contrat.class.php --- htdocs/contrat/class/contrat.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index ae4e485f87a..179c2f5ae83 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -716,6 +716,9 @@ 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($only_product = 0, $loadalsotranslation = 0) From c81ffcd8f00b4e6f54d0917ace00b7d47db3f17b Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 25 Jun 2019 18:14:56 +0200 Subject: [PATCH 08/10] Update facture.class.php --- htdocs/compta/facture/class/facture.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 5eb7d43e348..a502b885ab3 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1467,6 +1467,9 @@ 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($only_product = 0, $loadalsotranslation = 0) From 7f11077f1e00a56968703bc781064be071918720 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 25 Jun 2019 18:16:11 +0200 Subject: [PATCH 09/10] Update propal.class.php --- htdocs/comm/propal/class/propal.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index e148744660d..25b04c7c1e2 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1615,7 +1615,9 @@ 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, $loadalsotranslation = 0) From 30dd3a76d296eb4eb62b0e9ba40b375a3b3d18e2 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 26 Jun 2019 08:23:06 +0200 Subject: [PATCH 10/10] Update contrat.class.php --- htdocs/contrat/class/contrat.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 179c2f5ae83..e16187412a0 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -716,7 +716,7 @@ 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 $only_product Return only physical products * @param int $loadalsotranslation Return translation for products * * @return ContratLigne[] Return array of contract lines