2

Currently using CiviCRM 5.3.2 and drupal 7.60

Receipts for events paid via PayPal have extra information related to contribution.

To reproduce issue:

  1. Add custom fields of your choice for Contributions
  2. Create a paid event and assign PayPal Standard payment processor.
  3. Enable online registration for the event and set Send Confirmation Email to Yes.
  4. Register a participant for the event.
  5. Check the receipt received and see if you get Contribution related custom fields in the email.

Anyone is facing this issue? May be with other payment processor?

1 Answer 1

3

After debugging I found that the code which generated the message values for contribution was also getting executed for Events. We just added a condition to check if its Contribution in CRM/Contribute/BAO/Contribution.php.

if ($this->_component == 'contribute') {
      $groupTree = CRM_Core_BAO_CustomGroup::getTree('Contribution', NULL, $this->id);

  $customGroup = array();
  foreach ($groupTree as $key => $group) {
    if ($key === 'info') {
      continue;
    }

    foreach ($group['fields'] as $k => $customField) {
      $groupLabel = $group['title'];
      if (!empty($customField['customValue'])) {
        foreach ($customField['customValue'] as $customFieldValues) {
          $customGroup[$groupLabel][$customField['label']] = CRM_Utils_Array::value('data', $customFieldValues);
        }
      }
    }
  }
  $values['customGroup'] = $customGroup;
}

Do we need to clean up this code? or anyone have any thoughts so we can add issues on Lab and raise PR for same

1
  • We had this exact same problem. This seems like a more elegant solution than we implemented, so it would be great to put in a GitLab issue where this can be discussed further =]
    – John
    Commented Nov 19, 2018 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.