2018-08-30 12:15:52 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class CRM_ConstituentsOnly_BAO_Query extends CRM_Contact_BAO_Query_Interface {
|
|
|
|
|
|
|
|
static $_networkFields = array();
|
|
|
|
|
|
|
|
public function &getFields() {
|
|
|
|
return self::$_networkFields;
|
|
|
|
}
|
|
|
|
|
2018-08-30 19:34:04 +00:00
|
|
|
/**
|
|
|
|
* @param $query
|
|
|
|
*
|
|
|
|
*/
|
2018-08-30 12:21:44 +00:00
|
|
|
public function select(&$query) {
|
2018-08-30 19:29:06 +00:00
|
|
|
// hack for profile search
|
|
|
|
$url = CRM_Utils_Array::value('q', $_GET);
|
2018-09-04 17:00:15 +00:00
|
|
|
if (in_array($url, ['civicrm/profile', 'civicrm/contact/search/builder'])) {
|
2018-08-30 19:29:06 +00:00
|
|
|
if (empty($query->_params)) {
|
|
|
|
$query->_params[] = [
|
|
|
|
'entryURL',
|
|
|
|
'=',
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
1,
|
|
|
|
];
|
|
|
|
}
|
|
|
|
$query->_paramLookup['entryURL'] = [
|
|
|
|
'entryURL',
|
|
|
|
'=',
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
1,
|
|
|
|
];
|
|
|
|
}
|
2018-08-30 12:21:44 +00:00
|
|
|
}
|
2018-08-30 12:15:52 +00:00
|
|
|
|
|
|
|
/**
|
2018-08-30 19:34:04 +00:00
|
|
|
* @param $query
|
2018-08-30 12:15:52 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
public function where(&$query) {
|
2018-08-30 16:45:23 +00:00
|
|
|
if (empty($query->_paramLookup['entryURL'])) {
|
|
|
|
return;
|
|
|
|
}
|
2018-08-30 19:29:06 +00:00
|
|
|
|
2018-09-04 17:00:15 +00:00
|
|
|
if (CRM_Utils_Array::value('civicrm_contact', $query->_tables) && empty($query->_paramLookup['do_not_trade'])) {
|
2018-08-30 16:04:52 +00:00
|
|
|
$query->_where[0][] = "( contact_a.do_not_trade IS NULL OR contact_a.do_not_trade = 0)";
|
|
|
|
}
|
2018-08-30 12:15:52 +00:00
|
|
|
}
|
|
|
|
|
2018-08-30 19:34:04 +00:00
|
|
|
/**
|
|
|
|
* @param string $name
|
|
|
|
* @param $mode
|
|
|
|
* @param $side
|
|
|
|
*
|
|
|
|
*/
|
2018-08-30 12:15:52 +00:00
|
|
|
public function from($name, $mode, $side) {
|
|
|
|
}
|
|
|
|
|
2018-08-30 19:34:04 +00:00
|
|
|
/**
|
|
|
|
* @param $tables
|
|
|
|
*
|
|
|
|
*/
|
2018-08-30 12:15:52 +00:00
|
|
|
public function setTableDependency(&$tables) {
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getPanesMapper(&$panes) {
|
|
|
|
}
|
|
|
|
|
2018-08-30 19:34:04 +00:00
|
|
|
/**
|
|
|
|
* @param $panes
|
|
|
|
*
|
|
|
|
*/
|
2018-08-30 12:15:52 +00:00
|
|
|
public function registerAdvancedSearchPane(&$panes) {
|
|
|
|
}
|
|
|
|
|
2018-08-30 19:34:04 +00:00
|
|
|
/**
|
|
|
|
* @param CRM_Core_Form $form
|
|
|
|
* @param $type
|
|
|
|
*
|
|
|
|
*/
|
2018-08-30 12:15:52 +00:00
|
|
|
public function buildAdvancedSearchPaneForm(&$form, $type) {
|
|
|
|
}
|
|
|
|
|
2018-08-30 19:34:04 +00:00
|
|
|
/**
|
|
|
|
* @param $paneTemplatePathArray
|
|
|
|
* @param $type
|
|
|
|
*
|
|
|
|
*/
|
2018-08-30 12:15:52 +00:00
|
|
|
public function setAdvancedSearchPaneTemplatePath(&$paneTemplatePathArray, $type) {
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|