From 10d577ad9d1b2976cdb080a7d7df3944e0db170f Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 2 Jul 2016 16:36:10 -0400 Subject: Handle priority for task and project duplication --- app/Model/TaskDuplicationModel.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'app/Model/TaskDuplicationModel.php') diff --git a/app/Model/TaskDuplicationModel.php b/app/Model/TaskDuplicationModel.php index 0dce891f..c9079653 100644 --- a/app/Model/TaskDuplicationModel.php +++ b/app/Model/TaskDuplicationModel.php @@ -18,7 +18,7 @@ class TaskDuplicationModel extends Base * @access protected * @var string[] */ - protected $fields_to_duplicate = array( + protected $fieldsToDuplicate = array( 'title', 'description', 'date_due', @@ -27,6 +27,7 @@ class TaskDuplicationModel extends Base 'column_id', 'owner_id', 'score', + 'priority', 'category_id', 'time_estimated', 'swimlane_id', @@ -95,6 +96,12 @@ class TaskDuplicationModel extends Base $values['column_id'] = $values['column_id'] ?: $this->columnModel->getFirstColumnId($values['project_id']); } + // Check if priority exists for destination project + $values['priority'] = $this->projectTaskPriorityModel->getPriorityForProject( + $values['project_id'], + empty($values['priority']) ? 0 : $values['priority'] + ); + return $values; } @@ -110,7 +117,7 @@ class TaskDuplicationModel extends Base $task = $this->taskFinderModel->getById($task_id); $values = array(); - foreach ($this->fields_to_duplicate as $field) { + foreach ($this->fieldsToDuplicate as $field) { $values[$field] = $task[$field]; } -- cgit v1.2.3