summaryrefslogtreecommitdiff
path: root/app/Model
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-12-01 21:51:44 -0500
committerFrédéric Guillot <fred@kanboard.net>2014-12-01 21:51:44 -0500
commit8a02ceb40e88c27777a95251083bc21629d62bb0 (patch)
tree916c07d2d425622e9eec795e1873357c8d9430c7 /app/Model
parent50a9e2ba7db6a155cee75771d73c584d721cf687 (diff)
Fix bug category duplication
Diffstat (limited to 'app/Model')
-rw-r--r--app/Model/Category.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/app/Model/Category.php b/app/Model/Category.php
index 65fd0c56..54a0f552 100644
--- a/app/Model/Category.php
+++ b/app/Model/Category.php
@@ -165,26 +165,26 @@ class Category extends Base
}
/**
- * Duplicate categories from a project to another one
+ * Duplicate categories from a project to another one, must be executed inside a transaction
*
* @author Antonio Rabelo
- * @param integer $project_from Project Template
- * @return integer $project_to Project that receives the copy
+ * @param integer $src_project_id Source project id
+ * @return integer $dst_project_id Destination project id
* @return boolean
*/
- public function duplicate($project_from, $project_to)
+ public function duplicate($src_project_id, $dst_project_id)
{
$categories = $this->db->table(self::TABLE)
->columns('name')
- ->eq('project_id', $project_from)
+ ->eq('project_id', $src_project_id)
->asc('name')
->findAll();
foreach ($categories as $category) {
- $category['project_id'] = $project_to;
+ $category['project_id'] = $dst_project_id;
- if (! $this->category->create($category)) {
+ if (! $this->db->table(self::TABLE)->save($category)) {
return false;
}
}