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 Yesterday=Yesterday
Tomorrow=Tomorrow Tomorrow=Tomorrow
Quadri=Quadri Quadri=Quadri
HourShort=H
Rate=Rate Rate=Rate
Bytes=Bytes Bytes=Bytes
Cut=Cut Cut=Cut

View File

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

View File

@@ -3104,20 +3104,27 @@ 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) \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 timestampStart Timestamp de d<>but
\param timestampEnd Timestamp de fin \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 \param lastday On prend en compte le dernier jour, 0: non, 1:oui
\return nbjours Nombre de jours ou d'heures \return nbjours Nombre de jours ou d'heures
*/ */
function num_open_day($timestampStart, $timestampEnd,$inhour=0,$lastday=0) function num_open_day($timestampStart, $timestampEnd,$inhour=0,$lastday=0)
{ {
global $langs;
if ($timestampStart < $timestampEnd) if ($timestampStart < $timestampEnd)
{ {
$bit = 0; $bit = 0;
if ($lastday == 1) $bit = 1; if ($lastday == 1) $bit = 1;
$nbOpenDay = num_between_day($timestampStart, $timestampEnd, $bit) - num_public_holiday($timestampStart, $timestampEnd); $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");
} }
return $nbOpenDay;
} }
/** /**