Fix: on affiche le dlai en heure jusqu'a 72h ensuite on l'affiche en jour, on affiche une erreur si la date de fin est plus petite que la date de dbut

This commit is contained in:
Regis Houssin
2007-12-27 10:58:21 +00:00
parent e55c5d323f
commit f79f98d68b
3 changed files with 12 additions and 3 deletions

View File

@@ -188,6 +188,7 @@ Today=Today
Yesterday=Yesterday
Tomorrow=Tomorrow
Quadri=Quadri
HourShort=H
Rate=Rate
Bytes=Bytes
Cut=Cut

View File

@@ -189,6 +189,7 @@ Today=Aujourd'hui
Yesterday=Hier
Tomorrow=Demain
Quadri=Trimestre
HourShort=H
Rate=Taux
Bytes=Octets
Cut=Couper

View File

@@ -3104,21 +3104,28 @@ function num_between_day($timestampStart, $timestampEnd, $lastday=0)
\brief Fonction retournant le nombre de jour entre deux dates sans les jours f<>ri<72>s (jours ouvr<76>s)
\param timestampStart Timestamp de d<>but
\param timestampEnd Timestamp de fin
\param inhour 0: sort le nombre de jour , 1: sort le nombre d'heure
\param inhour 0: sort le nombre de jour , 1: sort le nombre d'heure (72 max)
\param lastday On prend en compte le dernier jour, 0: non, 1:oui
\return nbjours Nombre de jours ou d'heures
*/
function num_open_day($timestampStart, $timestampEnd,$inhour=0,$lastday=0)
{
global $langs;
if ($timestampStart < $timestampEnd)
{
$bit = 0;
if ($lastday == 1) $bit = 1;
$nbOpenDay = num_between_day($timestampStart, $timestampEnd, $bit) - num_public_holiday($timestampStart, $timestampEnd);
if ($inhour == 1) $nbOpenDay = $nbOpenDay*24;
}
$nbOpenDay.= " ".$langs->trans("Days");
if ($inhour == 1 && $nbOpenDay <= 3) $nbOpenDay = $nbOpenDay*24 . $langs->trans("HourShort");
return $nbOpenDay;
}
else
{
return $langs->trans("Error");
}
}
/**
\brief Fonction retournant le nombre de lignes dans un texte format<61>