From a299fea04d890f548095c2e55f5bcadc4a948816 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Mon, 17 Oct 2022 11:19:00 +0200 Subject: [PATCH 1/3] fix totaux --- view/timespent_list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/view/timespent_list.php b/view/timespent_list.php index 59d1c73..cd22379 100644 --- a/view/timespent_list.php +++ b/view/timespent_list.php @@ -492,7 +492,6 @@ $i = 0; $totalarray = array(); $totalarray['nbfield'] = 0; -$totalarray['type'][8]='duration'; while ($i < ($limit ? min($num, $limit) : $num)) { $obj = $db->fetch_object($resql); if (empty($obj)) { @@ -547,6 +546,7 @@ print $obj->{$key}; } elseif ($key == 'task_duration') { print convertSecondToTime($obj->task_duration, 'allhourmin'); + $totalarray['type'][$i]='duration'; } elseif ($key == 'thm') { $value = price2num($obj->thm * $obj->task_duration / 3600, 'MT', 1); print 'thm).'">'; @@ -566,7 +566,7 @@ if (!isset($totalarray['val'][$key])) { $totalarray['val'][$key] = 0; } - $totalarray['val'][$key] += convertSecondToTime($obj->{$key}, 'allhourmin'); + $totalarray['val'][$key] += $obj->{$key}; if ($key == 'thm') { $totalarray['val'][$key] += $value; } From fbc9cb242851c65f655ffdbad22baa40ab700bcb Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 18 Oct 2022 09:38:07 +0200 Subject: [PATCH 2/3] dont create timesheet line if no duration --- .../interface_99_modDolisirh_DolisirhTriggers.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/triggers/interface_99_modDolisirh_DolisirhTriggers.class.php b/core/triggers/interface_99_modDolisirh_DolisirhTriggers.class.php index a5b11ae..af956b9 100644 --- a/core/triggers/interface_99_modDolisirh_DolisirhTriggers.class.php +++ b/core/triggers/interface_99_modDolisirh_DolisirhTriggers.class.php @@ -98,7 +98,7 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf $result = $ticket->fetch($object->fk_element); dol_syslog(var_export($ticket, true), LOG_DEBUG); if ($result > 0 && ($ticket->id) > 0) { - if (is_array($ticket->array_options) && array_key_exists('options_fk_task', $ticket->array_options) && $ticket->array_options['options_fk_task']>0) { + if (is_array($ticket->array_options) && array_key_exists('options_fk_task', $ticket->array_options) && $ticket->array_options['options_fk_task']>0 && !empty(GETPOST('timespent', 'int'))) { require_once DOL_DOCUMENT_ROOT .'/projet/class/task.class.php'; $task = new Task($this->db); $result = $task->fetch($ticket->array_options['options_fk_task']); From 8c92b030a937f105aa41e03db1ec87a74c9e6b4e Mon Sep 17 00:00:00 2001 From: Tof Date: Mon, 20 Feb 2023 09:26:22 +0100 Subject: [PATCH 3/3] add custonly checkbox --- view/timespent_list.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/view/timespent_list.php b/view/timespent_list.php index e3cd942..efc14bb 100644 --- a/view/timespent_list.php +++ b/view/timespent_list.php @@ -256,6 +256,8 @@ } $sql .= ' AND ptt.task_duration IS NOT NULL'; +if (GETPOST('custonly')) $sql .= ' AND s.rowid IS NOT NULL'; + foreach ($search as $key => $val) { if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') { if (preg_match('/_dtstart$/', $key)) { @@ -401,6 +403,8 @@ $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PROJECT, $search_category_array); } +$moreforfilter .= 'Client seulement : '; + if (!empty($moreforfilter)) { print '
'; print $moreforfilter;