Skip to content
Snippets Groups Projects
Commit 1b409538 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix #3400

Conflicts:
	htdocs/core/lib/date.lib.php
parent c3fb1485
No related branches found
No related tags found
No related merge requests found
......@@ -166,7 +166,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
......@@ -179,7 +179,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
......
......@@ -268,16 +268,30 @@ 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='';
......@@ -288,7 +302,10 @@ class pdf_strato extends ModelePDFContract
$txtpredefinedservice .= $objectligne->product_label;
}
$txt='<strong>'.dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".$datei." - ".$outputlangs->transnoentities("Duration")." : ".$durationi,1,$outputlangs->charset_output).'</strong>';
$txt='<strong>'.dol_htmlentitiesbr($outputlangs->transnoentities("DateStartPlannedShort")." : ".$datei." - ".$outputlangs->transnoentities("DateEndPlanned")." : ".$datee,1,$outputlangs->charset_output).'</strong>';
$txt.='<br>';
$txt.='<strong>'.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).'</strong>';
$desc=dol_htmlentitiesbr($objectligne->desc,1);
$pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txt,dol_concatdesc($txtpredefinedservice,$desc)), 0, 1, 0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment