I have extended the functionality in the CRM_Report_Form_Extended class because my customer wanted address details for the honor_contact.
I haven't assumed that everyone else would want this but here is what a patch looks like leveraging this (note that the address fields provided this way have 'click through filter' on state, country & county)
Index: ContributionDetail.php
===================================================================
— ContributionDetail.php (revision 40681)
+++ ContributionDetail.php (working copy)
@@ -34,7 +34,7 @@
- $Id$
*
*/
-class CRM_Report_Form_Member_ContributionDetail extends CRM_Report_Form {
+class CRM_Report_Form_Member_ContributionDetail extends CRM_Report_Form_Extended {
protected $_addressField = FALSE;
protected $_emailField = FALSE;
@@ -131,15 +131,15 @@
),
'grouping' => 'contact-fields',
),
- 'civicrm_contact_honor' =>
- array(
- 'dao' => 'CRM_Contact_DAO_Contact',
+ 'honor_civicrm_contact' =>
+ array('dao' => 'CRM_Contact_DAO_Contact',
+ 'alias' => 'honor_civicrm_contact',
+ 'name' => 'civicrm_contact',
'fields' =>
array(
'sort_name_honor' =>
array('title' => ts('Honoree Name'),
'name' => 'sort_name',
- 'alias' => 'contacthonor',
'default' => FALSE,
'no_repeat' => TRUE,
),
@@ -148,7 +148,6 @@
'no_display' => TRUE,
'title' => ts('Honoree ID'),
'name' => 'id',
- 'alias' => 'contacthonor',
'required' => TRUE,
),
),
@@ -421,7 +420,12 @@
),
),
),
- ) + $this->addAddressFields(FALSE);
+ ) + $this->addAddressFields(FALSE)
+ + $this->getAddressColumns(array(
+ 'prefix' => 'honor_',
+ 'prefix_label' => 'Honoree ',
+ )
+ );;
$this->_tagFilter = TRUE;
@@ -608,8 +612,8 @@
// include Honor name field
if ($this->_nameFieldHonor) {
$this->_from .= "
- LEFT JOIN civicrm_contact contacthonor
- ON contacthonor.id = {$this->_aliases['civicrm_contribution']}.honor_contact_id";
+ LEFT JOIN civicrm_contact {$this->_aliases['honor_civicrm_contact']}
+ ON {$this->_aliases['honor_civicrm_contact']}.id = {$this->_aliases['civicrm_contribution']}.honor_contact_id";
}
// include Honor email field
@@ -619,6 +623,7 @@
ON emailhonor.contact_id = {$this->_aliases['civicrm_contribution']}.honor_contact_id
AND emailhonor.is_primary = 1\n";
}
+ $this->joinAddressFromContact('honor_');
}
function groupBy() {
I have extended the functionality in the CRM_Report_Form_Extended class because my customer wanted address details for the honor_contact.
I haven't assumed that everyone else would want this but here is what a patch looks like leveraging this (note that the address fields provided this way have 'click through filter' on state, country & county)
Index: ContributionDetail.php
===================================================================
— ContributionDetail.php (revision 40681)
+++ ContributionDetail.php (working copy)
@@ -34,7 +34,7 @@
*
*/
-class CRM_Report_Form_Member_ContributionDetail extends CRM_Report_Form {
+class CRM_Report_Form_Member_ContributionDetail extends CRM_Report_Form_Extended {
protected $_addressField = FALSE;
protected $_emailField = FALSE;
@@ -131,15 +131,15 @@
),
'grouping' => 'contact-fields',
),
+ 'honor_civicrm_contact' =>
+ array('dao' => 'CRM_Contact_DAO_Contact',
+ 'alias' => 'honor_civicrm_contact',
+ 'name' => 'civicrm_contact',
'fields' =>
array(
'sort_name_honor' =>
array('title' => ts('Honoree Name'),
'name' => 'sort_name',
'default' => FALSE,
'no_repeat' => TRUE,
),
@@ -148,7 +148,6 @@
'no_display' => TRUE,
'title' => ts('Honoree ID'),
'name' => 'id',
'required' => TRUE,
),
),
@@ -421,7 +420,12 @@
),
),
),
+ ) + $this->addAddressFields(FALSE)
+ + $this->getAddressColumns(array(
+ 'prefix' => 'honor_',
+ 'prefix_label' => 'Honoree ',
+ )
+ );;
$this->_tagFilter = TRUE;
@@ -608,8 +612,8 @@
// include Honor name field
if ($this->_nameFieldHonor) {
$this->_from .= "
+ LEFT JOIN civicrm_contact {$this->_aliases['honor_civicrm_contact']}
+ ON {$this->_aliases['honor_civicrm_contact']}.id = {$this->_aliases['civicrm_contribution']}.honor_contact_id";
}
// include Honor email field
@@ -619,6 +623,7 @@
ON emailhonor.contact_id = {$this->_aliases['civicrm_contribution']}.honor_contact_id
AND emailhonor.is_primary = 1\n";
}
+ $this->joinAddressFromContact('honor_');
}
function groupBy() {