summaryrefslogtreecommitdiff
path: root/app/Model/TaskDuplicationModel.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-07-02 16:36:10 -0400
committerFrederic Guillot <fred@kanboard.net>2016-07-02 16:36:10 -0400
commit10d577ad9d1b2976cdb080a7d7df3944e0db170f (patch)
tree8346340a1855db3db6ec7d412e1d1a0cf6cdd17e /app/Model/TaskDuplicationModel.php
parent8e56148a6dda1f6b1a78a759e69e600b79bdddd2 (diff)
Handle priority for task and project duplication
Diffstat (limited to 'app/Model/TaskDuplicationModel.php')
-rw-r--r--app/Model/TaskDuplicationModel.php11
1 files changed, 9 insertions, 2 deletions
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];
}