3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
17 class CRM_Report_Form_Contribute_History
extends CRM_Report_Form
{
19 * Primary Contacts count limitCONSTROW_COUNT_LIMIT = 10;
25 protected $_relationshipColumns = [];
27 protected $_customGroupExtends = [
33 protected $_referenceYear = [
37 protected $_yearStatisticsFrom = '';
39 protected $_yearStatisticsTo = '';
44 * @throws \CRM_Core_Exception
46 public function __construct() {
47 $this->_autoIncludeIndexedFieldsAsOrderBys
= 1;
49 $date = CRM_Core_SelectValues
::date('custom', NULL, $yearsInPast, 0);
50 $count = $date['maxYear'];
51 $optionYear = ['' => ts('- select -')];
53 $this->_yearStatisticsFrom
= $date['minYear'];
54 $this->_yearStatisticsTo
= $date['maxYear'];
56 while ($date['minYear'] <= $count) {
57 $optionYear[$date['minYear']] = $date['minYear'];
62 $relationshipTypes = CRM_Core_PseudoConstant
::relationshipType();
63 foreach ($relationshipTypes as $rid => $rtype) {
64 if ($rtype['label_a_b'] != $rtype['label_b_a']) {
65 $relationTypeOp[$rid] = "{$rtype['label_a_b']}/{$rtype['label_b_a']}";
68 $relationTypeOp[$rid] = $rtype['label_a_b'];
73 'civicrm_contact' => [
74 'dao' => 'CRM_Contact_DAO_Contact',
77 'title' => ts('Contact Name'),
83 'title' => ts('First Name'),
86 'title' => ts('Middle Name'),
89 'title' => ts('Last Name'),
97 'title' => ts('Gender'),
100 'title' => ts('Birth Date'),
103 'title' => ts('Age'),
104 'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, CURDATE())',
107 'title' => ts('Contact Type'),
109 'contact_sub_type' => [
110 'title' => ts('Contact Subtype'),
113 'grouping' => 'contact-fields',
116 'title' => ts('Last Name, First Name'),
118 'default_weight' => '0',
119 'default_order' => 'ASC',
122 'name' => 'first_name',
123 'title' => ts('First Name'),
126 'name' => 'gender_id',
127 'title' => ts('Gender'),
130 'name' => 'birth_date',
131 'title' => ts('Birth Date'),
134 'title' => ts('Contact Type'),
136 'contact_sub_type' => [
137 'title' => ts('Contact Subtype'),
141 'sort_name' => ['title' => ts('Contact Name')],
143 'title' => ts('Contact ID'),
144 'no_display' => TRUE,
147 'title' => ts('Gender'),
148 'operatorType' => CRM_Report_Form
::OP_MULTISELECT
,
149 'options' => CRM_Core_PseudoConstant
::get('CRM_Contact_DAO_Contact', 'gender_id'),
152 'title' => ts('Birth Date'),
153 'operatorType' => CRM_Report_Form
::OP_DATE
,
156 'title' => ts('Contact Type'),
158 'contact_sub_type' => [
159 'title' => ts('Contact Subtype'),
164 'dao' => 'CRM_Core_DAO_Email',
167 'title' => ts('Email'),
171 'grouping' => 'contact-fields',
174 'dao' => 'CRM_Core_DAO_Phone',
177 'title' => ts('Phone'),
181 'grouping' => 'contact-fields',
183 ] +
$this->addAddressFields(FALSE, FALSE, FALSE, []) +
[
184 'civicrm_relationship' => [
185 'dao' => 'CRM_Contact_DAO_Relationship',
187 'relationship_type_id' => [
188 'title' => ts('Relationship Type'),
191 'contact_id_a' => ['no_display' => TRUE],
192 'contact_id_b' => ['no_display' => TRUE],
195 'relationship_type_id' => [
196 'title' => ts('Relationship Type'),
197 'operatorType' => CRM_Report_Form
::OP_MULTISELECT
,
198 'options' => $relationTypeOp,
199 'type' => CRM_Utils_Type
::T_STRING
,
204 'civicrm_contribution' => [
205 'dao' => 'CRM_Contribute_DAO_Contribution',
208 'title' => ts('Amount Statistics'),
211 'no_display' => TRUE,
212 'statistics' => ['sum' => ts('Aggregate Amount')],
217 'no_display' => TRUE,
220 'grouping' => 'contri-fields',
223 'title' => ts('This Year'),
224 'operatorType' => CRM_Report_Form
::OP_SELECT
,
225 'options' => $optionYear,
229 'title' => ts('Other Years'),
230 'operatorType' => CRM_Report_Form
::OP_SELECT
,
231 'options' => $optionYear,
234 'receive_date' => ['operatorType' => CRM_Report_Form
::OP_DATE
],
235 'contribution_status_id' => [
236 'title' => ts('Contribution Status'),
237 'operatorType' => CRM_Report_Form
::OP_MULTISELECT
,
238 'options' => CRM_Contribute_BAO_Contribution
::buildOptions('contribution_status_id', 'search'),
241 'financial_type_id' => [
242 'title' => ts('Financial Type'),
243 'type' => CRM_Utils_Type
::T_INT
,
244 'operatorType' => CRM_Report_Form
::OP_MULTISELECT
,
245 'options' => CRM_Contribute_PseudoConstant
::financialType(),
248 'title' => ts('Contribution Amount'),
251 'title' => ts('Aggregate Amount'),
252 'type' => CRM_Report_Form
::OP_INT
,
253 'dbAlias' => 'civicrm_contribution_total_amount_sum',
260 'civicrm_financial_trxn' => [
261 'dao' => 'CRM_Financial_DAO_FinancialTrxn',
264 'title' => ts('Credit Card Type'),
265 'dbAlias' => 'GROUP_CONCAT(financial_trxn_civireport.card_type_id SEPARATOR ",")',
270 'title' => ts('Credit Card Type'),
271 'operatorType' => CRM_Report_Form
::OP_MULTISELECT
,
272 'options' => CRM_Financial_DAO_FinancialTrxn
::buildOptions('card_type_id'),
274 'type' => CRM_Utils_Type
::T_STRING
,
280 $this->_columns
['civicrm_contribution']['fields']['civicrm_upto_' .
281 $this->_yearStatisticsFrom
] = [
282 'title' => ts('Up To %1 Donation', [1 => $this->_yearStatisticsFrom
]),
284 'type' => CRM_Utils_Type
::T_MONEY
,
285 'is_statistics' => TRUE,
288 $yearConter = $this->_yearStatisticsFrom
;
290 while ($yearConter <= $this->_yearStatisticsTo
) {
291 $this->_columns
['civicrm_contribution']['fields'][$yearConter] = [
292 'title' => ts('%1 Donation', [1 => $yearConter]),
294 'type' => CRM_Utils_Type
::T_MONEY
,
295 'is_statistics' => TRUE,
300 $this->_columns
['civicrm_contribution']['fields']['aggregate_amount'] = [
301 'title' => ts('Aggregate Amount'),
302 'type' => CRM_Utils_Type
::T_MONEY
,
303 'is_statistics' => TRUE,
306 $this->_groupFilter
= TRUE;
307 $this->_tagFilter
= TRUE;
308 parent
::__construct();
311 public function preProcess() {
312 parent
::preProcess();
315 public function select() {
317 // @todo remove this & use parent (with maybe some override in this or better yet selectWhere fn)
318 $this->_columnHeaders
= [];
320 foreach ($this->_columns
as $tableName => $table) {
321 if (array_key_exists('fields', $table)) {
322 foreach ($table['fields'] as $fieldName => $field) {
324 if (!empty($field['required']) ||
325 !empty($this->_params
['fields'][$fieldName])
327 if ($tableName == 'civicrm_relationship') {
328 $this->_relationshipColumns
["{$tableName}_{$fieldName}"] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
329 $this->_columnHeaders
["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array
::value('type', $field);
330 $this->_columnHeaders
["{$tableName}_{$fieldName}"]['title'] = $field['title'];
334 if (!empty($field['is_statistics'])) {
335 $this->_columnHeaders
[$fieldName]['type'] = $field['type'];
336 $this->_columnHeaders
[$fieldName]['title'] = $field['title'];
339 elseif ($fieldName == 'receive_date') {
340 if ((CRM_Utils_Array
::value('this_year_op', $this->_params
) ==
341 'fiscal' && !empty($this->_params
['this_year_value'])) ||
342 (CRM_Utils_Array
::value('other_year_op', $this->_params
==
343 'fiscal') && !empty($this->_params
['other_year_value']))
345 $select[] = self
::fiscalYearOffset($field['dbAlias']) .
346 " as {$tableName}_{$fieldName}";
349 $select[] = " YEAR(" . $field['dbAlias'] . ")" .
350 " as {$tableName}_{$fieldName}";
353 elseif ($fieldName == 'total_amount') {
354 $select[] = "SUM({$field['dbAlias']}) as {$tableName}_{$fieldName}";
357 $select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}";
358 $this->_columnHeaders
["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array
::value('type', $field);
359 $this->_columnHeaders
["{$tableName}_{$fieldName}"]['title'] = $field['title'];
361 if (!empty($field['no_display'])) {
362 $this->_columnHeaders
["{$tableName}_{$fieldName}"]['no_display'] = TRUE;
368 $this->_selectClauses
= $select;
370 $this->_select
= "SELECT " . implode(', ', $select) . " ";
373 public function from() {
375 FROM civicrm_contact {$this->_aliases['civicrm_contact']}
376 INNER JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']}
377 ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_contribution']}.contact_id AND
378 {$this->_aliases['civicrm_contribution']}.is_test = 0 ";
380 $relContacAlias = 'contact_relationship';
381 $this->_relationshipFrom
= " INNER JOIN civicrm_relationship {$this->_aliases['civicrm_relationship']}
382 ON (({$this->_aliases['civicrm_relationship']}.contact_id_a = {$relContacAlias}.id OR {$this->_aliases['civicrm_relationship']}.contact_id_b = {$relContacAlias}.id ) AND {$this->_aliases['civicrm_relationship']}.is_active = 1) ";
384 $this->joinAddressFromContact();
385 $this->joinPhoneFromContact();
386 $this->joinEmailFromContact();
388 // for credit card type
389 $this->addFinancialTrxnFromClause();
392 public function where() {
393 $whereClauses = $havingClauses = $relationshipWhere = [];
394 $this->_relationshipWhere
= '';
395 $this->_statusClause
= '';
397 foreach ($this->_columns
as $tableName => $table) {
398 if (array_key_exists('filters', $table)) {
399 foreach ($table['filters'] as $fieldName => $field) {
401 if ($fieldName == 'this_year' ||
$fieldName == 'other_year') {
404 elseif (CRM_Utils_Array
::value('type', $field) & CRM_Utils_Type
::T_DATE
406 $relative = CRM_Utils_Array
::value("{$fieldName}_relative", $this->_params
);
407 $from = CRM_Utils_Array
::value("{$fieldName}_from", $this->_params
);
408 $to = CRM_Utils_Array
::value("{$fieldName}_to", $this->_params
);
410 $clause = $this->dateClause($field['name'], $relative, $from, $to, $field['type']);
413 $op = CRM_Utils_Array
::value("{$fieldName}_op", $this->_params
);
415 $clause = $this->whereClause($field,
417 CRM_Utils_Array
::value("{$fieldName}_value", $this->_params
),
418 CRM_Utils_Array
::value("{$fieldName}_min", $this->_params
),
419 CRM_Utils_Array
::value("{$fieldName}_max", $this->_params
)
424 if (!empty($clause)) {
425 if ($tableName == 'civicrm_relationship') {
426 $relationshipWhere[] = $clause;
430 if ($fieldName == 'contribution_status_id') {
431 $this->_statusClause
= " AND " . $clause;
434 if (!empty($field['having'])) {
435 $havingClauses[] = $clause;
438 $whereClauses[] = $clause;
445 if (empty($whereClauses)) {
446 $this->_where
= "WHERE ( 1 ) ";
450 $this->_where
= "WHERE " . implode(' AND ', $whereClauses);
453 if ($this->_aclWhere
) {
454 $this->_where
.= " AND {$this->_aclWhere} ";
457 if (!empty($havingClauses)) {
458 // use this clause to construct group by clause.
459 $this->_having
= "HAVING " . implode(' AND ', $havingClauses);
462 if (!empty($relationshipWhere)) {
463 $this->_relationshipWhere
= ' AND ' .
464 implode(' AND ', $relationshipWhere);
468 public function groupBy() {
470 "{$this->_aliases['civicrm_contribution']}.contact_id",
471 "YEAR({$this->_aliases['civicrm_contribution']}.receive_date)",
473 $this->_groupBy
= CRM_Contact_BAO_Query
::getGroupByFromSelectColumns($this->_selectClauses
, $groupBy);
477 * Override to set limit to 10.
479 * @param int $rowCount
483 public function limit($rowCount = self
::ROW_COUNT_LIMIT
) {
484 return parent
::limit($rowCount);
488 * Override to set pager with limit is 10.
490 * @param int $rowCount
492 public function setPager($rowCount = self
::ROW_COUNT_LIMIT
) {
493 parent
::setPager($rowCount);
501 public function statistics(&$rows) {
502 $statistics = parent
::statistics($rows);
504 foreach ($rows as $rownum => $row) {
505 if (is_numeric($rownum)) {
509 $statistics['counts']['rowCount'] = [
510 'title' => ts('Primary Contact(s) Listed'),
514 if ($this->_rowsFound
&& ($this->_rowsFound
> $count)) {
515 $statistics['counts']['rowsFound'] = [
516 'title' => ts('Total Primary Contact(s)'),
517 'value' => $this->_rowsFound
,
531 public static function formRule($fields, $files, $self) {
533 if (!empty($fields['this_year_value']) &&
534 !empty($fields['other_year_value']) &&
535 ($fields['this_year_value'] == $fields['other_year_value'])
537 $errors['other_year_value'] = ts("Value for filters 'This Year' and 'Other Years' can not be same.");
542 public function postProcess() {
543 // get ready with post process params
544 $this->beginPostProcess();
545 $this->fixReportParams();
547 $this->buildACLClause($this->_aliases
['civicrm_contact']);
551 $this->customDataFrom();
557 // build array of result based on column headers. This method also allows
558 // modifying column headers before using it to build result set i.e $rows.
559 $this->buildRows($sql, $rows);
561 // format result set.
562 $this->formatDisplay($rows, FALSE);
564 // assign variables to templates
565 $this->doTemplateAssignment($rows);
567 // do print / pdf / instance stuff if needed
568 $this->endPostProcess($rows);
571 public function fixReportParams() {
572 if (!empty($this->_params
['this_year_value'])) {
573 $this->_referenceYear
['this_year'] = $this->_params
['this_year_value'];
575 if (!empty($this->_params
['other_year_value'])) {
576 $this->_referenceYear
['other_year'] = $this->_params
['other_year_value'];
584 public function buildRows($sql, &$rows) {
589 if (!empty($this->_referenceYear
['other_year'])) {
590 (CRM_Utils_Array
::value('other_year_op', $this->_params
) ==
591 'calendar') ?
$other_receive_date = 'YEAR (contri.receive_date)' : $other_receive_date = self
::fiscalYearOffset('contri.receive_date');
592 $addWhere .= " AND {$this->_aliases['civicrm_contact']}.id NOT IN ( SELECT DISTINCT cont.id FROM civicrm_contact cont, civicrm_contribution contri WHERE cont.id = contri.contact_id AND {$other_receive_date} = {$this->_referenceYear['other_year']} AND contri.is_test = 0 ) ";
594 if (!empty($this->_referenceYear
['this_year'])) {
595 (CRM_Utils_Array
::value('this_year_op', $this->_params
) ==
596 'calendar') ?
$receive_date = 'YEAR (contri.receive_date)' : $receive_date = self
::fiscalYearOffset('contri.receive_date');
597 $addWhere .= " AND {$this->_aliases['civicrm_contact']}.id IN ( SELECT DISTINCT cont.id FROM civicrm_contact cont, civicrm_contribution contri WHERE cont.id = contri.contact_id AND {$receive_date} = {$this->_referenceYear['this_year']} AND contri.is_test = 0 ) ";
600 $getContacts = "SELECT {$this->_aliases['civicrm_contact']}.id as cid, SUM({$this->_aliases['civicrm_contribution']}.total_amount) as civicrm_contribution_total_amount_sum {$this->_from} {$this->_where} {$addWhere} GROUP BY {$this->_aliases['civicrm_contact']}.id {$this->_having} {$this->_limit}";
602 $dao = CRM_Core_DAO
::executeQuery($getContacts);
604 while ($dao->fetch()) {
605 $contactIds[] = $dao->cid
;
609 $relationshipRows = [];
610 if (empty($contactIds)) {
614 $primaryContributions = $this->buildContributionRows($contactIds);
616 list($relationshipRows, $relatedContactIds) = $this->buildRelationshipRows($contactIds);
618 if (empty($relatedContactIds)) {
619 $rows = $primaryContributions;
623 $relatedContributions = $this->buildContributionRows($relatedContactIds);
626 $summaryYears[] = "civicrm_upto_{$this->_yearStatisticsFrom}";
627 $yearConter = $this->_yearStatisticsFrom
;
629 while ($yearConter <= $this->_yearStatisticsTo
) {
630 $summaryYears[] = $yearConter;
633 $summaryYears[] = 'aggregate_amount';
635 foreach ($primaryContributions as $cid => $primaryRow) {
637 if (!isset($relationshipRows[$cid])) {
642 $total['civicrm_contact_sort_name'] = ts('Total');
643 foreach ($summaryYears as $year) {
644 $total[$year] = CRM_Utils_Array
::value($year, $primaryRow, 0);
647 $relatedContact = FALSE;
649 foreach ($relationshipRows[$cid] as $relcid => $relRow) {
650 if (!isset($relatedContributions[$relcid])) {
653 $relatedContact = TRUE;
654 $relatedRow = $relatedContributions[$relcid];
655 foreach ($summaryYears as $year) {
656 $total[$year] +
= CRM_Utils_Array
::value($year, $relatedRow, 0);
659 foreach (array_keys($this->_relationshipColumns
) as $col) {
660 if (!empty($relRow[$col])) {
661 $relatedRow[$col] = $relRow[$col];
664 $rows["{$cid}_{$relcid}"] = $relatedRow;
666 if ($relatedContact) {
667 $rows["{$cid}_total"] = $total;
668 $rows["{$cid}_bank"] = ['civicrm_contact_sort_name' => ' '];
678 public function buildContributionRows($contactIds) {
680 if (empty($contactIds)) {
684 $sqlContribution = "{$this->_select} {$this->_from} WHERE {$this->_aliases['civicrm_contact']}.id IN (" .
685 implode(',', $contactIds) .
686 ") AND {$this->_aliases['civicrm_contribution']}.is_test = 0 {$this->_statusClause} {$this->_groupBy} ";
688 $dao = CRM_Core_DAO
::executeQuery($sqlContribution);
689 $contributionSum = 0;
691 while ($dao->fetch()) {
692 if (!$dao->civicrm_contact_id
) {
696 foreach ($this->_columnHeaders
as $key => $value) {
697 if (property_exists($dao, $key)) {
698 $rows[$dao->civicrm_contact_id
][$key] = $dao->$key;
701 if ($dao->civicrm_contribution_receive_date
) {
702 if ($dao->civicrm_contribution_receive_date
>
703 $this->_yearStatisticsFrom
705 $rows[$dao->civicrm_contact_id
][$dao->civicrm_contribution_receive_date
] = $dao->civicrm_contribution_total_amount
;
708 if (!isset($rows[$dao->civicrm_contact_id
]["civicrm_upto_{$this->_yearStatisticsFrom}"])) {
709 $rows[$dao->civicrm_contact_id
]["civicrm_upto_{$this->_yearStatisticsFrom}"] = 0;
712 $rows[$dao->civicrm_contact_id
]["civicrm_upto_{$this->_yearStatisticsFrom}"] +
= $dao->civicrm_contribution_total_amount
;
716 if (!isset($rows[$dao->civicrm_contact_id
]['aggregate_amount'])) {
717 $rows[$dao->civicrm_contact_id
]['aggregate_amount'] = 0;
719 $rows[$dao->civicrm_contact_id
]['aggregate_amount'] +
= $dao->civicrm_contribution_total_amount
;
729 public function buildRelationshipRows($contactIds) {
730 $relationshipRows = $relatedContactIds = [];
731 if (empty($contactIds)) {
732 return [$relationshipRows, $relatedContactIds];
735 $relContactAlias = 'contact_relationship';
737 if (!empty($this->_relationshipColumns
)) {
738 $addRelSelect = ', ' . implode(', ', $this->_relationshipColumns
);
740 $sqlRelationship = "SELECT {$this->_aliases['civicrm_relationship']}.relationship_type_id as relationship_type_id, {$this->_aliases['civicrm_relationship']}.contact_id_a as contact_id_a, {$this->_aliases['civicrm_relationship']}.contact_id_b as contact_id_b {$addRelSelect} FROM civicrm_contact {$relContactAlias} {$this->_relationshipFrom} WHERE {$relContactAlias}.id IN (" .
741 implode(',', $contactIds) .
742 ") AND {$this->_aliases['civicrm_relationship']}.is_active = 1 {$this->_relationshipWhere} GROUP BY {$this->_aliases['civicrm_relationship']}.contact_id_a, {$this->_aliases['civicrm_relationship']}.contact_id_b, {$this->_aliases['civicrm_relationship']}.relationship_type_id";
743 $relationshipTypes = CRM_Core_PseudoConstant
::relationshipType();
745 $dao = CRM_Core_DAO
::executeQuery($sqlRelationship);
746 while ($dao->fetch()) {
748 foreach (array_keys($this->_relationshipColumns
) as $rel_column) {
749 $row[$rel_column] = $dao->$rel_column;
751 if (in_array($dao->contact_id_a
, $contactIds)) {
752 $row['civicrm_relationship_relationship_type_id'] = $relationshipTypes[$dao->relationship_type_id
]['label_a_b'];
753 $row['civicrm_relationship_contact_id'] = $dao->contact_id_b
;
754 $relationshipRows[$dao->contact_id_a
][$dao->contact_id_b
] = $row;
755 $relatedContactIds[$dao->contact_id_b
] = $dao->contact_id_b
;
757 if (in_array($dao->contact_id_b
, $contactIds)) {
758 $row['civicrm_relationship_contact_id'] = $dao->contact_id_a
;
759 $row['civicrm_relationship_relationship_type_id'] = $relationshipTypes[$dao->relationship_type_id
]['label_b_a'];
760 $relationshipRows[$dao->contact_id_b
][$dao->contact_id_a
] = $row;
761 $relatedContactIds[$dao->contact_id_a
] = $dao->contact_id_a
;
764 return [$relationshipRows, $relatedContactIds];
768 * Override "This Year" $op options
769 * @param string $type
770 * @param null $fieldName
774 public function getOperationPair($type = "string", $fieldName = NULL) {
775 if ($fieldName == 'this_year' ||
$fieldName == 'other_year') {
777 'calendar' => ts('Is Calendar Year'),
778 'fiscal' => ts('Fiscal Year Starting'),
781 return parent
::getOperationPair($type, $fieldName);
785 * Alter display of rows.
787 * Iterate through the rows retrieved via SQL and make changes for display purposes,
788 * such as rendering contacts as links.
791 * Rows generated by SQL, with an array for each row.
793 public function alterDisplay(&$rows) {
798 $last_primary = NULL;
799 foreach ($rows as $rowNum => $row) {
800 // Highlight primary contact and amount row
801 if (is_numeric($rowNum) ||
802 ($last_primary && ($rowNum == "{$last_primary}_total"))
804 if (is_numeric($rowNum)) {
805 $last_primary = $rowNum;
807 foreach ($row as $key => $value) {
808 if ($key == 'civicrm_contact_id') {
816 if ($last_primary && ($rowNum == "{$last_primary}_total")) {
817 $value = CRM_Utils_Money
::format($value, ' ');
819 $row[$key] = '<strong>' . $value . '</strong>';
821 $rows[$rowNum] = $row;
824 // Convert Display name into link
825 if (!empty($row['civicrm_contact_sort_name']) &&
826 !empty($row['civicrm_contact_id'])
828 $url = CRM_Report_Utils_Report
::getNextUrl('contribute/detail',
829 'reset=1&force=1&id_op=eq&id_value=' . $row['civicrm_contact_id'],
830 $this->_absoluteUrl
, $this->_id
832 $rows[$rowNum]['civicrm_contact_sort_name_link'] = $url;
833 $rows[$rowNum]['civicrm_contact_sort_name_hover'] = ts("View Contribution Details for this Contact.");
836 if (!empty($row['civicrm_financial_trxn_card_type_id'])) {
837 $rows[$rowNum]['civicrm_financial_trxn_card_type_id'] = $this->getLabels($row['civicrm_financial_trxn_card_type_id'], 'CRM_Financial_DAO_FinancialTrxn', 'card_type_id');
841 $entryFound = $this->alterDisplayContactFields($row, $rows, $rowNum, NULL, NULL) ?
TRUE : $entryFound;
842 $entryFound = $this->alterDisplayAddressFields($row, $rows, $rowNum, NULL, NULL) ?
TRUE : $entryFound;