do not group search result by tblFolders.id

This commit is contained in:
steinm 2012-12-13 21:23:34 +00:00
parent f2ca92f48b
commit 84edc020ef

View File

@ -593,9 +593,9 @@ class LetoDMS_Core_DMS {
*/
if($searchKey || $searchOwner || $searchCreateDate) {
// Count the number of rows that the search will produce.
$resArr = $this->db->getResultArray("SELECT COUNT(*) AS num ".$searchQuery." GROUP BY `tblFolders`.`id`");
$resArr = $this->db->getResultArray("SELECT COUNT(*) AS num ".$searchQuery);
$totalFolders = 0;
if (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"];
}
@ -606,7 +606,7 @@ class LetoDMS_Core_DMS {
// Only search if the offset is not beyond the number of folders
if($totalFolders > $offset) {
// Prepare the complete search query, including the LIMIT clause.
$searchQuery = "SELECT DISTINCT `tblFolders`.* ".$searchQuery;
$searchQuery = "SELECT DISTINCT `tblFolders`.* ".$searchQuery." GROUP BY `tblFolders`.`id`";
if($limit) {
$searchQuery .= " LIMIT ".$offset.",".$limit;