From c84d17eced5d2a922b89b85a30ba61f6b680dbcf Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Mon, 2 Jan 2023 16:58:33 +0100 Subject: [PATCH] FIX : filter only if t.task_duration checked --- htdocs/projet/tasks/time.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 8c98e6387b1..6652b57304a 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1629,16 +1629,20 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $sql .= " AND t.task_date <= '".$db->idate($search_date_end)."'"; } - if($search_timespent_starthour || $search_timespent_startmin) { - $timespent_duration_start = $search_timespent_starthour * 60 * 60; // We store duration in seconds - $timespent_duration_start += ($search_timespent_startmin ? $search_timespent_startmin : 0) * 60; // We store duration in seconds - $sql .= " AND t.task_duration >= ".$timespent_duration_start; - } + if (!empty($arrayfields['t.task_duration']['checked'])) { - if($search_timespent_endhour || $search_timespent_endmin) { - $timespent_duration_end = $search_timespent_endhour * 60 * 60; // We store duration in seconds - $timespent_duration_end += ($search_timespent_endmin ? $search_timespent_endmin : 0) * 60; // We store duration in seconds - $sql .= " AND t.task_duration <= ".$timespent_duration_end; + if ($search_timespent_starthour || $search_timespent_startmin) { + $timespent_duration_start = $search_timespent_starthour * 60 * 60; // We store duration in seconds + $timespent_duration_start += ($search_timespent_startmin ? $search_timespent_startmin : 0) * 60; // We store duration in seconds + $sql .= " AND t.task_duration >= " . $timespent_duration_start; + } + + if ($search_timespent_endhour || $search_timespent_endmin) { + $timespent_duration_end = $search_timespent_endhour * 60 * 60; // We store duration in seconds + $timespent_duration_end += ($search_timespent_endmin ? $search_timespent_endmin : 0) * 60; // We store duration in seconds + $sql .= " AND t.task_duration <= " . $timespent_duration_end; + } + } $sql .= dolSqlDateFilter('t.task_datehour', $search_day, $search_month, $search_year);