diff --git a/application/module/Reference/Reference.php b/application/module/Reference/Reference.php index a38a9627..c787a9b8 100644 --- a/application/module/Reference/Reference.php +++ b/application/module/Reference/Reference.php @@ -221,14 +221,14 @@ class Reference public function fetchThemeReferences($code) { $wheresql = array(); - $wheresql[] = " s.code='$code' "; + //$wheresql[] = " s.code='$code' "; if(!empty($this->keyword)) { - $wheresql[] = " (ref.title LIKE '%{$this->keyword}%' OR ref.reference LIKE '%{$this->keyword}%') "; + $wheresql[] = " (ref.title iLIKE '%{$this->keyword}%' OR ref.reference iLIKE '%{$this->keyword}%') "; } if(count($wheresql)>0) { - $wheresql = " WHERE ".join(" AND ",$wheresql); + $wheresql = " and ".join(" AND ",$wheresql); }else{ $wheresql = ""; } @@ -240,9 +240,10 @@ class Reference $order = "ref.{$this->order} {$this->sort}"; } - $sql="select distinct ref.* from mdref r left join {$this->table->reference} ref on r.refid=ref.id + $sql="select distinct ref.* from {$this->table->reference} ref where ref.id in (select r.refid from mdref r left join datasource ds on r.uuid=ds.uuid left join {$this->table->source} s on s.id=ds.sourceid - $wheresql + where s.code='$code') + $wheresql ORDER BY $order"; $rs=$this->db->query($sql); return $rs->fetchAll();