Fix: Error in function ConvertSecondTotime
This commit is contained in:
parent
ceb8d9a43e
commit
9d6663cf31
@ -445,7 +445,7 @@ if ($_GET["action"] == 'create')
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Ref").'</td>';
|
||||
print '<td><input name="ref" value="$numpr"></td></tr>'."\n";
|
||||
print '<td><input name="ref" value="'.$numpr.'"></td></tr>'."\n";
|
||||
|
||||
if ($conf->projet->enabled)
|
||||
{
|
||||
@ -488,7 +488,7 @@ if ($_GET["action"] == 'create')
|
||||
print '<form name="fichinter" action="'.$_SERVER['PHP_SELF'].'" method="GET">';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td>';
|
||||
$html->select_societes('','socid','s.client = 1',1);
|
||||
$html->select_societes('','socid','',1);
|
||||
print '</td></tr>';
|
||||
print '<tr><td colspan="2" align="center">';
|
||||
print '<input type="hidden" name="action" value="create">';
|
||||
@ -550,7 +550,7 @@ elseif ($fichinterid)
|
||||
print $html->showrefnav($fichinter,'ref','',1,'ref','ref');
|
||||
print '</td></tr>';
|
||||
|
||||
// Societe
|
||||
// Third party
|
||||
print "<tr><td>".$langs->trans("Company")."</td><td>".$fichinter->client->getNomUrl(1)."</td></tr>";
|
||||
|
||||
// Project
|
||||
@ -584,7 +584,11 @@ elseif ($fichinterid)
|
||||
}
|
||||
|
||||
// Duration
|
||||
print '<tr><td>'.$langs->trans("TotalDuration").'</td><td>'.ConvertSecondToTime($fichinter->duree,'all',$conf->global->MAIN_DURATION_OF_WORKDAY).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalDuration").'</td>';
|
||||
//print $fichinter->duree.'-'.$conf->global->MAIN_DURATION_OF_WORKDAY;
|
||||
print '<td>'.ConvertSecondToTime($fichinter->duree,'all',$conf->global->MAIN_DURATION_OF_WORKDAY).'</td>';
|
||||
//print '<td>'.ConvertSecondToTime(90000,'all',$conf->global->MAIN_DURATION_OF_WORKDAY).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Description (must be a textarea and not html must be allowed (used in list view)
|
||||
print '<tr><td>';
|
||||
|
||||
@ -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')
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user