From b5a42deddaaccb8654057c8e487ebe21db83e178 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Mon, 14 Mar 2016 15:59:12 +0800 Subject: [PATCH] * fix beginIF for dao.class.php and saveQueryCondition for doc. --- lib/base/dao/dao.class.php | 5 +++++ module/doc/model.php | 1 + 2 files changed, 6 insertions(+) diff --git a/lib/base/dao/dao.class.php b/lib/base/dao/dao.class.php index b775563773..3f90846fb3 100644 --- a/lib/base/dao/dao.class.php +++ b/lib/base/dao/dao.class.php @@ -1897,6 +1897,8 @@ class baseSQL */ public function orderBy($order) { + if($this->inCondition and !$this->conditionIsTrue) return $this; + $order = str_replace(array('|', '', '_'), ' ', $order); /* Add "`" in order string. */ @@ -1941,6 +1943,7 @@ class baseSQL */ public function limit($limit) { + if($this->inCondition and !$this->conditionIsTrue) return $this; if(empty($limit)) return $this; stripos($limit, 'limit') !== false ? $this->sql .= " $limit " : $this->sql .= ' ' . DAO::LIMIT . " $limit "; return $this; @@ -1956,6 +1959,7 @@ class baseSQL */ public function groupBy($groupBy) { + if($this->inCondition and !$this->conditionIsTrue) return $this; $this->sql .= ' ' . DAO::GROUPBY . " $groupBy"; return $this; } @@ -1970,6 +1974,7 @@ class baseSQL */ public function having($having) { + if($this->inCondition and !$this->conditionIsTrue) return $this; $this->sql .= ' ' . DAO::HAVING . " $having"; return $this; } diff --git a/module/doc/model.php b/module/doc/model.php index 4cb8cab3f8..c276570502 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -152,6 +152,7 @@ class docModel extends model $docs = $this->dao->select('*')->from(TABLE_DOC)->where($docQuery)->andWhere('deleted')->eq(0)->orderBy($sort)->page($pager)->fetchAll(); } + $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'doc'); if($docs) return $docs; return array();