From 8a02ceb40e88c27777a95251083bc21629d62bb0 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Mon, 1 Dec 2014 21:51:44 -0500 Subject: Fix bug category duplication --- app/Model/Category.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'app/Model') 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; } } -- cgit v1.2.3