Added Phase2 code for contact search and quick search

This commit is contained in:
2018-09-28 14:14:19 +01:00
parent e34dbaa077
commit e3e27bbcb6
2 changed files with 126 additions and 3 deletions

View File

@ -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);
}
}