From 6a4e5eee22fe3a2b69cdadbdf0cb7b210b6783c7 Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Sat, 21 May 2011 17:02:31 +0000 Subject: h-source:improved search, now also the other_names entry is considered --- h-source/Application/Controllers/SearchController.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'h-source/Application/Controllers/SearchController.php') diff --git a/h-source/Application/Controllers/SearchController.php b/h-source/Application/Controllers/SearchController.php index 9633a0e..9e7cb68 100644 --- a/h-source/Application/Controllers/SearchController.php +++ b/h-source/Application/Controllers/SearchController.php @@ -60,11 +60,18 @@ class SearchController extends BaseController if (strcmp($this->viewArgs['action'],'search') === 0) { Params::$whereClauseSymbolArray = array('like'); + + $this->m['HardwareModel']->logicalOperators = array('AND','OR'); $whereClause = array( - 'type' => $this->viewArgs['type'], - 'model' => "like '%".$this->viewArgs['model']."%'", - '-deleted' => "no", + 'type' => $this->viewArgs['type'], + 'level1' => array( + 'model' => "like '%".$this->viewArgs['model']."%'", + 'other_names' => "like '%".$this->viewArgs['model']."%'", + ), +// 'model' => "like '%".$this->viewArgs['model']."%'", +// 'other_names' => "like '%".$this->viewArgs['model']."%'", + '-deleted' => "no", ); $recordNumber = $this->m['HardwareModel']->clear()->where($whereClause)->orderBy("id_hard desc")->rowNumber(); @@ -77,7 +84,7 @@ class SearchController extends BaseController //set the limit clause $limit = $this->h['Pages']->getLimit($page,$recordNumber,10); - $data['table'] = $this->m['HardwareModel']->clear()->select('id_hard,model,type,comm_year')->where($whereClause)->limit($limit)->orderBy("id_hard desc")->send(); + $data['table'] = $this->m['HardwareModel']->clear()->select('id_hard,model,type,comm_year,other_names')->where($whereClause)->limit($limit)->orderBy("id_hard desc")->send(); // echo $this->m['HardwareModel']->getQuery(); $data['pageList'] = $this->h['Pages']->render($page-3,7); -- cgit v1.2.3