*/
function getCachedContacts($cacheKey, $offset, $rowCount, $includeContactIds) {
$this->_includeContactIds = $includeContactIds;
- list($select, $from) = $this->query();
+ list($select, $from, $where) = $this->query();
$from = " FROM civicrm_prevnext_cache pnc INNER JOIN civicrm_contact contact_a ON contact_a.id = pnc.entity_id1 AND pnc.cacheKey = '$cacheKey' " . substr($from, 31);
$order = " ORDER BY pnc.id";
$groupBy = " GROUP BY contact_a.id";
$limit = " LIMIT $offset, $rowCount";
- $query = "$select $from $groupBy $order $limit";
+ $query = "$select $from $where $groupBy $order $limit";
+
return CRM_Core_DAO::executeQuery($query);
}