Skip to content

Commit

Permalink
Merge pull request civicrm#16458 from twomice/1573_extra_columns_cont…
Browse files Browse the repository at this point in the history
…ribution_detail_report

Fix for #1573: Extra columns for Contribution Detail report.
  • Loading branch information
eileenmcnaughton authored Feb 5, 2020
2 parents 013b831 + 1754f22 commit 3f4b536
Show file tree
Hide file tree
Showing 3 changed files with 283 additions and 252 deletions.
30 changes: 28 additions & 2 deletions CRM/Report/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -2548,6 +2548,23 @@ protected function alterContactID($value, &$row, $fieldname) {
return $value;
}

/**
* @param $value
* @param $row
* @param $fieldname
*
* @return mixed
*/
protected function alterCommunicationtMethod($value, &$row, $fieldname) {
$communicationMethods = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'preferred_communication_method');

// Explode padded values.
$values = CRM_utils_array::explodePadded($value);
// Flip values, compute intersection with $communicationMethods, and implode with commas.
$value = implode(', ', array_intersect_key($communicationMethods, array_flip($values)));
return $value;
}

/**
* @param $value
*
Expand Down Expand Up @@ -5463,6 +5480,15 @@ protected function getContactColumns($options = []) {
'is_group_bys' => TRUE,
'is_order_bys' => TRUE,
],
$options['prefix'] . 'preferred_communication_method' => [
'title' => $options['prefix_label'] . ts('Preferred Communication Method'),
'alter_display' => 'alterCommunicationtMethod',
'name' => 'preferred_communication_method',
'is_fields' => TRUE,
'is_filters' => FALSE,
'is_group_bys' => FALSE,
'is_order_bys' => FALSE,
],
];
foreach ([
'postal_greeting_display' => 'Postal Greeting',
Expand Down Expand Up @@ -5697,7 +5723,7 @@ protected function getAddressColumns($options = []) {
$options['prefix'] . 'postal_code' => [
'title' => $options['prefix_label'] . ts('Postal Code'),
'name' => 'postal_code',
'type' => 1,
'type' => 2,
'is_fields' => TRUE,
'is_filters' => TRUE,
'is_group_bys' => TRUE,
Expand All @@ -5706,7 +5732,7 @@ protected function getAddressColumns($options = []) {
$options['prefix'] . 'postal_code_suffix' => [
'title' => $options['prefix_label'] . ts('Postal Code Suffix'),
'name' => 'postal_code_suffix',
'type' => 1,
'type' => 2,
'is_fields' => TRUE,
'is_filters' => TRUE,
'is_group_bys' => TRUE,
Expand Down
Loading

0 comments on commit 3f4b536

Please sign in to comment.