From 6efac784fcc1a2e83bb7b43fc7841448b5975cba Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Wed, 24 Jun 2015 20:39:06 -0400 Subject: Add timer for subtasks and remove settings for subtask time tracking --- app/Subscriber/SubtaskTimeTrackingSubscriber.php | 47 ++++++++++++++++++++++++ app/Subscriber/SubtaskTimesheetSubscriber.php | 47 ------------------------ 2 files changed, 47 insertions(+), 47 deletions(-) create mode 100644 app/Subscriber/SubtaskTimeTrackingSubscriber.php delete mode 100644 app/Subscriber/SubtaskTimesheetSubscriber.php (limited to 'app/Subscriber') diff --git a/app/Subscriber/SubtaskTimeTrackingSubscriber.php b/app/Subscriber/SubtaskTimeTrackingSubscriber.php new file mode 100644 index 00000000..02f14c40 --- /dev/null +++ b/app/Subscriber/SubtaskTimeTrackingSubscriber.php @@ -0,0 +1,47 @@ + array('updateTaskTime', 0), + Subtask::EVENT_UPDATE => array( + array('logStartEnd', 10), + array('updateTaskTime', 0), + ) + ); + } + + public function updateTaskTime(SubtaskEvent $event) + { + if (isset($event['task_id'])) { + $this->subtaskTimeTracking->updateTaskTimeTracking($event['task_id']); + } + } + + public function logStartEnd(SubtaskEvent $event) + { + if (isset($event['status'])) { + + $subtask = $this->subtask->getById($event['id']); + + if (empty($subtask['user_id'])) { + return false; + } + + if ($subtask['status'] == Subtask::STATUS_INPROGRESS) { + return $this->subtaskTimeTracking->logStartTime($subtask['id'], $subtask['user_id']); + } + else { + return $this->subtaskTimeTracking->logEndTime($subtask['id'], $subtask['user_id']); + } + } + } +} diff --git a/app/Subscriber/SubtaskTimesheetSubscriber.php b/app/Subscriber/SubtaskTimesheetSubscriber.php deleted file mode 100644 index fdaf442f..00000000 --- a/app/Subscriber/SubtaskTimesheetSubscriber.php +++ /dev/null @@ -1,47 +0,0 @@ - array('updateTaskTime', 0), - Subtask::EVENT_UPDATE => array( - array('logStartEnd', 10), - array('updateTaskTime', 0), - ) - ); - } - - public function updateTaskTime(SubtaskEvent $event) - { - if (isset($event['task_id'])) { - $this->subtaskTimeTracking->updateTaskTimeTracking($event['task_id']); - } - } - - public function logStartEnd(SubtaskEvent $event) - { - if ($this->config->get('subtask_time_tracking') == 1 && isset($event['status'])) { - - $subtask = $this->subtask->getById($event['id']); - - if (empty($subtask['user_id'])) { - return false; - } - - if ($subtask['status'] == Subtask::STATUS_INPROGRESS) { - return $this->subtaskTimeTracking->logStartTime($subtask['id'], $subtask['user_id']); - } - else { - return $this->subtaskTimeTracking->logEndTime($subtask['id'], $subtask['user_id']); - } - } - } -} -- cgit v1.2.3