From 43e4662b842248952aa53ebb69e8e833682a055c Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 3 Jun 2017 11:32:24 -0400 Subject: Add new automatic action to assign tasks to its creator --- app/Action/TaskAssignCreator.php | 98 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 app/Action/TaskAssignCreator.php (limited to 'app/Action') diff --git a/app/Action/TaskAssignCreator.php b/app/Action/TaskAssignCreator.php new file mode 100644 index 00000000..ce10b35f --- /dev/null +++ b/app/Action/TaskAssignCreator.php @@ -0,0 +1,98 @@ + t('Column'), + ); + } + + /** + * Get the required parameter for the event + * + * @access public + * @return string[] + */ + public function getEventRequiredParameters() + { + return array( + 'task_id', + 'task' => array( + 'project_id', + 'column_id', + 'creator_id', + ), + ); + } + + /** + * Execute the action + * + * @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'], + 'owner_id' => $data['task']['creator_id'], + ); + + 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']['column_id'] == $this->getParam('column_id'); + } +} -- cgit v1.2.3