Skip to content

Commit

Permalink
Fix for #1573: Extra columns for Contribution Detail report.
Browse files Browse the repository at this point in the history
  • Loading branch information
twomice committed Feb 3, 2020
1 parent fd4987d commit 74b8bdf
Show file tree
Hide file tree
Showing 2 changed files with 278 additions and 247 deletions.
26 changes: 26 additions & 0 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
Loading

0 comments on commit 74b8bdf

Please sign in to comment.