Added code to filter in quick search

This commit is contained in:
2018-08-30 17:27:46 +01:00
parent 213833f322
commit 6ac1eaf067
2 changed files with 5 additions and 69 deletions

View File

@ -135,14 +135,13 @@ function constituentsonly_civicrm_queryObjects(&$queryObjects, $type) {
}
/**
* Implements hook_civicrm_apiWrappers().
* Implements hook_civicrm_contactListQuery().
*
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_apiWrappers
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_contactListQuery
*/
function constituentsonly_civicrm_apiWrappers(&$wrappers, $apiRequest) {
if ($apiRequest['entity'] == 'Contact' && $apiRequest['action'] == 'getquick') {
$wrappers[] = new CRM_Utils_API_ConstituentsOnlyAPIWrapper();
}
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);
}
/**