}
if ($output == CRM_Core_Selector_Controller::EXPORT) {
- $csvHeaders = array(ts('Contact Id'), ts('Contact Type'));
+ $csvHeaders = array(ts('Contact ID'), ts('Contact Type'));
foreach ($this->getColHeads($action, $output) as $column) {
if (array_key_exists('name', $column)) {
$csvHeaders[] = $column['name'];
$this->fillupPrevNextCache($sort, $cacheKey);
}
elseif ($firstRecord >= $countRow) {
- $this->fillupPrevNextCache($sort, $cacheKey, $countRow, $firstRecord + 500);
+ $this->fillupPrevNextCache($sort, $cacheKey, $countRow, 500);
}
return $cacheKey;
}
$insertSQL = "
INSERT INTO civicrm_prevnext_cache ( entity_table, entity_id1, entity_id2, cacheKey, data )
-SELECT 'civicrm_contact', contact_a.id, contact_a.id, '$cacheKey', contact_a.display_name
+SELECT DISTINCT 'civicrm_contact', contact_a.id, contact_a.id, '$cacheKey', contact_a.display_name
";
$sql = str_replace($replaceSQL, $insertSQL, $sql);
// build insert query, note that currently we build cache for 500 contact records at a time, hence below approach
$insertValues = array();
while($dao->fetch()) {
- $insertValues[] = "('civicrm_contact', {$dao->contact_id}, {$dao->contact_id}, '{$cacheKey}', '{$dao->sort_name}')";
+ $insertValues[] = "('civicrm_contact', {$dao->contact_id}, {$dao->contact_id}, '{$cacheKey}', '" . CRM_Core_DAO::escapeString($dao->sort_name) . "')";
}
//update pre/next cache using single insert query