Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #1573: Extra columns for Contribution Detail report. #16458

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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