Fix: le total du temps des interventions tait fausse

This commit is contained in:
Regis Houssin 2008-11-03 19:24:41 +00:00
parent d67f74d47b
commit 31fb9c0fec
2 changed files with 15 additions and 3 deletions

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2008 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -115,10 +115,11 @@ if ($result)
print '<td align="right">'.$fichinter_static->LibStatut($objp->fk_statut,5).'</td>';
print "</tr>\n";
$total += $objp->duree;
$i++;
}
print '<tr class="liste_total"><td colspan="3"></td><td align="center">'.$langs->trans("Total").'</td>';
print '<tr class="liste_total"><td colspan="4"></td><td align="center">'.$langs->trans("Total").'</td>';
print '<td align="right" nowrap>'.ConvertSecondToTime($total).'</td><td></td>';
print '</tr>';

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2008 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -43,8 +44,18 @@ function ConvertTime2Seconds($iHours=0,$iMinutes=0,$iSeconds=0)
* \return sTime Temps formaté
*/
function ConvertSecondToTime($iSecond,$format='all'){
global $langs;
if ($format == 'all'){
$sTime=date("H",$iSecond)-1;
if ($iSecond > 86400)
{
$sDay=date("d",$iSecond)-1;
$dayTranslate = $langs->trans("Day");
if ($iSecond >= 172800) $dayTranslate = $langs->trans("Days");
}
$sTime='';
if ($sDay) $sTime.=$sDay.' '.$dayTranslate.' ';
$sTime.=date("H",$iSecond)-1;
$sTime.='h'.date("i",$iSecond);
}else if ($format == 'hour'){
$sTime=date("H",$iSecond)-1;