From 1eb73d0e495b4067454b2ead144f0c07ecb7f54e Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sat, 31 Jan 2015 13:52:23 +0100 Subject: [PATCH] fetch optional extrafeild lines on propal fetch --- htdocs/comm/propal/class/propal.class.php | 16 +++++++++------- htdocs/contrat/class/contrat.class.php | 1 - 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index f68a1f4f708..be945c7027e 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1196,6 +1196,11 @@ class Propal extends CommonObject $result = $this->db->query($sql); if ($result) { + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + $extrafieldsline=new ExtraFields($this->db); + $line = new PropaleLigne($this->db); + $extralabelsline=$extrafieldsline->fetch_name_optionals_label($line->table_element,true); + $num = $this->db->num_rows($result); $i = 0; @@ -1205,7 +1210,8 @@ class Propal extends CommonObject $line = new PropaleLigne($this->db); - $line->rowid = $objp->rowid; + $line->rowid = $objp->rowid; //Deprecated + $line->id = $objp->rowid; $line->fk_propal = $objp->fk_propal; $line->fk_parent_line = $objp->fk_parent_line; $line->product_type = $objp->product_type; @@ -1246,6 +1252,8 @@ class Propal extends CommonObject $line->date_start = $objp->date_start; $line->date_end = $objp->date_end; + $line->fetch_optionals($line->id,$extralabelsline); + $this->lines[$i] = $line; //dol_syslog("1 ".$line->fk_product); //print "xx $i ".$this->lines[$i]->fk_product; @@ -1259,12 +1267,6 @@ class Propal extends CommonObject return -1; } - // Retreive all extrafield for propal - // fetch optionals attributes and labels - require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - $extrafields=new ExtraFields($this->db); - $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); - $this->fetch_optionals($this->id,$extralabels); return 1; } diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index d5d0d3309dc..21430ecca5b 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -726,7 +726,6 @@ class Contrat extends CommonObject // Retreive all extrafield for propal // fetch optionals attributes and labels - $line->fetch_optionals($line->id,$extralabelsline); $this->lines[] = $line;