Add fetch optionnals extrafield on contract lines

This commit is contained in:
Florian HENRY 2015-01-31 13:50:18 +01:00
parent d0cc56d616
commit d39439437e

View File

@ -641,6 +641,11 @@ class Contrat extends CommonObject
$now=dol_now();
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafieldsline=new ExtraFields($this->db);
$line = new ContratLigne($this->db);
$extralabelsline=$extrafieldsline->fetch_name_optionals_label($line->table_element,true);
$this->lines=array();
// Selectionne les lignes contrats liees a un produit
@ -719,6 +724,11 @@ class Contrat extends CommonObject
$line->date_fin_prevue = $this->db->jdate($objp->date_fin_validite);
$line->date_fin_reel = $this->db->jdate($objp->date_cloture);
// Retreive all extrafield for propal
// fetch optionals attributes and labels
$line->fetch_optionals($line->id,$extralabelsline);
$this->lines[] = $line;
//dol_syslog("1 ".$line->desc);
@ -814,6 +824,13 @@ class Contrat extends CommonObject
if ($line->statut == 4 && (! empty($line->date_fin_prevue) && $line->date_fin_prevue < $now)) $this->nbofservicesexpired++;
if ($line->statut == 5) $this->nbofservicesclosed++;
// Retreive all extrafield for propal
// fetch optionals attributes and labels
$line->fetch_optionals($line->id,$extralabelsline);
$this->lines[] = $line;
$total_ttc+=$objp->total_ttc;