diff options
| author | Teamjungla{CODE} <junglacode@gmail.com> | 2016-08-20 13:47:12 -0500 |
|---|---|---|
| committer | Teamjungla{CODE} <junglacode@gmail.com> | 2016-08-20 13:47:12 -0500 |
| commit | fe8e9cdcfe3afc1475c7e7f4392d2b2cc601a12b (patch) | |
| tree | 001403874e9e3716de7c6d51a9f536e9b3c3be5e /app/Model/SwimlaneModel.php | |
| parent | b1e795fc5b45369f7b9b565b1e106d2673361977 (diff) | |
| parent | 98efcf21e355ed6ac3827058b99df86ca67c75bb (diff) | |
Merge branch 'stable' of https://github.com/kanboard/kanboard
Diffstat (limited to 'app/Model/SwimlaneModel.php')
| -rw-r--r-- | app/Model/SwimlaneModel.php | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/app/Model/SwimlaneModel.php b/app/Model/SwimlaneModel.php index 35e39879..f20bfa2f 100644 --- a/app/Model/SwimlaneModel.php +++ b/app/Model/SwimlaneModel.php @@ -94,15 +94,17 @@ class SwimlaneModel extends Base * * @access public * @param integer $project_id - * @return array + * @return array|null */ public function getFirstActiveSwimlane($project_id) { - return $this->db->table(self::TABLE) - ->eq('is_active', self::ACTIVE) - ->eq('project_id', $project_id) - ->orderBy('position', 'asc') - ->findOne(); + $swimlanes = $this->getSwimlanes($project_id); + + if (empty($swimlanes)) { + return null; + } + + return $swimlanes[0]; } /** @@ -184,18 +186,18 @@ class SwimlaneModel extends Base ->orderBy('position', 'asc') ->findAll(); - $default_swimlane = $this->db + $defaultSwimlane = $this->db ->table(ProjectModel::TABLE) ->eq('id', $project_id) ->eq('show_default_swimlane', 1) ->findOneColumn('default_swimlane'); - if ($default_swimlane) { - if ($default_swimlane === 'Default swimlane') { - $default_swimlane = t($default_swimlane); + if ($defaultSwimlane) { + if ($defaultSwimlane === 'Default swimlane') { + $defaultSwimlane = t($defaultSwimlane); } - array_unshift($swimlanes, array('id' => 0, 'name' => $default_swimlane)); + array_unshift($swimlanes, array('id' => 0, 'name' => $defaultSwimlane)); } return $swimlanes; |
