added code for report

This commit is contained in:
2018-09-29 01:53:50 +01:00
parent e573074111
commit 5779aee380
2 changed files with 197 additions and 17 deletions

View File

@ -144,10 +144,35 @@ function constituentsonly_civicrm_contactListQuery(&$query, $queryText, $context
}
/**
* Implements hook_civicrm_selectWhereClause().
* Implements hook_civicrm_alterReportVar().
*
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_selectWhereClause
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_alterReportVar
*/
function constituentsonly_civicrm_alterReportVar($varType, &$var, &$object) {
$reportClassName = get_class($object);
$supportedClassNames = CRM_ConstituentsOnly_BAO_ConstituentsOnly::getSuportedReportClasses();
if (!in_array($reportClassName, $supportedClassNames)) {
return;
}
if ('columns' == $varType) {
$var['civicrm_contact']['fields']['do_not_trade_alter'] = [
'title' => ts('Case ID'),
'no_display' => TRUE,
'required' => TRUE,
'name' => 'do_not_trade',
];
}
if ($varType == 'sql') {
CRM_ConstituentsOnly_BAO_ConstituentsOnly::updateReportSql($object);
}
if ($varType == 'rows') {
$var = CRM_ConstituentsOnly_BAO_ConstituentsOnly::updateReportRows($var, $object);
}
}
function constituentsonly_civicrm_selectWhereClause($entity, &$clauses) {
if ($entity == 'Contact') {
$url = CRM_Utils_Array::value('q', $_GET);