From dfd79722270b4f7a6653cb130b6518dcd7bd8c95 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 18 Jul 2015 11:33:51 -0400 Subject: Add new search attribute for swimlane --- app/Model/TaskFilter.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'app/Model/TaskFilter.php') diff --git a/app/Model/TaskFilter.php b/app/Model/TaskFilter.php index 377ec3c6..822397ec 100644 --- a/app/Model/TaskFilter.php +++ b/app/Model/TaskFilter.php @@ -71,6 +71,9 @@ class TaskFilter extends Base case 'T_REFERENCE': $this->filterByReference($value); break; + case 'T_SWIMLANE': + $this->filterBySwimlaneName($value); + break; } } @@ -246,6 +249,30 @@ class TaskFilter extends Base $this->query->closeOr(); } + /** + * Filter by swimlane name + * + * @access public + * @param array $values List of swimlane name + * @return TaskFilter + */ + public function filterBySwimlaneName(array $values) + { + $this->query->beginOr(); + + foreach ($values as $swimlane) { + if ($swimlane === 'default') { + $this->query->eq(Task::TABLE.'.swimlane_id', 0); + } + else { + $this->query->ilike(Swimlane::TABLE.'.name', $swimlane); + $this->query->addCondition(Task::TABLE.'.swimlane_id=0 AND '.Project::TABLE.'.default_swimlane '.$this->db->getDriver()->getOperator('ILIKE')." '$swimlane'"); + } + } + + $this->query->closeOr(); + } + /** * Filter by category id * -- cgit v1.2.3