From e8ec7861af9205898d9ff2d5d7ca76a31224044b Mon Sep 17 00:00:00 2001 From: dalmond Date: Wed, 17 Aug 2016 12:29:53 +0100 Subject: New Automatic Actions: Colour by Swimlane and Priority by Swimlane --- app/Action/TaskAssignPrioritySwimlane.php | 99 +++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 app/Action/TaskAssignPrioritySwimlane.php (limited to 'app/Action/TaskAssignPrioritySwimlane.php') diff --git a/app/Action/TaskAssignPrioritySwimlane.php b/app/Action/TaskAssignPrioritySwimlane.php new file mode 100644 index 00000000..7eaca7c8 --- /dev/null +++ b/app/Action/TaskAssignPrioritySwimlane.php @@ -0,0 +1,99 @@ + t('Swimlane'), + 'priority' => t('Priority'), + ); + } + + /** + * Get the required parameter for the event + * + * @access public + * @return string[] + */ + public function getEventRequiredParameters() + { + return array( + 'task_id', + 'task' => array( + 'project_id', + 'swimlane_id', + ), + ); + } + + /** + * Execute the action (set the priority) + * + * @access public + * @param array $data Event data dictionary + * @return bool True if the action was executed or false when not executed + */ + public function doAction(array $data) + { + $values = array( + 'id' => $data['task_id'], + 'priority' => $this->getParam('priority'), + ); + + return $this->taskModificationModel->update($values); + } + + /** + * Check if the event data meet the action condition + * + * @access public + * @param array $data Event data dictionary + * @return bool + */ + public function hasRequiredCondition(array $data) + { + return $data['task']['swimlane_id'] == $this->getParam('swimlane_id'); + } +} -- cgit v1.2.3