3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.4 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
31 * @copyright CiviCRM LLC (c) 2004-2013
35 class CRM_Report_Form_Contribute_Summary
extends CRM_Report_Form
{
36 protected $_addressField = FALSE;
38 protected $_charts = array(
40 'barChart' => 'Bar Chart',
41 'pieChart' => 'Pie Chart',
43 protected $_customGroupExtends = array('Contribution');
44 protected $_customGroupGroupBy = TRUE;
46 public $_drilldownReport = array('contribute/detail' => 'Link to Detail Report');
48 function __construct() {
50 // Check if CiviCampaign is a) enabled and b) has active campaigns
51 $config = CRM_Core_Config
::singleton();
52 $campaignEnabled = in_array("CiviCampaign", $config->enableComponents
);
53 if ($campaignEnabled) {
54 $getCampaigns = CRM_Campaign_BAO_Campaign
::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
55 $this->activeCampaigns
= $getCampaigns['campaigns'];
56 asort($this->activeCampaigns
);
59 $this->_columns
= array(
62 'dao' => 'CRM_Contact_DAO_Contact',
66 array('title' => ts('Contact Name'),
69 'postal_greeting_display' =>
70 array('title' => ts('Postal Greeting')),
77 'grouping' => 'contact-fields',
81 array('title' => ts('Contact ID')),
83 array('title' => ts('Contact Name'),
89 'dao' => 'CRM_Core_DAO_Email',
93 array('title' => ts('Email'),
97 'grouping' => 'contact-fields',
101 'dao' => 'CRM_Core_DAO_Phone',
105 array('title' => ts('Phone'),
109 'grouping' => 'contact-fields',
111 'civicrm_financial_type' =>
112 array('dao' => 'CRM_Financial_DAO_FinancialType',
113 'fields' => array('financial_type' => null,),
114 'grouping' => 'contri-fields',
115 'group_bys' => array(
116 'financial_type' => array('title' => ts('Financial Type')),
119 'civicrm_contribution' =>
121 'dao' => 'CRM_Contribute_DAO_Contribution',
122 //'bao' => 'CRM_Contribute_BAO_Contribution',
125 'contribution_source' => array('title' => ts('Source'), ),
127 array('required' => TRUE,
128 'no_display' => TRUE,
131 array('title' => ts('Contribution Amount Stats'),
134 array('sum' => ts('Contributions Aggregate'),
135 'count' => ts('Contributions'),
136 'avg' => ts('Contributions Avg'),
140 'grouping' => 'contri-fields',
144 array('operatorType' => CRM_Report_Form
::OP_DATE
),
145 'contribution_status_id' =>
146 array('title' => ts('Donation Status'),
147 'operatorType' => CRM_Report_Form
::OP_MULTISELECT
,
148 'options' => CRM_Contribute_PseudoConstant
::contributionStatus(),
149 'default' => array(1),
150 'type' => CRM_Utils_Type
::T_INT
,
153 array('title' => 'Currency',
154 'operatorType' => CRM_Report_Form
::OP_MULTISELECT
,
155 'options' => CRM_Core_OptionGroup
::values('currencies_enabled'),
157 'type' => CRM_Utils_Type
::T_STRING
,
159 'financial_type_id' =>
160 array('title' => ts('Financial Type'),
161 'operatorType' => CRM_Report_Form
::OP_MULTISELECT
,
162 'options' => CRM_Contribute_PseudoConstant
::financialType(),
163 'type' => CRM_Utils_Type
::T_INT
,
166 array('title' => ts('Contribution Amount'),
169 array('title' => ts('Contributions Aggregate'),
170 'type' => CRM_Report_Form
::OP_INT
,
171 'dbAlias' => 'civicrm_contribution_total_amount_sum',
175 array('title' => ts('Contributions Count'),
176 'type' => CRM_Report_Form
::OP_INT
,
177 'dbAlias' => 'civicrm_contribution_total_amount_count',
181 array('title' => ts('Contributions Avg'),
182 'type' => CRM_Report_Form
::OP_INT
,
183 'dbAlias' => 'civicrm_contribution_total_amount_avg',
195 'contribution_source' => NULL,
198 'civicrm_contribution_soft' =>
200 'dao' => 'CRM_Contribute_DAO_ContributionSoft',
205 'title' => ts('Soft Credit Amount Stats'),
208 array('sum' => ts('Soft Credit Aggregate'),
209 'count' => ts('Soft Credits'),
210 'avg' => ts('Soft Credit Avg'),
214 'grouping' => 'contri-fields',
218 array('title' => ts('Soft Credit Amount'),
221 array('title' => ts('Soft Credit Aggregate'),
222 'type' => CRM_Report_Form
::OP_INT
,
223 'dbAlias' => 'civicrm_contribution_soft_soft_amount_sum',
227 array('title' => ts('Soft Credits Count'),
228 'type' => CRM_Report_Form
::OP_INT
,
229 'dbAlias' => 'civicrm_contribution_soft_soft_amount_count',
233 array('title' => ts('Soft Credit Avg'),
234 'type' => CRM_Report_Form
::OP_INT
,
235 'dbAlias' => 'civicrm_contribution_soft_soft_amount_avg',
242 'dao' => 'CRM_Contact_DAO_GroupContact',
248 'name' => 'group_id',
249 'title' => ts('Group'),
250 'operatorType' => CRM_Report_Form
::OP_MULTISELECT
,
252 'options' => CRM_Core_PseudoConstant
::group(),
253 'type' => CRM_Utils_Type
::T_INT
,
257 ) +
$this->addAddressFields();
259 // If we have a campaign, build out the relevant elements
260 $this->_tagFilter
= TRUE;
261 if ($campaignEnabled && !empty($this->activeCampaigns
)) {
262 $this->_columns
['civicrm_contribution']['fields']['campaign_id'] = array(
263 'title' => 'Campaign',
264 'default' => 'false',
266 $this->_columns
['civicrm_contribution']['filters']['campaign_id'] = array('title' => ts('Campaign'),
267 'operatorType' => CRM_Report_Form
::OP_MULTISELECT
,
268 'options' => $this->activeCampaigns
,
270 $this->_columns
['civicrm_contribution']['group_bys']['campaign_id'] = array('title' => ts('Campaign'));
273 $this->_currencyColumn
= 'civicrm_contribution_currency';
274 parent
::__construct();
277 function preProcess() {
278 parent
::preProcess();
281 function setDefaultValues($freeze = TRUE) {
282 return parent
::setDefaultValues($freeze);
287 $this->_columnHeaders
= array();
288 foreach ($this->_columns
as $tableName => $table) {
289 if (array_key_exists('group_bys', $table)) {
290 foreach ($table['group_bys'] as $fieldName => $field) {
291 if ($tableName == 'civicrm_address') {
292 $this->_addressField
= TRUE;
294 if (CRM_Utils_Array
::value($fieldName, $this->_params
['group_bys'])) {
295 switch (CRM_Utils_Array
::value($fieldName, $this->_params
['group_bys_freq'])) {
297 $select[] = "DATE_SUB({$field['dbAlias']}, INTERVAL WEEKDAY({$field['dbAlias']}) DAY) AS {$tableName}_{$fieldName}_start";
298 $select[] = "YEARWEEK({$field['dbAlias']}) AS {$tableName}_{$fieldName}_subtotal";
299 $select[] = "WEEKOFYEAR({$field['dbAlias']}) AS {$tableName}_{$fieldName}_interval";
300 $field['title'] = 'Week';
304 $select[] = "MAKEDATE(YEAR({$field['dbAlias']}), 1) AS {$tableName}_{$fieldName}_start";
305 $select[] = "YEAR({$field['dbAlias']}) AS {$tableName}_{$fieldName}_subtotal";
306 $select[] = "YEAR({$field['dbAlias']}) AS {$tableName}_{$fieldName}_interval";
307 $field['title'] = 'Year';
311 $select[] = "DATE_SUB({$field['dbAlias']}, INTERVAL (DAYOFMONTH({$field['dbAlias']})-1) DAY) as {$tableName}_{$fieldName}_start";
312 $select[] = "MONTH({$field['dbAlias']}) AS {$tableName}_{$fieldName}_subtotal";
313 $select[] = "MONTHNAME({$field['dbAlias']}) AS {$tableName}_{$fieldName}_interval";
314 $field['title'] = 'Month';
318 $select[] = "STR_TO_DATE(CONCAT( 3 * QUARTER( {$field['dbAlias']} ) -2 , '/', '1', '/', YEAR( {$field['dbAlias']} ) ), '%m/%d/%Y') AS {$tableName}_{$fieldName}_start";
319 $select[] = "QUARTER({$field['dbAlias']}) AS {$tableName}_{$fieldName}_subtotal";
320 $select[] = "QUARTER({$field['dbAlias']}) AS {$tableName}_{$fieldName}_interval";
321 $field['title'] = 'Quarter';
324 if (CRM_Utils_Array
::value($fieldName, $this->_params
['group_bys_freq'])) {
325 $this->_interval
= $field['title'];
326 $this->_columnHeaders
["{$tableName}_{$fieldName}_start"]['title'] = $field['title'] . ' Beginning';
327 $this->_columnHeaders
["{$tableName}_{$fieldName}_start"]['type'] = $field['type'];
328 $this->_columnHeaders
["{$tableName}_{$fieldName}_start"]['group_by'] = $this->_params
['group_bys_freq'][$fieldName];
330 // just to make sure these values are transfered to rows.
331 // since we need that for calculation purpose,
332 // e.g making subtotals look nicer or graphs
333 $this->_columnHeaders
["{$tableName}_{$fieldName}_interval"] = array('no_display' => TRUE);
334 $this->_columnHeaders
["{$tableName}_{$fieldName}_subtotal"] = array('no_display' => TRUE);
340 if (array_key_exists('fields', $table)) {
341 foreach ($table['fields'] as $fieldName => $field) {
342 if ($tableName == 'civicrm_address') {
343 $this->_addressField
= TRUE;
345 if (CRM_Utils_Array
::value('required', $field) ||
346 CRM_Utils_Array
::value($fieldName, $this->_params
['fields'])
349 // only include statistics columns if set
350 if (CRM_Utils_Array
::value('statistics', $field)) {
351 foreach ($field['statistics'] as $stat => $label) {
352 switch (strtolower($stat)) {
354 $select[] = "SUM({$field['dbAlias']}) as {$tableName}_{$fieldName}_{$stat}";
355 $this->_columnHeaders
["{$tableName}_{$fieldName}_{$stat}"]['title'] = $label;
356 $this->_columnHeaders
["{$tableName}_{$fieldName}_{$stat}"]['type'] = $field['type'];
357 $this->_statFields
[] = "{$tableName}_{$fieldName}_{$stat}";
361 $select[] = "COUNT({$field['dbAlias']}) as {$tableName}_{$fieldName}_{$stat}";
362 $this->_columnHeaders
["{$tableName}_{$fieldName}_{$stat}"]['type'] = CRM_Utils_Type
::T_INT
;
363 $this->_columnHeaders
["{$tableName}_{$fieldName}_{$stat}"]['title'] = $label;
364 $this->_statFields
[] = "{$tableName}_{$fieldName}_{$stat}";
368 $select[] = "ROUND(AVG({$field['dbAlias']}),2) as {$tableName}_{$fieldName}_{$stat}";
369 $this->_columnHeaders
["{$tableName}_{$fieldName}_{$stat}"]['type'] = $field['type'];
370 $this->_columnHeaders
["{$tableName}_{$fieldName}_{$stat}"]['title'] = $label;
371 $this->_statFields
[] = "{$tableName}_{$fieldName}_{$stat}";
377 $select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
378 $this->_columnHeaders
["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array
::value('type', $field);
379 $this->_columnHeaders
["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array
::value('title', $field);
386 $this->_select
= "SELECT " . implode(', ', $select) . " ";
389 static function formRule($fields, $files, $self) {
390 $errors = $grouping = array();
391 //check for searching combination of dispaly columns and
393 $ignoreFields = array('total_amount', 'sort_name');
394 $errors = $self->customDataFormRule($fields, $ignoreFields);
396 if (!CRM_Utils_Array
::value('receive_date', $fields['group_bys'])) {
397 if (CRM_Utils_Array
::value('receive_date_relative', $fields) ||
398 CRM_Utils_Date
::isDate($fields['receive_date_from']) ||
399 CRM_Utils_Date
::isDate($fields['receive_date_to'])
401 $errors['receive_date_relative'] = ts("Do not use filter on Date if group by Receive Date is not used ");
404 if (!CRM_Utils_Array
::value('total_amount', $fields['fields'])) {
406 'total_count_value', 'total_sum_value', 'total_avg_value') as $val) {
407 if (CRM_Utils_Array
::value($val, $fields)) {
408 $errors[$val] = ts("Please select the Amount Statistics");
417 $softCreditJoin = "LEFT";
418 if (CRM_Utils_Array
::value('soft_amount', $this->_params
['fields']) &&
419 !CRM_Utils_Array
::value('total_amount', $this->_params
['fields'])) {
420 // if its only soft credit stats, use inner join
421 $softCreditJoin = "INNER";
425 FROM civicrm_contact {$this->_aliases['civicrm_contact']}
426 INNER JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']}
427 ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_contribution']}.contact_id AND
428 {$this->_aliases['civicrm_contribution']}.is_test = 0
429 {$softCreditJoin} JOIN civicrm_contribution_soft {$this->_aliases['civicrm_contribution_soft']}
430 ON {$this->_aliases['civicrm_contribution_soft']}.contribution_id = {$this->_aliases['civicrm_contribution']}.id
431 LEFT JOIN civicrm_financial_type {$this->_aliases['civicrm_financial_type']}
432 ON {$this->_aliases['civicrm_contribution']}.financial_type_id ={$this->_aliases['civicrm_financial_type']}.id
433 LEFT JOIN civicrm_email {$this->_aliases['civicrm_email']}
434 ON ({$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_email']}.contact_id AND
435 {$this->_aliases['civicrm_email']}.is_primary = 1)
437 LEFT JOIN civicrm_phone {$this->_aliases['civicrm_phone']}
438 ON ({$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_phone']}.contact_id AND
439 {$this->_aliases['civicrm_phone']}.is_primary = 1)";
441 if ($this->_addressField
) {
443 LEFT JOIN civicrm_address {$this->_aliases['civicrm_address']}
444 ON {$this->_aliases['civicrm_contact']}.id =
445 {$this->_aliases['civicrm_address']}.contact_id AND
446 {$this->_aliases['civicrm_address']}.is_primary = 1\n";
451 $this->_groupBy
= "";
453 if (is_array($this->_params
['group_bys']) &&
454 !empty($this->_params
['group_bys'])
456 foreach ($this->_columns
as $tableName => $table) {
457 if (array_key_exists('group_bys', $table)) {
458 foreach ($table['group_bys'] as $fieldName => $field) {
459 if (CRM_Utils_Array
::value($fieldName, $this->_params
['group_bys'])) {
460 if (CRM_Utils_Array
::value('chart', $field)) {
461 $this->assign('chartSupported', TRUE);
464 if (CRM_Utils_Array
::value('frequency', $table['group_bys'][$fieldName]) &&
465 CRM_Utils_Array
::value($fieldName, $this->_params
['group_bys_freq'])
468 $append = "YEAR({$field['dbAlias']}),";
469 if (in_array(strtolower($this->_params
['group_bys_freq'][$fieldName]),
474 $this->_groupBy
[] = "$append {$this->_params['group_bys_freq'][$fieldName]}({$field['dbAlias']})";
478 $this->_groupBy
[] = $field['dbAlias'];
485 if (!empty($this->_statFields
) &&
486 (($append && count($this->_groupBy
) <= 1) ||
(!$append)) && !$this->_having
488 $this->_rollup
= " WITH ROLLUP";
490 $this->_groupBy
= "GROUP BY " . implode(', ', $this->_groupBy
) . " {$this->_rollup} ";
493 $this->_groupBy
= "GROUP BY {$this->_aliases['civicrm_contact']}.id";
497 function statistics(&$rows) {
498 $statistics = parent
::statistics($rows);
500 $softCredit = CRM_Utils_Array
::value('soft_amount', $this->_params
['fields']);
501 $onlySoftCredit = $softCredit && !CRM_Utils_Array
::value('total_amount', $this->_params
['fields']);
504 COUNT({$this->_aliases['civicrm_contribution']}.total_amount ) as civicrm_contribution_total_amount_count,
505 SUM({$this->_aliases['civicrm_contribution']}.total_amount ) as civicrm_contribution_total_amount_sum,
506 ROUND(AVG({$this->_aliases['civicrm_contribution']}.total_amount), 2) as civicrm_contribution_total_amount_avg,
507 {$this->_aliases['civicrm_contribution']}.currency as currency";
511 COUNT({$this->_aliases['civicrm_contribution_soft']}.amount ) as civicrm_contribution_soft_soft_amount_count,
512 SUM({$this->_aliases['civicrm_contribution_soft']}.amount ) as civicrm_contribution_soft_soft_amount_sum,
513 ROUND(AVG({$this->_aliases['civicrm_contribution_soft']}.amount), 2) as civicrm_contribution_soft_soft_amount_avg";
515 $group = "\nGROUP BY {$this->_aliases['civicrm_contribution']}.currency";
516 $sql = "{$select} {$this->_from} {$this->_where} {$group} {$this->_having}";
518 $dao = CRM_Core_DAO
::executeQuery($sql);
519 $totalAmount = $average = $softTotalAmount = $softAverage = array();
520 $count = $softCount = 0;
521 while ($dao->fetch()) {
522 $totalAmount[] = CRM_Utils_Money
::format($dao->civicrm_contribution_total_amount_sum
, $dao->currency
)."(".$dao->civicrm_contribution_total_amount_count
.")";
523 $average[] = CRM_Utils_Money
::format($dao->civicrm_contribution_total_amount_avg
, $dao->currency
);
524 $count +
= $dao->civicrm_contribution_total_amount_count
;
527 $softTotalAmount[] = CRM_Utils_Money
::format($dao->civicrm_contribution_soft_soft_amount_sum
, $dao->currency
)."(".$dao->civicrm_contribution_soft_soft_amount_count
.")";
528 $softAverage[] = CRM_Utils_Money
::format($dao->civicrm_contribution_soft_soft_amount_avg
, $dao->currency
);
529 $softCount +
= $dao->civicrm_contribution_soft_soft_amount_count
;
533 if (!$onlySoftCredit) {
534 $statistics['counts']['amount'] = array(
535 'title' => ts('Total Amount'),
536 'value' => implode(', ', $totalAmount),
537 'type' => CRM_Utils_Type
::T_STRING
,
539 $statistics['counts']['count'] = array(
540 'title' => ts('Total Donations'),
543 $statistics['counts']['avg'] = array(
544 'title' => ts('Average'),
545 'value' => implode(', ', $average),
546 'type' => CRM_Utils_Type
::T_STRING
,
550 $statistics['counts']['soft_amount'] = array(
551 'title' => ts('Total Soft Credit Amount'),
552 'value' => implode(', ', $softTotalAmount),
553 'type' => CRM_Utils_Type
::T_STRING
,
555 $statistics['counts']['soft_count'] = array(
556 'title' => ts('Total Soft Credits'),
557 'value' => $softCount,
559 $statistics['counts']['soft_avg'] = array(
560 'title' => ts('Average Soft Credit'),
561 'value' => implode(', ', $softAverage),
562 'type' => CRM_Utils_Type
::T_STRING
,
568 function postProcess() {
569 $this->buildACLClause($this->_aliases
['civicrm_contact']);
570 parent
::postProcess();
573 function buildChart(&$rows) {
574 $graphRows = array();
576 if (CRM_Utils_Array
::value('charts', $this->_params
)) {
577 if (CRM_Utils_Array
::value('receive_date', $this->_params
['group_bys'])) {
579 $contrib = CRM_Utils_Array
::value('total_amount', $this->_params
['fields']) ?
TRUE : FALSE;
580 $softContrib = CRM_Utils_Array
::value('soft_amount', $this->_params
['fields']) ?
TRUE : FALSE;
582 foreach ($rows as $key => $row) {
583 if ($row['civicrm_contribution_receive_date_subtotal']) {
584 $graphRows['receive_date'][] = $row['civicrm_contribution_receive_date_start'];
585 $graphRows[$this->_interval
][] = $row['civicrm_contribution_receive_date_interval'];
586 if ($softContrib && $contrib) {
587 // both contri & soft contri stats are present
588 $graphRows['multiValue'][0][] = $row['civicrm_contribution_total_amount_sum'];
589 $graphRows['multiValue'][1][] = $row['civicrm_contribution_soft_soft_amount_sum'];
590 } else if ($softContrib) {
591 // only soft contributions
592 $graphRows['multiValue'][0][] = $row['civicrm_contribution_soft_soft_amount_sum'];
594 // only contributions
595 $graphRows['multiValue'][0][] = $row['civicrm_contribution_total_amount_sum'];
600 if ($softContrib && $contrib) {
601 $graphRows['barKeys'][0] = ts('Contributions');
602 $graphRows['barKeys'][1] = ts('Soft Credits');
603 $graphRows['legend'] = ts('Contributions and Soft Credits');
604 } else if ($softContrib) {
605 $graphRows['legend'] = ts('Soft Credits');
609 $config = CRM_Core_Config
::Singleton();
610 $graphRows['xname'] = $this->_interval
;
611 $graphRows['yname'] = "Amount ({$config->defaultCurrency})";
612 CRM_Utils_OpenFlashChart
::chart($graphRows, $this->_params
['charts'], $this->_interval
);
613 $this->assign('chartType', $this->_params
['charts']);
618 function alterDisplay(&$rows) {
619 // custom code to alter rows
622 foreach ($rows as $rowNum => $row) {
623 // make count columns point to detail report
624 if (CRM_Utils_Array
::value('receive_date', $this->_params
['group_bys']) &&
625 CRM_Utils_Array
::value('civicrm_contribution_receive_date_start', $row) &&
626 CRM_Utils_Array
::value('civicrm_contribution_receive_date_start', $row) &&
627 CRM_Utils_Array
::value('civicrm_contribution_receive_date_subtotal', $row)
630 $dateStart = CRM_Utils_Date
::customFormat($row['civicrm_contribution_receive_date_start'], '%Y%m%d');
631 $endDate = new DateTime($dateStart);
634 list($dateEnd['Y'], $dateEnd['M'], $dateEnd['d']) = explode(':', $endDate->format('Y:m:d'));
636 switch (strtolower($this->_params
['group_bys_freq']['receive_date'])) {
638 $dateEnd = date("Ymd", mktime(0, 0, 0, $dateEnd['M'] +
1,
639 $dateEnd['d'] - 1, $dateEnd['Y']
644 $dateEnd = date("Ymd", mktime(0, 0, 0, $dateEnd['M'],
645 $dateEnd['d'] - 1, $dateEnd['Y'] +
1
650 $dateEnd = date("Ymd", mktime(0, 0, 0, $dateEnd['M'],
651 $dateEnd['d'] +
6, $dateEnd['Y']
656 $dateEnd = date("Ymd", mktime(0, 0, 0, $dateEnd['M'] +
3,
657 $dateEnd['d'] - 1, $dateEnd['Y']
661 $url = CRM_Report_Utils_Report
::getNextUrl('contribute/detail',
662 "reset=1&force=1&receive_date_from={$dateStart}&receive_date_to={$dateEnd}",
665 $this->_drilldownReport
667 $rows[$rowNum]['civicrm_contribution_receive_date_start_link'] = $url;
668 $rows[$rowNum]['civicrm_contribution_receive_date_start_hover'] = ts('List all contribution(s) for this date unit.');
672 // make subtotals look nicer
673 if (array_key_exists('civicrm_contribution_receive_date_subtotal', $row) &&
674 !$row['civicrm_contribution_receive_date_subtotal']
676 $this->fixSubTotalDisplay($rows[$rowNum], $this->_statFields
);
680 // convert display name to links
681 if (array_key_exists('civicrm_contact_sort_name', $row) &&
682 array_key_exists('civicrm_contact_id', $row)
684 $url = CRM_Report_Utils_Report
::getNextUrl('contribute/detail',
685 'reset=1&force=1&id_op=eq&id_value=' . $row['civicrm_contact_id'],
686 $this->_absoluteUrl
, $this->_id
, $this->_drilldownReport
688 $rows[$rowNum]['civicrm_contact_sort_name_link'] = $url;
689 $rows[$rowNum]['civicrm_contact_sort_name_hover'] = ts("Lists detailed contribution(s) for this record.");
693 // If using campaigns, convert campaign_id to campaign title
694 if (array_key_exists('civicrm_contribution_campaign_id', $row)) {
695 if ($value = $row['civicrm_contribution_campaign_id']) {
696 $rows[$rowNum]['civicrm_contribution_campaign_id'] = $this->activeCampaigns
[$value];
701 $entryFound = $this->alterDisplayAddressFields($row, $rows, $rowNum, 'contribute/detail', 'List all contribution(s) for this ') ?
TRUE : $entryFound;
703 // skip looking further in rows, if first row itself doesn't
704 // have the column we need