From 2e6a8d435f4fa73882224b465716360ee2e7c693 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Fri, 12 Sep 2014 17:35:48 +0200 Subject: Add settings field to control project columns (pull-request #244) --- app/Model/Project.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'app/Model/Project.php') diff --git a/app/Model/Project.php b/app/Model/Project.php index 6e75838c..0ba18498 100644 --- a/app/Model/Project.php +++ b/app/Model/Project.php @@ -496,14 +496,19 @@ class Project extends Base } $project_id = $this->db->getConnection()->getLastId(); + $column_names = explode(',', $this->config->get('default_columns', implode(',', $this->board->getDefaultColumns()))); + $columns = array(); - $this->board->create($project_id, array( - array('title' => t('Backlog'), 'task_limit' => 0), - array('title' => t('Ready'), 'task_limit' => 0), - array('title' => t('Work in progress'), 'task_limit' => 0), - array('title' => t('Done'), 'task_limit' => 0), - )); + foreach ($column_names as $column_name) { + + $column_name = trim($column_name); + + if (! empty($column_name)) { + $columns[] = array('title' => $column_name, 'task_limit' => 0); + } + } + $this->board->create($project_id, $columns); $this->db->closeTransaction(); return (int) $project_id; -- cgit v1.2.3