fixed indentation and styling
This commit is contained in:
parent
e4feb3a9e9
commit
1c455e639f
@ -8,7 +8,8 @@ class CRM_ConstituentsOnly_BAO_Query extends CRM_Contact_BAO_Query_Interface {
|
||||
return self::$_networkFields;
|
||||
}
|
||||
|
||||
public function select(&$query) { }
|
||||
public function select(&$query) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Build where clause for ConstituentsOnly
|
||||
@ -43,4 +44,3 @@ class CRM_ConstituentsOnly_BAO_Query extends CRM_Contact_BAO_Query_Interface {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,8 @@ class CRM_Utils_API_ConstituentsOnlyAPIWrapper implements API_Wrapper {
|
||||
'sequential' => 1,
|
||||
'contact_id' => array('=' => $api_result['id']),
|
||||
));
|
||||
} catch (CiviCRM_API3_Exception $e) {
|
||||
}
|
||||
catch (CiviCRM_API3_Exception $e) {
|
||||
$error = $e->getMessage();
|
||||
}
|
||||
|
||||
@ -58,4 +59,5 @@ class CRM_Utils_API_ConstituentsOnlyAPIWrapper implements API_Wrapper {
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,57 +3,6 @@
|
||||
require_once 'constituentsonly.civix.php';
|
||||
use CRM_ConstituentsOnly_ExtensionUtil as E;
|
||||
|
||||
/**
|
||||
* Implements hook_civicrm_queryObjects().
|
||||
*/
|
||||
function constituentsonly_civicrm_queryObjects(&$queryObjects, $type) {
|
||||
if ($type == 'Contact') {
|
||||
$queryObjects[] = new CRM_ConstituentsOnly_BAO_Query();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_civicrm_apiWrappers().
|
||||
*/
|
||||
function constituentsonly_civicrm_apiWrappers(&$wrappers, $apiRequest) {
|
||||
if ($apiRequest['entity'] == 'Contact' && $apiRequest['action'] == 'getquick') {
|
||||
$wrappers[] = new CRM_Utils_API_ConstituentsOnlyAPIWrapper();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of hook_civicrm_alterReportVar().
|
||||
*/
|
||||
function constituentsonly_civicrm_alterReportVar($varType, &$var, &$object) {
|
||||
$instanceValue = $object->getVar('_instanceValues');
|
||||
if (!empty($instanceValue) &&
|
||||
in_array(
|
||||
$instanceValue['report_id'],
|
||||
array(
|
||||
'contact/summary',
|
||||
'contact/detail',
|
||||
'contact/currentEmployer',
|
||||
)
|
||||
)
|
||||
) {
|
||||
if ($varType == 'sql') {
|
||||
$var->_columnHeaders['civicrm_contact_do_not_trade'] = array(
|
||||
'type' => 1,
|
||||
'title' => 'Constituent',
|
||||
'no_display' => TRUE,
|
||||
);
|
||||
$var->_select .= ' , contact_civireport.do_not_trade as civicrm_contact_do_not_trade ';
|
||||
|
||||
$where = $var->getVar('_where');
|
||||
$where .= ' AND contact_civireport.do_not_trade <> 1';
|
||||
$var->setVar('_where', $where);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_civicrm_config().
|
||||
*
|
||||
@ -174,30 +123,56 @@ function constituentsonly_civicrm_alterSettingsFolders(&$metaDataFolders = NULL)
|
||||
_constituentsonly_civix_civicrm_alterSettingsFolders($metaDataFolders);
|
||||
}
|
||||
|
||||
// --- Functions below this ship commented out. Uncomment as required. ---
|
||||
/**
|
||||
* Implements hook_civicrm_queryObjects().
|
||||
*
|
||||
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_queryObjects
|
||||
*/
|
||||
function constituentsonly_civicrm_queryObjects(&$queryObjects, $type) {
|
||||
if ($type == 'Contact') {
|
||||
$queryObjects[] = new CRM_ConstituentsOnly_BAO_Query();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_civicrm_preProcess().
|
||||
* Implements hook_civicrm_apiWrappers().
|
||||
*
|
||||
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_preProcess
|
||||
*
|
||||
function constituentsonly_civicrm_preProcess($formName, &$form) {
|
||||
|
||||
} // */
|
||||
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_apiWrappers
|
||||
*/
|
||||
function constituentsonly_civicrm_apiWrappers(&$wrappers, $apiRequest) {
|
||||
if ($apiRequest['entity'] == 'Contact' && $apiRequest['action'] == 'getquick') {
|
||||
$wrappers[] = new CRM_Utils_API_ConstituentsOnlyAPIWrapper();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_civicrm_navigationMenu().
|
||||
* Implements hook_civicrm_alterReportVar().
|
||||
*
|
||||
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_navigationMenu
|
||||
*
|
||||
function constituentsonly_civicrm_navigationMenu(&$menu) {
|
||||
_constituentsonly_civix_insert_navigation_menu($menu, NULL, array(
|
||||
'label' => E::ts('The Page'),
|
||||
'name' => 'the_page',
|
||||
'url' => 'civicrm/the-page',
|
||||
'permission' => 'access CiviReport,access CiviContribute',
|
||||
'operator' => 'OR',
|
||||
'separator' => 0,
|
||||
));
|
||||
_constituentsonly_civix_navigationMenu($menu);
|
||||
} // */
|
||||
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_alterReportVar
|
||||
*/
|
||||
function constituentsonly_civicrm_alterReportVar($varType, &$var, &$object) {
|
||||
$instanceValue = $object->getVar('_instanceValues');
|
||||
if (!empty($instanceValue) &&
|
||||
in_array(
|
||||
$instanceValue['report_id'],
|
||||
array(
|
||||
'contact/summary',
|
||||
'contact/detail',
|
||||
'contact/currentEmployer',
|
||||
)
|
||||
)
|
||||
) {
|
||||
if ($varType == 'sql') {
|
||||
$var->_columnHeaders['civicrm_contact_do_not_trade'] = array(
|
||||
'type' => 1,
|
||||
'title' => 'Constituent',
|
||||
'no_display' => TRUE,
|
||||
);
|
||||
$var->_select .= ' , contact_civireport.do_not_trade as civicrm_contact_do_not_trade ';
|
||||
|
||||
$where = $var->getVar('_where');
|
||||
$where .= ' AND contact_civireport.do_not_trade <> 1';
|
||||
$var->setVar('_where', $where);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user