Merge pull request #11406 from ptibogxiv/patch-194
NEW Can load multilang translation in same step than fetch_lines
This commit is contained in:
commit
c0ba22fc6c
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user