forked from CiviWare/com.dpci.constituentsonly
Added 'Include non-constituents in this search' on Advance search
This commit is contained in:
@ -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',
|
||||
));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user