Added Phase2 code for contact search and quick search
This commit is contained in:
@ -130,7 +130,7 @@ function constituentsonly_civicrm_alterSettingsFolders(&$metaDataFolders = NULL)
|
||||
*/
|
||||
function constituentsonly_civicrm_queryObjects(&$queryObjects, $type) {
|
||||
if ($type == 'Contact') {
|
||||
$queryObjects[] = new CRM_ConstituentsOnly_BAO_Query();
|
||||
//$queryObjects[] = new CRM_ConstituentsOnly_BAO_Query();
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,8 +140,7 @@ function constituentsonly_civicrm_queryObjects(&$queryObjects, $type) {
|
||||
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_contactListQuery
|
||||
*/
|
||||
function constituentsonly_civicrm_contactListQuery(&$query, $queryText, $context, $id) {
|
||||
$replace = 'WHERE (cc.do_not_trade IS NULL OR cc.do_not_trade = 0) AND ';
|
||||
$query = str_replace('WHERE ', $replace, $query);
|
||||
$query = CRM_ConstituentsOnly_BAO_ConstituentsOnly::getQuickSearchQuery($query);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -158,3 +157,14 @@ function constituentsonly_civicrm_selectWhereClause($entity, &$clauses) {
|
||||
$clauses['do_not_trade'] = ' = 0';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_civicrm_searchColumns().
|
||||
*
|
||||
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_searchColumns
|
||||
*/
|
||||
function constituentsonly_civicrm_searchColumns($objectName, &$headers, &$rows, &$selector) {
|
||||
if (in_array($objectName, ['contact']) && !empty($rows)) {
|
||||
$rows = CRM_ConstituentsOnly_BAO_ConstituentsOnly::updateSearchRows($rows);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user