From b24b1e7e4e5ee0551ee56aa0f21c4425b479db2e Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Wed, 4 Feb 2015 22:19:32 -0500 Subject: Add subtasks restrictions and time tracking --- app/Subscriber/SubtaskTimesheetSubscriber.php | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 app/Subscriber/SubtaskTimesheetSubscriber.php (limited to 'app/Subscriber') diff --git a/app/Subscriber/SubtaskTimesheetSubscriber.php b/app/Subscriber/SubtaskTimesheetSubscriber.php new file mode 100644 index 00000000..687db80a --- /dev/null +++ b/app/Subscriber/SubtaskTimesheetSubscriber.php @@ -0,0 +1,32 @@ + array('log', 0), + ); + } + + public function log(SubtaskEvent $event) + { + if (isset($event['status'])) { + + $subtask = $this->subTask->getById($event['id']); + + if ($subtask['status'] == SubTask::STATUS_INPROGRESS) { + $this->subtaskTimeTracking->logStartTime($subtask['id'], $subtask['user_id']); + } + else { + $this->subtaskTimeTracking->logEndTime($subtask['id'], $subtask['user_id']); + } + } + } +} -- cgit v1.2.3