summaryrefslogtreecommitdiff
path: root/app/Model/Category.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Model/Category.php')
-rw-r--r--app/Model/Category.php15
1 files changed, 9 insertions, 6 deletions
diff --git a/app/Model/Category.php b/app/Model/Category.php
index 883fc282..6368f507 100644
--- a/app/Model/Category.php
+++ b/app/Model/Category.php
@@ -22,12 +22,11 @@ class Category extends Base
*
* @access public
* @param integer $category_id Category id
- * @param integer $project_id Project id
* @return boolean
*/
- public function exists($category_id, $project_id)
+ public function exists($category_id)
{
- return $this->db->table(self::TABLE)->eq('id', $category_id)->eq('project_id', $project_id)->exists();
+ return $this->db->table(self::TABLE)->eq('id', $category_id)->exists();
}
/**
@@ -115,25 +114,29 @@ class Category extends Base
}
/**
- * Create default cetegories during project creation (transaction already started in Project::create())
+ * Create default categories during project creation (transaction already started in Project::create())
*
* @access public
* @param integer $project_id
+ * @return boolean
*/
public function createDefaultCategories($project_id)
{
+ $results = array();
$categories = explode(',', $this->config->get('project_categories'));
foreach ($categories as $category) {
$category = trim($category);
if (! empty($category)) {
- $this->db->table(self::TABLE)->insert(array(
+ $results[] = $this->db->table(self::TABLE)->insert(array(
'project_id' => $project_id,
'name' => $category,
));
}
}
+
+ return in_array(false, $results, true);
}
/**
@@ -195,7 +198,7 @@ class Category extends Base
{
$categories = $this->db
->table(self::TABLE)
- ->columns('name')
+ ->columns('name', 'description')
->eq('project_id', $src_project_id)
->asc('name')
->findAll();