';
print '| '.$langs->trans("Company").' | ';
- $html->select_societes('','socid','s.client = 1',1);
+ $html->select_societes('','socid','',1);
print ' |
';
print '| ';
print '';
@@ -550,7 +550,7 @@ elseif ($fichinterid)
print $html->showrefnav($fichinter,'ref','',1,'ref','ref');
print ' |
';
- // Societe
+ // Third party
print "| ".$langs->trans("Company")." | ".$fichinter->client->getNomUrl(1)." |
";
// Project
@@ -584,7 +584,11 @@ elseif ($fichinterid)
}
// Duration
- print '| '.$langs->trans("TotalDuration").' | '.ConvertSecondToTime($fichinter->duree,'all',$conf->global->MAIN_DURATION_OF_WORKDAY).' |
';
+ print '| '.$langs->trans("TotalDuration").' | ';
+ //print $fichinter->duree.'-'.$conf->global->MAIN_DURATION_OF_WORKDAY;
+ print ''.ConvertSecondToTime($fichinter->duree,'all',$conf->global->MAIN_DURATION_OF_WORKDAY).' | ';
+ //print ''.ConvertSecondToTime(90000,'all',$conf->global->MAIN_DURATION_OF_WORKDAY).' | ';
+ print '
';
// Description (must be a textarea and not html must be allowed (used in list view)
print '| ';
diff --git a/htdocs/lib/date.lib.php b/htdocs/lib/date.lib.php
index a621d539872..060690f3f9d 100644
--- a/htdocs/lib/date.lib.php
+++ b/htdocs/lib/date.lib.php
@@ -38,11 +38,13 @@ function ConvertTime2Seconds($iHours=0,$iMinutes=0,$iSeconds=0)
}
-/** \brief Return, in clear text, value of a number of seconds in days, hours and minutes
- * \param iSecond Number of seconds
- * \param format Output format (all: complete display, hour: displays only hours, min: displays only minutes)
- * \param lengthOfDay Length of day (default 86400 seconds)
- * \return sTime Formated text of duration
+/** \brief Return, in clear text, value of a number of seconds in days, hours and minutes
+ * \param iSecond Number of seconds
+ * \param format Output format (all: complete display, hour: displays only hours, min: displays only minutes)
+ * \param lengthOfDay Length of day (default 86400 seconds)
+ * \return sTime Formated text of duration
+ * \example 3600 return 1h00, 86400 return 1d, 90000 return 1day 1hour
+ *
*/
function ConvertSecondToTime($iSecond,$format='all',$lengthOfDay=86400)
{
@@ -55,25 +57,27 @@ function ConvertSecondToTime($iSecond,$format='all',$lengthOfDay=86400)
if ($iSecond >= $lengthOfDay)
{
$sDay=0;
- for( $i = $iSecond; $i > $lengthOfDay; $i -= $lengthOfDay )
+ for( $i = $iSecond; $i >= $lengthOfDay; $i -= $lengthOfDay )
{
$sDay++;
+ $iSecond-=$lengthOfDay;
}
$dayTranslate = $langs->trans("Day");
if ($iSecond >= ($lengthOfDay*2)) $dayTranslate = $langs->trans("Days");
}
$sTime='';
if ($sDay) $sTime.=$sDay.' '.$dayTranslate.' ';
- $sHour = date("H",$iSecond)-1;
+ $sHour = date("H",$iSecond);
$sMin = date("i",$iSecond);
- if (!empty($sHour) && !empty($sMin))
+ //print 'x'.$sHour.'-'.$sMin;
+ if (intval($sHour) || intval($sMin))
{
- $sTime.= $sHour.'h'.$sMin;
+ $sTime.= $sHour.$langs->trans('h').$sMin;
}
}
else if ($format == 'hour')
{
- $sTime=date("H",$iSecond)-1;
+ $sTime=date("H",$iSecond);
}
else if ($format == 'min')
{
|