Added 'Include non-constituents in this search' on Advance search

This commit is contained in:
Pradeep Nayak
2018-10-11 03:03:38 +05:30
parent af531fbd4c
commit 6a30fb4ca7
3 changed files with 37 additions and 0 deletions

View File

@ -190,6 +190,25 @@ function constituentsonly_civicrm_selectWhereClause($entity, &$clauses) {
*/
function constituentsonly_civicrm_searchColumns($objectName, &$headers, &$rows, &$selector) {
if (in_array($objectName, ['contact']) && !empty($rows)) {
if (!empty($_POST['ignore_constituent_search'])) {
return;
}
$rows = CRM_ConstituentsOnly_BAO_ConstituentsOnly::updateSearchRows($rows, $headers);
}
}
/**
* Implements hook_civicrm_buildForm().
*
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_buildForm
*/
function constituentsonly_civicrm_buildForm($formName, &$form) {
if ('CRM_Contact_Form_Search_Advanced' == $formName
&& !($form->getVar('_action') == CRM_Core_Action::DELETE)
) {
$form->addElement('checkbox', 'ignore_constituent_search', ts('Include non-constituents'));
CRM_Core_Region::instance('page-body')->add(array(
'template' => 'CRM/common.tpl',
));
}
}