summaryrefslogtreecommitdiff
path: root/app/Model/TaskFilter.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-06-28 20:47:39 -0400
committerFrederic Guillot <fred@kanboard.net>2015-06-28 20:47:39 -0400
commit2e7e7031804b09a04c83896535b31acb12138960 (patch)
treeafc617dc3679c464b7cb7e8ec6ff96c3bf1cdfb5 /app/Model/TaskFilter.php
parent7af5a923b047f612c02af2fe39a09beb45792f3a (diff)
Add status attribute for advanced search
Diffstat (limited to 'app/Model/TaskFilter.php')
-rw-r--r--app/Model/TaskFilter.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/app/Model/TaskFilter.php b/app/Model/TaskFilter.php
index c47b059f..6577c9b4 100644
--- a/app/Model/TaskFilter.php
+++ b/app/Model/TaskFilter.php
@@ -53,6 +53,9 @@ class TaskFilter extends Base
case 'T_TITLE':
$this->filterByTitle($value);
break;
+ case 'T_STATUS':
+ $this->filterByStatusName($value);
+ break;
}
}
@@ -297,6 +300,22 @@ class TaskFilter extends Base
}
/**
+ * Filter by status name
+ *
+ * @access public
+ * @param string $status
+ * @return TaskFilter
+ */
+ public function filterByStatusName($status)
+ {
+ if ($status === 'open' || $status === 'closed') {
+ $this->filterByStatus($status === 'open' ? Task::STATUS_OPEN : Task::STATUS_CLOSED);
+ }
+
+ return $this;
+ }
+
+ /**
* Filter by status
*
* @access public
@@ -321,6 +340,7 @@ class TaskFilter extends Base
*/
public function filterByDueDate($date)
{
+ $this->query->neq('date_due', '');
$this->query->neq('date_due', 0);
$this->query->notNull('date_due');
return $this->filterWithOperator('date_due', $date, true);