Add new automatic action to update the start date

This commit is contained in:
Frederic Guillot
2015-05-16 21:47:16 -04:00
parent 4a1dc8071f
commit 4d6e5d2e2c
22 changed files with 162 additions and 7 deletions

View File

@@ -8,6 +8,7 @@ use Model\Task;
* Assign a color to a task
*
* @package action
* @author Frederic Guillot
*/
class TaskAssignColorColumn extends Base
{

View 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');
}
}

View File

@@ -916,4 +916,5 @@ return array(
// 'Show tasks based on the start date' => '',
// 'Subtasks time tracking' => '',
// 'User calendar view' => '',
// 'Automatically update the start date' => '',
);

View File

@@ -916,4 +916,5 @@ return array(
// 'Show tasks based on the start date' => '',
// 'Subtasks time tracking' => '',
// 'User calendar view' => '',
// 'Automatically update the start date' => '',
);

View File

@@ -916,4 +916,5 @@ return array(
// 'Show tasks based on the start date' => '',
// 'Subtasks time tracking' => '',
// 'User calendar view' => '',
// 'Automatically update the start date' => '',
);

View File

@@ -916,4 +916,5 @@ return array(
// 'Show tasks based on the start date' => '',
// 'Subtasks time tracking' => '',
// 'User calendar view' => '',
// 'Automatically update the start date' => '',
);

View File

@@ -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',
);

View File

@@ -916,4 +916,5 @@ return array(
// 'Show tasks based on the start date' => '',
// 'Subtasks time tracking' => '',
// 'User calendar view' => '',
// 'Automatically update the start date' => '',
);

View File

@@ -916,4 +916,5 @@ return array(
// 'Show tasks based on the start date' => '',
// 'Subtasks time tracking' => '',
// 'User calendar view' => '',
// 'Automatically update the start date' => '',
);

View File

@@ -916,4 +916,5 @@ return array(
// 'Show tasks based on the start date' => '',
// 'Subtasks time tracking' => '',
// 'User calendar view' => '',
// 'Automatically update the start date' => '',
);

View File

@@ -916,4 +916,5 @@ return array(
// 'Show tasks based on the start date' => '',
// 'Subtasks time tracking' => '',
// 'User calendar view' => '',
// 'Automatically update the start date' => '',
);

View File

@@ -916,4 +916,5 @@ return array(
// 'Show tasks based on the start date' => '',
// 'Subtasks time tracking' => '',
// 'User calendar view' => '',
// 'Automatically update the start date' => '',
);

View File

@@ -916,4 +916,5 @@ return array(
// 'Show tasks based on the start date' => '',
// 'Subtasks time tracking' => '',
// 'User calendar view' => '',
// 'Automatically update the start date' => '',
);

View File

@@ -916,4 +916,5 @@ return array(
// 'Show tasks based on the start date' => '',
// 'Subtasks time tracking' => '',
// 'User calendar view' => '',
// 'Automatically update the start date' => '',
);

View File

@@ -916,4 +916,5 @@ return array(
// 'Show tasks based on the start date' => '',
// 'Subtasks time tracking' => '',
// 'User calendar view' => '',
// 'Automatically update the start date' => '',
);

View File

@@ -916,4 +916,5 @@ return array(
// 'Show tasks based on the start date' => '',
// 'Subtasks time tracking' => '',
// 'User calendar view' => '',
// 'Automatically update the start date' => '',
);

View File

@@ -916,4 +916,5 @@ return array(
// 'Show tasks based on the start date' => '',
// 'Subtasks time tracking' => '',
// 'User calendar view' => '',
// 'Automatically update the start date' => '',
);

View File

@@ -916,4 +916,5 @@ return array(
// 'Show tasks based on the start date' => '',
// 'Subtasks time tracking' => '',
// 'User calendar view' => '',
// 'Automatically update the start date' => '',
);

View File

@@ -916,4 +916,5 @@ return array(
// 'Show tasks based on the start date' => '',
// 'Subtasks time tracking' => '',
// 'User calendar view' => '',
// 'Automatically update the start date' => '',
);

View File

@@ -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);