Add new automatic action to update the start date
This commit is contained in:
@@ -8,6 +8,7 @@ use Model\Task;
|
||||
* Assign a color to a task
|
||||
*
|
||||
* @package action
|
||||
* @author Frederic Guillot
|
||||
*/
|
||||
class TaskAssignColorColumn extends Base
|
||||
{
|
||||
|
||||
83
app/Action/TaskUpdateStartDate.php
Normal file
83
app/Action/TaskUpdateStartDate.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace Action;
|
||||
|
||||
use Model\Task;
|
||||
|
||||
/**
|
||||
* Set the start date of task
|
||||
*
|
||||
* @package action
|
||||
* @author Frederic Guillot
|
||||
*/
|
||||
class TaskUpdateStartDate extends Base
|
||||
{
|
||||
/**
|
||||
* Get the list of compatible events
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getCompatibleEvents()
|
||||
{
|
||||
return array(
|
||||
Task::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',
|
||||
'column_id',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the action (set the task color)
|
||||
*
|
||||
* @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'],
|
||||
'date_started' => time(),
|
||||
);
|
||||
|
||||
return $this->taskModification->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['column_id'] == $this->getParam('column_id');
|
||||
}
|
||||
}
|
||||
@@ -916,4 +916,5 @@ return array(
|
||||
// 'Show tasks based on the start date' => '',
|
||||
// 'Subtasks time tracking' => '',
|
||||
// 'User calendar view' => '',
|
||||
// 'Automatically update the start date' => '',
|
||||
);
|
||||
|
||||
@@ -916,4 +916,5 @@ return array(
|
||||
// 'Show tasks based on the start date' => '',
|
||||
// 'Subtasks time tracking' => '',
|
||||
// 'User calendar view' => '',
|
||||
// 'Automatically update the start date' => '',
|
||||
);
|
||||
|
||||
@@ -916,4 +916,5 @@ return array(
|
||||
// 'Show tasks based on the start date' => '',
|
||||
// 'Subtasks time tracking' => '',
|
||||
// 'User calendar view' => '',
|
||||
// 'Automatically update the start date' => '',
|
||||
);
|
||||
|
||||
@@ -916,4 +916,5 @@ return array(
|
||||
// 'Show tasks based on the start date' => '',
|
||||
// 'Subtasks time tracking' => '',
|
||||
// 'User calendar view' => '',
|
||||
// 'Automatically update the start date' => '',
|
||||
);
|
||||
|
||||
@@ -918,4 +918,5 @@ return array(
|
||||
'Show tasks based on the start date' => 'Afficher les tâches en fonction de la date de début',
|
||||
'Subtasks time tracking' => 'Suivi du temps par rapport aux sous-tâches',
|
||||
'User calendar view' => 'Vue en mode utilisateur du calendrier',
|
||||
'Automatically update the start date' => 'Mettre à jour automatiquement la date de début',
|
||||
);
|
||||
|
||||
@@ -916,4 +916,5 @@ return array(
|
||||
// 'Show tasks based on the start date' => '',
|
||||
// 'Subtasks time tracking' => '',
|
||||
// 'User calendar view' => '',
|
||||
// 'Automatically update the start date' => '',
|
||||
);
|
||||
|
||||
@@ -916,4 +916,5 @@ return array(
|
||||
// 'Show tasks based on the start date' => '',
|
||||
// 'Subtasks time tracking' => '',
|
||||
// 'User calendar view' => '',
|
||||
// 'Automatically update the start date' => '',
|
||||
);
|
||||
|
||||
@@ -916,4 +916,5 @@ return array(
|
||||
// 'Show tasks based on the start date' => '',
|
||||
// 'Subtasks time tracking' => '',
|
||||
// 'User calendar view' => '',
|
||||
// 'Automatically update the start date' => '',
|
||||
);
|
||||
|
||||
@@ -916,4 +916,5 @@ return array(
|
||||
// 'Show tasks based on the start date' => '',
|
||||
// 'Subtasks time tracking' => '',
|
||||
// 'User calendar view' => '',
|
||||
// 'Automatically update the start date' => '',
|
||||
);
|
||||
|
||||
@@ -916,4 +916,5 @@ return array(
|
||||
// 'Show tasks based on the start date' => '',
|
||||
// 'Subtasks time tracking' => '',
|
||||
// 'User calendar view' => '',
|
||||
// 'Automatically update the start date' => '',
|
||||
);
|
||||
|
||||
@@ -916,4 +916,5 @@ return array(
|
||||
// 'Show tasks based on the start date' => '',
|
||||
// 'Subtasks time tracking' => '',
|
||||
// 'User calendar view' => '',
|
||||
// 'Automatically update the start date' => '',
|
||||
);
|
||||
|
||||
@@ -916,4 +916,5 @@ return array(
|
||||
// 'Show tasks based on the start date' => '',
|
||||
// 'Subtasks time tracking' => '',
|
||||
// 'User calendar view' => '',
|
||||
// 'Automatically update the start date' => '',
|
||||
);
|
||||
|
||||
@@ -916,4 +916,5 @@ return array(
|
||||
// 'Show tasks based on the start date' => '',
|
||||
// 'Subtasks time tracking' => '',
|
||||
// 'User calendar view' => '',
|
||||
// 'Automatically update the start date' => '',
|
||||
);
|
||||
|
||||
@@ -916,4 +916,5 @@ return array(
|
||||
// 'Show tasks based on the start date' => '',
|
||||
// 'Subtasks time tracking' => '',
|
||||
// 'User calendar view' => '',
|
||||
// 'Automatically update the start date' => '',
|
||||
);
|
||||
|
||||
@@ -916,4 +916,5 @@ return array(
|
||||
// 'Show tasks based on the start date' => '',
|
||||
// 'Subtasks time tracking' => '',
|
||||
// 'User calendar view' => '',
|
||||
// 'Automatically update the start date' => '',
|
||||
);
|
||||
|
||||
@@ -916,4 +916,5 @@ return array(
|
||||
// 'Show tasks based on the start date' => '',
|
||||
// 'Subtasks time tracking' => '',
|
||||
// 'User calendar view' => '',
|
||||
// 'Automatically update the start date' => '',
|
||||
);
|
||||
|
||||
@@ -916,4 +916,5 @@ return array(
|
||||
// 'Show tasks based on the start date' => '',
|
||||
// 'Subtasks time tracking' => '',
|
||||
// 'User calendar view' => '',
|
||||
// 'Automatically update the start date' => '',
|
||||
);
|
||||
|
||||
@@ -56,6 +56,7 @@ class Action extends Base
|
||||
'TaskLogMoveAnotherColumn' => t('Add a comment logging moving the task between columns'),
|
||||
'TaskAssignUser' => t('Change the assignee based on an external username'),
|
||||
'TaskAssignCategoryLabel' => t('Change the category based on an external label'),
|
||||
'TaskUpdateStartDate' => t('Automatically update the start date'),
|
||||
);
|
||||
|
||||
asort($values);
|
||||
|
||||
Reference in New Issue
Block a user