summaryrefslogtreecommitdiff
path: root/app/Action
diff options
context:
space:
mode:
Diffstat (limited to 'app/Action')
-rw-r--r--app/Action/TaskAssignColorOnDueDate.php2
-rw-r--r--app/Action/TaskAssignCreator.php98
2 files changed, 99 insertions, 1 deletions
diff --git a/app/Action/TaskAssignColorOnDueDate.php b/app/Action/TaskAssignColorOnDueDate.php
index 06b70a18..791f0cff 100644
--- a/app/Action/TaskAssignColorOnDueDate.php
+++ b/app/Action/TaskAssignColorOnDueDate.php
@@ -74,7 +74,7 @@ class TaskAssignColorOnDueDate extends Base
$results = array();
foreach ($data['tasks'] as $task) {
- if ($task['date_due'] <= time() && $task['date_due'] > 0) {
+ if ($task['date_due'] <= time() && $task['date_due'] > 0 && $task['color_id'] != $this->getParam('color_id')) {
$values = array(
'id' => $task['id'],
'color_id' => $this->getParam('color_id'),
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 @@
+<?php
+
+namespace Kanboard\Action;
+
+use Kanboard\Model\TaskModel;
+
+/**
+ * Assign a task to the creator
+ *
+ * @package Kanboard\Action
+ * @author Frederic Guillot
+ */
+class TaskAssignCreator extends Base
+{
+ /**
+ * Get automatic action description
+ *
+ * @access public
+ * @return string
+ */
+ public function getDescription()
+ {
+ return t('Assign the task to its creator');
+ }
+
+ /**
+ * Get the list of compatible events
+ *
+ * @access public
+ * @return array
+ */
+ public function getCompatibleEvents()
+ {
+ return array(
+ TaskModel::EVENT_MOVE_COLUMN,
+ );
+ }
+
+ /**
+ * Get the required parameter for the action (defined by the user)
+ *
+ * @access public
+ * @return array
+ */
+ public function getActionRequiredParameters()
+ {
+ return array(
+ 'column_id' => 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');
+ }
+}