Merge pull request #19466 from st31ny/sumup_holidays

NEW: Show sum of holidays in holiday list
This commit is contained in:
Laurent Destailleur 2021-11-30 11:44:32 +01:00 committed by GitHub
commit e65ab75ddf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -736,6 +736,7 @@ if ($resql) {
$i = 0;
$totalarray = array();
$totalarray['nbfield'] = 0;
$totalduration = 0;
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql);
@ -805,6 +806,7 @@ if ($resql) {
if (!empty($arrayfields['duration']['checked'])) {
print '<td class="right">';
$nbopenedday = num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday); // user jdate(..., 1) because num_open_day need UTC dates
$totalduration += $nbopenedday;
print $nbopenedday.' '.$langs->trans('DurationDays');
print '</td>';
if (!$i) {
@ -887,6 +889,20 @@ if ($resql) {
$i++;
}
if (!empty($arrayfields['duration']['checked'])) {
print '<tr class="liste_titre">';
foreach ($arrayfields as $key => $val) {
if (!empty($val['checked'])) {
if ($key == 'duration') {
print '<td class="right">'.$totalduration.' '.$langs->trans('DurationDays').'</td>';
} else {
print '<td/>';
}
}
}
print '</tr>';
}
}
// Si il n'y a pas d'enregistrement suite à une recherche