From 21d62de709f9e47800256c2f820ae36a9d5ea3e9 Mon Sep 17 00:00:00 2001 From: Dave Greenberg Date: Mon, 11 Nov 2013 12:11:28 -0800 Subject: [PATCH] CRM-13720 - Add address fields to TopDonor report. Using getAddressColumns() instead of deprecated addAddressFields. Fixed notice in line 234 due to type not always set in $field array. ---------------------------------------- * CRM-13720: Add address fields to Top Donors report http://issues.civicrm.org/jira/browse/CRM-13720 --- CRM/Report/Form/Contribute/TopDonor.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CRM/Report/Form/Contribute/TopDonor.php b/CRM/Report/Form/Contribute/TopDonor.php index 6d287134d1..cee3ad4f8f 100644 --- a/CRM/Report/Form/Contribute/TopDonor.php +++ b/CRM/Report/Form/Contribute/TopDonor.php @@ -78,6 +78,9 @@ class CRM_Report_Form_Contribute_TopDonor extends CRM_Report_Form { ), ), ), + ) + + $this->getAddressColumns() + + array( 'civicrm_contribution' => array( 'dao' => 'CRM_Contribute_DAO_Contribution', @@ -227,13 +230,15 @@ class CRM_Report_Form_Contribute_TopDonor extends CRM_Report_Form { } else { $select[] = "{$field['dbAlias']} as {$tableName}_{$fieldName}"; - $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = $field['type']; + // $field['type'] is not always set. Use string type as default if not set. + $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = isset($field['type']) ? $field['type'] : 2; $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $field['title']; } } } } } + $this->_select = " SELECT * FROM ( SELECT " . implode(', ', $select) . " "; } @@ -266,6 +271,7 @@ class CRM_Report_Form_Contribute_TopDonor extends CRM_Report_Form { ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_phone']}.contact_id AND {$this->_aliases['civicrm_phone']}.is_primary = 1 "; + $this->addAddressFromClause(); } function where() { @@ -438,6 +444,7 @@ ORDER BY civicrm_contribution_total_amount_sum DESC $rows[$rowNum]['civicrm_contact_display_name_link'] = $url; $entryFound = TRUE; } + $entryFound = $this->alterDisplayAddressFields($row, $rows, $rowNum, 'contribute/detail', 'List all contribution(s)') ? TRUE : $entryFound; // skip looking further in rows, if first row itself doesn't // have the column we need -- 2.25.1