summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorRafael de Camargo <rafaelcamargo@trt15.jus.br>2019-07-23 17:19:12 -0300
committerFrédéric Guillot <fred@kanboard.net>2019-07-23 15:41:13 -0700
commit7283bfaef6aeeb62aed2478e201f28d7361633fd (patch)
tree4f5767e63c3a6724ae7b0d0c79c7a4b3768a17b9 /app
parente488fdd154cd6c7f03d969a43c1a987c5345101b (diff)
Implements check for duplicate default categories
Diffstat (limited to 'app')
-rw-r--r--app/Model/CategoryModel.php14
1 files changed, 5 insertions, 9 deletions
diff --git a/app/Model/CategoryModel.php b/app/Model/CategoryModel.php
index 95e9e97e..441cc4a7 100644
--- a/app/Model/CategoryModel.php
+++ b/app/Model/CategoryModel.php
@@ -137,17 +137,13 @@ class CategoryModel extends Base
public function createDefaultCategories($project_id)
{
$results = array();
- $categories = explode(',', $this->configModel->get('project_categories'));
+ $categories = array_unique(explode_csv_field($this->configModel->get('project_categories')));
foreach ($categories as $category) {
- $category = trim($category);
-
- if (! empty($category)) {
- $results[] = $this->db->table(self::TABLE)->insert(array(
- 'project_id' => $project_id,
- 'name' => $category,
- ));
- }
+ $results[] = $this->db->table(self::TABLE)->insert(array(
+ 'project_id' => $project_id,
+ 'name' => $category,
+ ));
}
return in_array(false, $results, true);