- remove incluѕion of inc.DBAccess.php because it is include by Core.php

- do not use CONCAT_WS anymore, because sqlite3 doesn't know it
This commit is contained in:
steinm 2012-02-13 08:31:01 +00:00
parent 8c6b19f38a
commit 6c188ebb93

View File

@ -14,7 +14,6 @@
/** /**
* Include some files * Include some files
*/ */
require_once("inc.DBAccess.php");
require_once("inc.AccessUtils.php"); require_once("inc.AccessUtils.php");
require_once("inc.FileUtils.php"); require_once("inc.FileUtils.php");
require_once("inc.ClassAccess.php"); require_once("inc.ClassAccess.php");
@ -457,9 +456,11 @@ class LetoDMS_Core_DMS {
$concatFunction = ""; $concatFunction = "";
if (in_array(2, $searchin)) { if (in_array(2, $searchin)) {
$concatFunction = (strlen($concatFunction) == 0 ? "" : $concatFunction.", ")."`tblFolders`.`name`"; $concatFunction = (strlen($concatFunction) == 0 ? "" : $concatFunction.", ")."`tblFolders`.`name`";
$searchFields[] = "`tblFolders`.`name`";
} }
if (in_array(3, $searchin)) { if (in_array(3, $searchin)) {
$concatFunction = (strlen($concatFunction) == 0 ? "" : $concatFunction.", ")."`tblFolders`.`comment`"; $concatFunction = (strlen($concatFunction) == 0 ? "" : $concatFunction.", ")."`tblFolders`.`comment`";
$searchFields[] = "`tblFolders`.`comment`";
} }
if (strlen($concatFunction)>0 && count($tkeys)>0) { if (strlen($concatFunction)>0 && count($tkeys)>0) {
@ -467,7 +468,8 @@ class LetoDMS_Core_DMS {
foreach ($tkeys as $key) { foreach ($tkeys as $key) {
$key = trim($key); $key = trim($key);
if (strlen($key)>0) { if (strlen($key)>0) {
$searchKey = (strlen($searchKey)==0 ? "" : $searchKey." ".$logicalmode." ").$concatFunction." LIKE ".$this->db->qstr('%'.$key.'%'); //$searchKey = (strlen($searchKey)==0 ? "" : $searchKey." ".$logicalmode." ").$concatFunction." LIKE ".$this->db->qstr('%'.$key.'%');
$searchKey = (strlen($searchKey)==0 ? "" : $searchKey." ".$logicalmode." ")."(".implode(" like ".$this->db->qstr("%".$key."%")." OR ", $searchFields)." like ".$this->db->qstr("%".$key."%").")";
} }
} }
} }
@ -565,14 +567,18 @@ class LetoDMS_Core_DMS {
// Assemble the arguments for the concatenation function. This allows the // Assemble the arguments for the concatenation function. This allows the
// search to be carried across all the relevant fields. // search to be carried across all the relevant fields.
$concatFunction = ""; $concatFunction = "";
$searchFields = array();
if (in_array(1, $searchin)) { if (in_array(1, $searchin)) {
$concatFunction = "`tblDocuments`.`keywords`"; $concatFunction = "`tblDocuments`.`keywords`";
$searchFields[] = "`tblDocuments`.`keywords`";
} }
if (in_array(2, $searchin)) { if (in_array(2, $searchin)) {
$concatFunction = (strlen($concatFunction) == 0 ? "" : $concatFunction.", ")."`tblDocuments`.`name`"; $concatFunction = (strlen($concatFunction) == 0 ? "" : $concatFunction.", ")."`tblDocuments`.`name`";
$searchFields[] = "`tblDocuments`.`name`";
} }
if (in_array(3, $searchin)) { if (in_array(3, $searchin)) {
$concatFunction = (strlen($concatFunction) == 0 ? "" : $concatFunction.", ")."`tblDocuments`.`comment`"; $concatFunction = (strlen($concatFunction) == 0 ? "" : $concatFunction.", ")."`tblDocuments`.`comment`";
$searchFields[] = "`tblDocuments`.`comment`";
} }
if (strlen($concatFunction)>0 && count($tkeys)>0) { if (strlen($concatFunction)>0 && count($tkeys)>0) {
@ -580,7 +586,8 @@ class LetoDMS_Core_DMS {
foreach ($tkeys as $key) { foreach ($tkeys as $key) {
$key = trim($key); $key = trim($key);
if (strlen($key)>0) { if (strlen($key)>0) {
$searchKey = (strlen($searchKey)==0 ? "" : $searchKey." ".$logicalmode." ").$concatFunction." LIKE ".$this->db->qstr('%'.$key.'%'); //$searchKey = (strlen($searchKey)==0 ? "" : $searchKey." ".$logicalmode." ").$concatFunction." LIKE ".$this->db->qstr('%'.$key.'%');
$searchKey = (strlen($searchKey)==0 ? "" : $searchKey." ".$logicalmode." ")."(".implode(" like ".$this->db->qstr("%".$key."%")." OR ", $searchFields)." like ".$this->db->qstr("%".$key."%").")";
} }
} }
} }