summaryrefslogtreecommitdiff
path: root/app/Model/ProjectModel.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-02-18 09:42:01 -0500
committerFrederic Guillot <fred@kanboard.net>2017-02-18 09:42:01 -0500
commitde128dbad860478496a0d655b5eb5c1005ebbabe (patch)
tree7fee510e901273472731e8e843981268c593ec40 /app/Model/ProjectModel.php
parent0430a09c069134622c0161dc2fb9ba3718a73c0d (diff)
Remove default swimlane
Diffstat (limited to 'app/Model/ProjectModel.php')
-rw-r--r--app/Model/ProjectModel.php21
1 files changed, 13 insertions, 8 deletions
diff --git a/app/Model/ProjectModel.php b/app/Model/ProjectModel.php
index 7f9cfb9b..a4d75a0b 100644
--- a/app/Model/ProjectModel.php
+++ b/app/Model/ProjectModel.php
@@ -321,19 +321,19 @@ class ProjectModel extends Base
* Create a project
*
* @access public
- * @param array $values Form values
- * @param integer $user_id User who create the project
- * @param bool $add_user Automatically add the user
- * @return integer Project id
+ * @param array $values Form values
+ * @param integer $userId User who create the project
+ * @param bool $addUser Automatically add the user
+ * @return int Project id
*/
- public function create(array $values, $user_id = 0, $add_user = false)
+ public function create(array $values, $userId = 0, $addUser = false)
{
$this->db->startTransaction();
$values['token'] = '';
$values['last_modified'] = time();
$values['is_private'] = empty($values['is_private']) ? 0 : 1;
- $values['owner_id'] = $user_id;
+ $values['owner_id'] = $userId;
if (! empty($values['identifier'])) {
$values['identifier'] = strtoupper($values['identifier']);
@@ -353,8 +353,13 @@ class ProjectModel extends Base
return false;
}
- if ($add_user && $user_id) {
- $this->projectUserRoleModel->addUser($project_id, $user_id, Role::PROJECT_MANAGER);
+ if (! $this->swimlaneModel->create($project_id, t('Default swimlane'))) {
+ $this->db->cancelTransaction();
+ return false;
+ }
+
+ if ($addUser && $userId) {
+ $this->projectUserRoleModel->addUser($project_id, $userId, Role::PROJECT_MANAGER);
}
$this->categoryModel->createDefaultCategories($project_id);