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 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);
|
|
|
|
if ($url == 'civicrm/profile') {
|
|
|
|
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
|
|
|
|
|
|
|
/**
|
|
|
|
* Build where clause for ConstituentsOnly
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
* @access public
|
|
|
|
*/
|
|
|
|
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-08-30 16:04:52 +00:00
|
|
|
if (CRM_Utils_Array::value('civicrm_contact', $query->_tables)) {
|
|
|
|
$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
|
|
|
}
|
|
|
|
|
|
|
|
public function from($name, $mode, $side) {
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setTableDependency(&$tables) {
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getPanesMapper(&$panes) {
|
|
|
|
}
|
|
|
|
|
|
|
|
public function registerAdvancedSearchPane(&$panes) {
|
|
|
|
}
|
|
|
|
|
|
|
|
public function buildAdvancedSearchPaneForm(&$form, $type) {
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setAdvancedSearchPaneTemplatePath(&$paneTemplatePathArray, $type) {
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|