From c33205d564061f72d93fce964517d86b07fdcb9a Mon Sep 17 00:00:00 2001 From: Maximilian Stein Date: Tue, 16 Nov 2021 19:09:14 +0100 Subject: [PATCH 1/2] NEW: Show sum of holidays in holiday list Show a footer in the holidays list with the sum of all holidays currently visible. --- htdocs/holiday/list.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 953f5eabb2f..c49d1f4b600 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -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 ''; $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 ''; if (!$i) { @@ -887,6 +889,20 @@ if ($resql) { $i++; } + + if (!empty($arrayfields['duration']['checked'])) { + print ''; + foreach ($arrayfields as $key => $val) { + if (!empty($val['checked'])) { + if($key == 'duration') { + print ''.$totalduration.' '.$langs->trans('DurationDays').''; + } else { + print ''; + } + } + } + print ''; + } } // Si il n'y a pas d'enregistrement suite à une recherche From b212778da0f72f370f0170a9f4d1d47eacdca67f Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 24 Nov 2021 17:09:11 +0000 Subject: [PATCH 2/2] Fixing style errors. --- htdocs/holiday/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index c49d1f4b600..0ecdcb2dd69 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -894,7 +894,7 @@ if ($resql) { print ''; foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) { - if($key == 'duration') { + if ($key == 'duration') { print ''.$totalduration.' '.$langs->trans('DurationDays').''; } else { print '';