diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 5265f7025c5..77dde27dd46 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -49,32 +49,104 @@ class Contrat extends CommonObject */ protected $table_ref_field = 'ref'; + /** + * Id of the contract + * @var int + */ var $id; + + /** + * Reference of the contract + * @var string + */ var $ref; + + /** + * External reference of the contract. + * Used by 3rd party services + * @var string + */ var $ref_ext; + + /** + * Supplier reference of the contract + * @var string + */ var $ref_supplier; + + /** + * Client id linked to the contract + * @var int + */ var $socid; var $societe; // Objet societe + + /** + * Status of the contract + * @var int + */ var $statut=0; // 0=Draft, var $product; + /** + * Author of the contract + * @var + */ var $user_author; + + /** + * Date of creation + * @var int + */ var $date_creation; + + /** + * Date of last update + * @var int + */ var $date_validation; + /** + * Date when contract was signed + * @var int + */ var $date_contrat; + + /** + * Date of contract closure + * @var int + * @deprecated we close contract lines, not a contract + */ var $date_cloture; var $commercial_signature_id; var $commercial_suivi_id; - var $note; // deprecated + /** + * @deprecated Use note_private or note_public instead + */ + var $note; + + /** + * Private note + * @var string + */ var $note_private; + + /** + * Public note + * @var string + */ var $note_public; var $modelpdf; + /** + * @deprecated Use fk_project instead + */ var $fk_projet; + public $fk_project; + var $extraparams=array(); var $lines=array(); @@ -441,7 +513,9 @@ class Contrat extends CommonObject $this->ref_ext = $result["ref_ext"]; $this->statut = $result["statut"]; $this->mise_en_service = $this->db->jdate($result["datemise"]); + $this->date_contrat = $this->db->jdate($result["datecontrat"]); + $this->date_creation = $this->db->jdate($result["datecontrat"]); $this->user_author_id = $result["fk_user_author"]; @@ -470,6 +544,18 @@ class Contrat extends CommonObject $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); $this->fetch_optionals($this->id,$extralabels); + /* + * Lines + */ + + $this->lines = array(); + + $result=$this->fetch_lines(); + if ($result < 0) + { + $this->error=$this->db->error(); + return -3; + } return $this->id; } diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index be686377ce3..46364b23d0d 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -239,29 +239,9 @@ class pdf_strato extends ModelePDFContract $iniY = $tab_top + 7; $curY = $tab_top + 7; - $nexY = $tab_top + 7; + $nexY = $tab_top + 2; $pdf->SetXY($this->marge_gauche, $tab_top); - $pdf->MultiCell(190,8,$outputlangs->transnoentities("Description"),0,'L',0); - $pdf->line($this->marge_gauche, $tab_top + 8, $this->page_largeur-$this->marge_droite, $tab_top + 8); - - $pdf->SetFont('', '', $default_font_size - 1); - - $pdf->MultiCell(0, 3, ''); // Set interline to 3 - $pdf->SetXY($this->marge_gauche, $tab_top + 8); - $text=$object->description; - if ($object->duree > 0) - { - $totaltime=convertSecondToTime($object->duree,'all',$conf->global->MAIN_DURATION_OF_WORKDAY); - $text.=($text?' - ':'').$langs->trans("Total").": ".$totaltime; - } - $desc=dol_htmlentitiesbr($text,1); - //print $outputlangs->convToOutputCharset($desc); exit; - - $pdf->writeHTMLCell(180, 3, 10, $tab_top + 8, $outputlangs->convToOutputCharset($desc), 0, 1); - $nexY = $pdf->GetY(); - - $pdf->line($this->marge_gauche, $nexY, $this->page_largeur-$this->marge_droite, $nexY); $pdf->MultiCell(0, 2, ''); // Set interline to 3. Then writeMultiCell must use 3 also. @@ -285,7 +265,20 @@ class pdf_strato extends ModelePDFContract $pageposbefore=$pdf->getPage(); // Description of product line - $txt=''.dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true)." - ".$outputlangs->transnoentities("Duration")." : ".convertSecondToTime($objectligne->duration),1,$outputlangs->charset_output).''; + + if ($objectligne->datei) { + $datei = dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true); + } else { + $datei = $langs->trans("Unknown"); + } + + if ($objectligne->duration) { + $durationi = convertSecondToTime($objectligne->duration); + } else { + $durationi = $langs->trans("Unknown"); + } + + $txt=''.dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".$datei." - ".$outputlangs->transnoentities("Duration")." : ".$durationi,1,$outputlangs->charset_output).''; $desc=dol_htmlentitiesbr($objectligne->desc,1); $pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txt,$desc), 0, 1, 0); @@ -533,7 +526,7 @@ class pdf_strato extends ModelePDFContract $posy+=4; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->datec,"day",false,$outputlangs,true), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date_creation,"day",false,$outputlangs,true), '', 'R'); if ($object->client->code_client) {