'table_name' => 'varchar(16)',
'contact_id' => 'int unsigned',
'sort_name' => 'varchar(128)',
+ 'display_name' => 'varchar(128)',
'assignee_contact_id' => 'int unsigned',
'assignee_sort_name' => 'varchar(128)',
'target_contact_id' => 'int unsigned',
function contactIDs($offset = 0, $rowcount = 0, $sort = NULL, $returnSQL = FALSE) {
$this->initialize();
- $sql = "SELECT contact_id FROM {$this->_tableName}";
if ($returnSQL) {
- return $sql;
+ return $this->all($offset, $rowcount, $sort, FALSE, TRUE);;
}
else {
- return CRM_Core_DAO::singleValueQuery($sql);
+ return CRM_Core_DAO::singleValueQuery("SELECT contact_id FROM {$this->_tableName}");
}
}
$this->initialize();
if ($justIDs) {
- $select = "contact_a.contact_id";
+ $select = "contact_a.id as contact_id";
}
else {
$select = "
case 'Contact':
$sql = "
INSERT INTO {$this->_tableName}
-( contact_id, sort_name, table_name )
-SELECT c.id, c.sort_name, 'Contact'
+( contact_id, sort_name, display_name, table_name )
+SELECT c.id, c.sort_name, c.display_name, 'Contact'
FROM {$this->_entityIDTableName} ct
INNER JOIN civicrm_contact c ON ct.entity_id = c.id
{$this->_limitDetailClause}
if (is_a($this, 'CRM_Contact_Selector_Custom')) {
$sql = $this->_search->contactIDs($start, $end, $sort, TRUE);
$replaceSQL = "SELECT contact_a.id as contact_id";
-
$coreSearch = FALSE;
}
// For core searches use the searchQuery method
// the prev next cache in this situation
// the other alternative of running the FULL query will just be incredibly inefficient
// and slow things down way too much on large data sets / complex queries
+
$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
";
-
$sql = str_replace($replaceSQL, $insertSQL, $sql);
+ CRM_Core_Error::debug_var( '$sql', $sql );
$errorScope = CRM_Core_TemporaryErrorScope::ignoreException();
$result = CRM_Core_DAO::executeQuery($sql);