From 6dd6a969ef5698eb6e678239df12b0615edcc3f0 Mon Sep 17 00:00:00 2001 From: avl Date: Fri, 19 Jun 2009 19:46:11 +0300 Subject: [PATCH] fix misc --- ipf/admin/model.php | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/ipf/admin/model.php b/ipf/admin/model.php index bbc553d..fb49fd4 100644 --- a/ipf/admin/model.php +++ b/ipf/admin/model.php @@ -450,19 +450,25 @@ class IPF_Admin_Model{ return false; } - protected function _ListSearchQuery($request){ - $this->search_value = null; - if (!$this->_isSearch()) - return; - $fields = $this->_searchFields(); - $this->search_value = @$request->GET['q']; - if ($this->search_value!=''){ - foreach ($fields as $f){ - $this->q->where($f.' like ?',array('%'.$this->search_value.'%')); - } - } - } - + protected function _ListSearchQuery($request){ + $this->search_value = null; + if (!$this->_isSearch()) + return; + $fields = $this->_searchFields(); + $this->search_value = @$request->GET['q']; + if ($this->search_value!=''){ + $wh = ''; + $whv = array(); + foreach ($fields as $f){ + if ($wh!='') $wh.=' or '; + $wh.= $f.' like ?'; + $whv[] = '%'.$this->search_value.'%'; + } + $this->q->where($wh,$whv); + return true; + } + return false; + } protected function _GetFilters($request){ $this->filters = array(); @@ -508,8 +514,8 @@ class IPF_Admin_Model{ public function ListItems($request, $lapp, $lmodel){ $this->ListItemsQuery(); $this->_GetFilters($request); - $this->_ListSearchQuery($request); - $this->_ListFilterQuery($request); + if (!$this->_ListSearchQuery($request)) + $this->_ListFilterQuery($request); $this->ListItemsHeader(); $currentPage = (int)@$request->GET['page']; -- 2.49.0