diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-07-05 16:32:24 -0300 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-07-05 16:32:24 -0300 |
commit | 035294798d891d1d2447a79586401b097d0c2ae4 (patch) | |
tree | ff5198d42ca7e66892e0f523b1b5c4977d9bb98b /app/Model | |
parent | 23341b2326b560ddf71c90915bc55f49bed81446 (diff) |
Add Postgresql support
Diffstat (limited to 'app/Model')
-rw-r--r-- | app/Model/Board.php | 5 | ||||
-rw-r--r-- | app/Model/Config.php | 5 | ||||
-rw-r--r-- | app/Model/Task.php | 14 | ||||
-rw-r--r-- | app/Model/User.php | 16 |
4 files changed, 39 insertions, 1 deletions
diff --git a/app/Model/Board.php b/app/Model/Board.php index 56094964..a4e0a345 100644 --- a/app/Model/Board.php +++ b/app/Model/Board.php @@ -99,6 +99,11 @@ class Board extends Base foreach (array('title', 'task_limit') as $field) { foreach ($values[$field] as $column_id => $field_value) { + + if ($field === 'task_limit' && empty($field_value)) { + $field_value = 0; + } + $this->updateColumn($column_id, array($field => $field_value)); } } diff --git a/app/Model/Config.php b/app/Model/Config.php index 2f7c660b..178093c4 100644 --- a/app/Model/Config.php +++ b/app/Model/Config.php @@ -174,7 +174,10 @@ class Config extends Base */ public function regenerateTokens() { - $this->db->table(self::TABLE)->update(array('webhooks_token' => Security::generateToken())); + $this->db->table(self::TABLE)->update(array( + 'webhooks_token' => Security::generateToken(), + 'api_token' => Security::generateToken(), + )); $projects = $this->db->table(Project::TABLE)->findAllByColumn('id'); diff --git a/app/Model/Task.php b/app/Model/Task.php index 09e2f4e4..469927b7 100644 --- a/app/Model/Task.php +++ b/app/Model/Task.php @@ -327,6 +327,13 @@ class Task extends Base if (! empty($values['date_due']) && ! is_numeric($values['date_due'])) { $values['date_due'] = $this->parseDate($values['date_due']); } + else { + $values['date_due'] = 0; + } + + if (empty($values['score'])) { + $values['score'] = 0; + } $values['date_creation'] = time(); $values['position'] = $this->countByColumnId($values['project_id'], $values['column_id']); @@ -361,6 +368,13 @@ class Task extends Base if (! empty($values['date_due']) && ! is_numeric($values['date_due'])) { $values['date_due'] = $this->parseDate($values['date_due']); } + else { + $values['date_due'] = 0; + } + + if (empty($values['score'])) { + $values['score'] = 0; + } $original_task = $this->getById($values['id']); diff --git a/app/Model/User.php b/app/Model/User.php index ba1acb90..b5744c44 100644 --- a/app/Model/User.php +++ b/app/Model/User.php @@ -118,6 +118,14 @@ class User extends Base $values['password'] = \password_hash($values['password'], PASSWORD_BCRYPT); } + if (empty($values['is_admin'])) { + $values['is_admin'] = 0; + } + + if (empty($values['is_ldap_user'])) { + $values['is_ldap_user'] = 0; + } + return $this->db->table(self::TABLE)->save($values); } @@ -145,6 +153,14 @@ class User extends Base unset($values['current_password']); } + if (empty($values['is_admin'])) { + $values['is_admin'] = 0; + } + + if (empty($values['is_ldap_user'])) { + $values['is_ldap_user'] = 0; + } + $result = $this->db->table(self::TABLE)->eq('id', $values['id'])->update($values); if (session_id() !== '' && $_SESSION['user']['id'] == $values['id']) { |