fix counting folders in search()

This commit is contained in:
Uwe Steinmann 2014-07-24 13:06:45 +02:00
parent 9da8b713b8
commit 7ebaab55f1

View File

@ -673,7 +673,7 @@ class SeedDMS_Core_DMS {
*/ */
if($searchKey || $searchOwner || $searchCreateDate || $searchAttributes) { if($searchKey || $searchOwner || $searchCreateDate || $searchAttributes) {
// Count the number of rows that the search will produce. // 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 FROM (SELECT DISTINCT `tblFolders`.id ".$searchQuery.") a");
if ($resArr && isset($resArr[0]) && is_numeric($resArr[0]["num"]) && $resArr[0]["num"]>0) { if ($resArr && isset($resArr[0]) && is_numeric($resArr[0]["num"]) && $resArr[0]["num"]>0) {
$totalFolders = (integer)$resArr[0]["num"]; $totalFolders = (integer)$resArr[0]["num"];
} }