diff options
author | David-Norris <Dave@Rachels-MacBook-Pro.local> | 2015-05-05 23:40:05 -0400 |
---|---|---|
committer | David-Norris <Dave@Rachels-MacBook-Pro.local> | 2015-05-05 23:40:05 -0400 |
commit | 58a0db28cccd6096a129620ddd0e631c1732fc9e (patch) | |
tree | 6bc246647586733783ca72d0b0bb114c9cca8f95 /app/Model | |
parent | a314bbb489eff2d419481ad001805ce13edb5352 (diff) |
2nd Recurring Tasks Commit
New Trigger (move from first column)
New method to get last column of a board
Locales updated
API changes (createTask, updateTask)
API Docs & Examples
Diffstat (limited to 'app/Model')
-rw-r--r-- | app/Model/Board.php | 12 | ||||
-rw-r--r-- | app/Model/Task.php | 8 | ||||
-rw-r--r-- | app/Model/TaskPosition.php | 13 |
3 files changed, 26 insertions, 7 deletions
diff --git a/app/Model/Board.php b/app/Model/Board.php index 3650418f..eecbc91c 100644 --- a/app/Model/Board.php +++ b/app/Model/Board.php @@ -315,6 +315,18 @@ class Board extends Base } /** + * Get the last column id for a given project + * + * @access public + * @param integer $project_id Project id + * @return integer + */ + public function getLastColumn($project_id) + { + return $this->db->table(self::TABLE)->eq('project_id', $project_id)->desc('position')->findOneColumn('id'); + } + + /** * Get the list of columns sorted by position [ column_id => title ] * * @access public diff --git a/app/Model/Task.php b/app/Model/Task.php index 1a58e981..02469047 100644 --- a/app/Model/Task.php +++ b/app/Model/Task.php @@ -55,8 +55,9 @@ class Task extends Base * * @var integer */ - const RECURE_TRIGGER_MOVE = 0; - const RECURE_TRIGGER_CLOSE = 1; + const RECURE_TRIGGER_FIRST = 0; + const RECURE_TRIGGER_LAST = 1; + const RECURE_TRIGGER_CLOSE = 2; /** * Recurrence: timeframe @@ -134,7 +135,8 @@ class Task extends Base public function getRecurrenceTriggerList() { return array ( - Task::RECURE_TRIGGER_MOVE => t('When task is moved to last column'), + Task::RECURE_TRIGGER_FIRST => t('When task is moved from first column'), + Task::RECURE_TRIGGER_LAST => t('When task is moved to last column'), Task::RECURE_TRIGGER_CLOSE => t('When task is closed'), ); } diff --git a/app/Model/TaskPosition.php b/app/Model/TaskPosition.php index 8589cac5..37c1ace0 100644 --- a/app/Model/TaskPosition.php +++ b/app/Model/TaskPosition.php @@ -40,10 +40,15 @@ class TaskPosition extends Base $this->fireEvents($original_task, $column_id, $position, $swimlane_id); } - if ($original_task['column_id'] != $column_id - && $column_id == $this->board->getLastColumnPosition($project_id) - && $original_task['recurrence_status'] == Task::RECURE_STATUS_PENDING - && $original_task['recurrence_trigger'] == Task::RECURE_TRIGGER_MOVE) + if ($original_task['recurrence_status'] == Task::RECURE_STATUS_PENDING + && $original_task['column_id'] != $column_id + && ( + ($original_task['column_id'] == $this->board->getFirstColumn($project_id) + && $original_task['recurrence_trigger'] == Task::RECURE_TRIGGER_FIRST) + || ($column_id == $this->board->getLastColumn($project_id) + && $original_task['recurrence_trigger'] == Task::RECURE_TRIGGER_LAST) + ) + ) { $this->taskDuplication->createRecurrence($task_id); } |