From 31fb9c0fecf1cd8478f78a4c11628c7eb43ff00c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 3 Nov 2008 19:24:41 +0000 Subject: [PATCH] =?UTF-8?q?Fix:=20le=20total=20du=20temps=20des=20interven?= =?UTF-8?q?tions=20=E9tait=20fauss=E9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/fichinter/index.php | 5 +++-- htdocs/lib/date.lib.php | 13 ++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/htdocs/fichinter/index.php b/htdocs/fichinter/index.php index 89f70a97f9a..2f8de5997fc 100644 --- a/htdocs/fichinter/index.php +++ b/htdocs/fichinter/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2008 Laurent Destailleur - * Copyright (C) 2005-2007 Regis Houssin + * Copyright (C) 2005-2008 Regis Houssin * * 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 ''.$fichinter_static->LibStatut($objp->fk_statut,5).''; print "\n"; + $total += $objp->duree; $i++; } - print ''.$langs->trans("Total").''; + print ''.$langs->trans("Total").''; print ''.ConvertSecondToTime($total).''; print ''; diff --git a/htdocs/lib/date.lib.php b/htdocs/lib/date.lib.php index 955f8174980..c22abc267af 100644 --- a/htdocs/lib/date.lib.php +++ b/htdocs/lib/date.lib.php @@ -1,5 +1,6 @@ + * Copyright (C) 2005-2008 Regis Houssin * * 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;