From 5b888a23454e369ebf383c3003497038ae2fbf5d Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Wed, 19 Aug 2015 21:25:19 -0400 Subject: Add search in task title when using an integer only input --- app/Model/TaskFilter.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'app/Model/TaskFilter.php') diff --git a/app/Model/TaskFilter.php b/app/Model/TaskFilter.php index e8926b52..cede59e3 100644 --- a/app/Model/TaskFilter.php +++ b/app/Model/TaskFilter.php @@ -242,11 +242,11 @@ class TaskFilter extends Base */ public function filterByTitle($title) { - if (strlen($title) > 1 && $title{0} === '#' && ctype_digit(substr($title, 1))) { - $this->query->eq(Task::TABLE.'.id', substr($title, 1)); - } - else if (ctype_digit($title)) { - $this->query->eq(Task::TABLE.'.id', $title); + if (ctype_digit($title) || (strlen($title) > 1 && $title{0} === '#' && ctype_digit(substr($title, 1)))) { + $this->query->beginOr(); + $this->query->eq(Task::TABLE.'.id', str_replace('#', '', $title)); + $this->query->ilike(Task::TABLE.'.title', '%'.$title.'%'); + $this->query->closeOr(); } else { $this->query->ilike(Task::TABLE.'.title', '%'.$title.'%'); -- cgit v1.2.3