FIX count of open day when date and start are not open should be 0
This commit is contained in:
parent
d6887f3ca4
commit
0cd05887ce
@ -896,15 +896,23 @@ function num_open_day($timestampStart, $timestampEnd, $inhour = 0, $lastday = 0,
|
||||
if ($timestampStart < $timestampEnd)
|
||||
{
|
||||
$numdays = num_between_day($timestampStart, $timestampEnd, $lastday);
|
||||
|
||||
$numholidays = num_public_holiday($timestampStart, $timestampEnd, $country_code, $lastday);
|
||||
$nbOpenDay = $numdays - $numholidays;
|
||||
$nbOpenDay.= " " . $langs->trans("Days");
|
||||
$nbOpenDay.= ' '.$langs->trans("Days");
|
||||
if ($inhour == 1 && $nbOpenDay <= 3) $nbOpenDay = $nbOpenDay*24 . $langs->trans("HourShort");
|
||||
return $nbOpenDay - (($inhour == 1 ? 12 : 0.5) * abs($halfday));
|
||||
}
|
||||
elseif ($timestampStart == $timestampEnd)
|
||||
{
|
||||
$numholidays = 0;
|
||||
if ($lastday) {
|
||||
$numholidays = num_public_holiday($timestampStart, $timestampEnd, $country_code, $lastday);
|
||||
if ($numholidays == 1) return 0;
|
||||
}
|
||||
|
||||
$nbOpenDay=$lastday;
|
||||
|
||||
if ($inhour == 1) $nbOpenDay = $nbOpenDay*24 . $langs->trans("HourShort");
|
||||
return $nbOpenDay - (($inhour == 1 ? 12 : 0.5) * abs($halfday));
|
||||
}
|
||||
|
||||
@ -1291,7 +1291,9 @@ else
|
||||
if ($includesunday) $htmlhelp.='<br>'.$langs->trans("DayIsANonWorkingDay", $langs->trans("Sunday"));
|
||||
print $form->textwithpicto($langs->trans('NbUseDaysCP'), $htmlhelp);
|
||||
print '</td>';
|
||||
print '<td>'.num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday).'</td>';
|
||||
print '<td>';
|
||||
print num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
if ($object->statut == Holiday::STATUS_REFUSED)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user