diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 67c7df4be5b..931f30ce998 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -144,7 +144,7 @@ function convertTime2Seconds($iHours=0,$iMinutes=0,$iSeconds=0) /** Return, in clear text, value of a number of seconds in days, hours and minutes * * @param int $iSecond Number of seconds - * @param string $format Output format ('all': total delay days hour:min like "2 days 12:30"", 'allhourmin': total delay hours:min like "60:30", 'allhour': total delay hours without min/sec like "60:30", 'fullhour': total delay hour decimal like "60.5" for 60:30, 'hour': only hours part "12", 'min': only minutes part "30", 'sec': only seconds part, 'month': only month part, 'year': only year part); + * @param string $format Output format ('all': total delay days hour:min like "2 days 12:30", 'allwithouthour': total delay days without hour part like "2 days", 'allhourmin': total delay with format hours:min like "60:30", 'allhour': total delay hours without min/sec like "60:30", 'fullhour': total delay hour decimal like "60.5" for 60:30, 'hour': only hours part "12", 'min': only minutes part "30", 'sec': only seconds part, 'month': only month part, 'year': only year part); * @param int $lengthOfDay Length of day (default 86400 seconds for 1 day, 28800 for 8 hour) * @param int $lengthOfWeek Length of week (default 7) * @return string Formated text of duration @@ -157,7 +157,7 @@ function convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengt if (empty($lengthOfDay)) $lengthOfDay = 86400; // 1 day = 24 hours if (empty($lengthOfWeek)) $lengthOfWeek = 7; // 1 week = 7 days - if ($format == 'all' || $format == 'allhour' || $format == 'allhourmin') + if ($format == 'all' || $format == 'allwithouthour' || $format == 'allhour' || $format == 'allhourmin') { if ($iSecond === 0) return '0'; // This is to avoid having 0 return a 12:00 AM for en_US diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index e7d6d15b9ea..150529ae30d 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -269,18 +269,32 @@ class pdf_strato extends ModelePDFContract // Description of product line - if ($objectligne->datei) { - $datei = dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true); + if ($objectligne->date_ouverture_prevue) { + $datei = dol_print_date($objectligne->date_ouverture_prevue,'day',false,$outputlangs,true); } else { $datei = $langs->trans("Unknown"); } - if ($objectligne->duration) { - $durationi = convertSecondToTime($objectligne->duration); + if ($objectligne->date_fin_validite) { + $durationi = convertSecondToTime($objectligne->date_fin_validite - $objectligne->date_ouverture_prevue, 'allwithouthour'); + $datee = dol_print_date($objectligne->date_fin_validite,'day',false,$outputlangs,true); } else { $durationi = $langs->trans("Unknown"); + $datee = $langs->trans("Unknown"); } + if ($objectligne->date_ouverture) { + $daters = dol_print_date($objectligne->date_ouverture,'day',false,$outputlangs,true); + } else { + $daters = $langs->trans("Unknown"); + } + + if ($objectligne->date_cloture) { + $datere = dol_print_date($objectligne->date_cloture,'day',false,$outputlangs,true); + } else { + $datere = $langs->trans("Unknown"); + } + $txtpredefinedservice=''; $txtpredefinedservice = $objectligne->product_ref; if ($objectligne->product_label) @@ -289,7 +303,10 @@ class pdf_strato extends ModelePDFContract $txtpredefinedservice .= $objectligne->product_label; } - $txt=''.dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".$datei." - ".$outputlangs->transnoentities("Duration")." : ".$durationi,1,$outputlangs->charset_output).''; + $txt=''.dol_htmlentitiesbr($outputlangs->transnoentities("DateStartPlannedShort")." : ".$datei." - ".$outputlangs->transnoentities("DateEndPlanned")." : ".$datee,1,$outputlangs->charset_output).''; + $txt.='
'; + $txt.=''.dol_htmlentitiesbr($outputlangs->transnoentities("DateStartRealShort")." : ".$daters,1,$outputlangs->charset_output); + if ($objectligne->date_cloture) $txt.=dol_htmlentitiesbr(" - ".$outputlangs->transnoentities("DateEndRealShort")." : ".$datere,1,$outputlangs->charset_output).''; $desc=dol_htmlentitiesbr($objectligne->desc,1); $pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txt,dol_concatdesc($txtpredefinedservice,$desc)), 0, 1, 0);