mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-12 20:51:30 +00:00
- do not search for keywords in folders
- removed some old code
This commit is contained in:
parent
40568de7ad
commit
08e9f4da03
|
@ -478,24 +478,17 @@ class LetoDMS_Core_DMS {
|
|||
/*--------- Do it all over again for folders -------------*/
|
||||
if($mode & 0x2) {
|
||||
$searchKey = "";
|
||||
// Assemble the arguments for the concatenation function. This allows the
|
||||
// search to be carried across all the relevant fields.
|
||||
$concatFunction = "";
|
||||
if (in_array(2, $searchin)) {
|
||||
$concatFunction = (strlen($concatFunction) == 0 ? "" : $concatFunction.", ")."`tblFolders`.`name`";
|
||||
$searchFields[] = "`tblFolders`.`name`";
|
||||
}
|
||||
if (in_array(3, $searchin)) {
|
||||
$concatFunction = (strlen($concatFunction) == 0 ? "" : $concatFunction.", ")."`tblFolders`.`comment`";
|
||||
$searchFields[] = "`tblFolders`.`comment`";
|
||||
}
|
||||
|
||||
if (strlen($concatFunction)>0 && count($tkeys)>0) {
|
||||
$concatFunction = "CONCAT_WS(' ', ".$concatFunction.")";
|
||||
if (count($searchFields)>0) {
|
||||
foreach ($tkeys as $key) {
|
||||
$key = trim($key);
|
||||
if (strlen($key)>0) {
|
||||
//$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."%").")";
|
||||
}
|
||||
}
|
||||
|
@ -547,8 +540,12 @@ class LetoDMS_Core_DMS {
|
|||
$searchQuery .= " AND (".$searchCreateDate.")";
|
||||
}
|
||||
|
||||
/* Do not search for folders if not at least a search for a key,
|
||||
* an owner, or creation date is requested.
|
||||
*/
|
||||
if($searchKey || $searchOwner || $searchCreateDate) {
|
||||
// Count the number of rows that the search will produce.
|
||||
$resArr = $this->db->getResultArray("SELECT COUNT(*) AS num ".$searchQuery);
|
||||
$resArr = $this->db->getResultArray("SELECT COUNT(*) AS num ".$searchQuery." GROUP BY `tblFolders`.`id`");
|
||||
$totalFolders = 0;
|
||||
if (is_numeric($resArr[0]["num"]) && $resArr[0]["num"]>0) {
|
||||
$totalFolders = (integer)$resArr[0]["num"];
|
||||
|
@ -586,34 +583,30 @@ class LetoDMS_Core_DMS {
|
|||
} else {
|
||||
$folderresult = array('totalFolders'=>0, 'folders'=>array());
|
||||
}
|
||||
} else {
|
||||
$folderresult = array('totalFolders'=>0, 'folders'=>array());
|
||||
}
|
||||
|
||||
/*--------- Do it all over again for documents -------------*/
|
||||
|
||||
if($mode & 0x1) {
|
||||
$searchKey = "";
|
||||
// Assemble the arguments for the concatenation function. This allows the
|
||||
// search to be carried across all the relevant fields.
|
||||
$concatFunction = "";
|
||||
$searchFields = array();
|
||||
if (in_array(1, $searchin)) {
|
||||
$concatFunction = "`tblDocuments`.`keywords`";
|
||||
$searchFields[] = "`tblDocuments`.`keywords`";
|
||||
}
|
||||
if (in_array(2, $searchin)) {
|
||||
$concatFunction = (strlen($concatFunction) == 0 ? "" : $concatFunction.", ")."`tblDocuments`.`name`";
|
||||
$searchFields[] = "`tblDocuments`.`name`";
|
||||
}
|
||||
if (in_array(3, $searchin)) {
|
||||
$concatFunction = (strlen($concatFunction) == 0 ? "" : $concatFunction.", ")."`tblDocuments`.`comment`";
|
||||
$searchFields[] = "`tblDocuments`.`comment`";
|
||||
}
|
||||
|
||||
if (strlen($concatFunction)>0 && count($tkeys)>0) {
|
||||
$concatFunction = "CONCAT_WS(' ', ".$concatFunction.")";
|
||||
|
||||
if (count($searchFields)>0) {
|
||||
foreach ($tkeys as $key) {
|
||||
$key = trim($key);
|
||||
if (strlen($key)>0) {
|
||||
//$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."%").")";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user