Answers.Body: <p>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 <code>CRM/Contribute/BAO/Contribution.php</code>.</p>
  
  <pre><code>if ($this-&gt;_component == 'contribute') {
        $groupTree = CRM_Core_BAO_CustomGroup::getTree('Contribution', NULL, $this-&gt;id);
  
    $customGroup = array();
    foreach ($groupTree as $key =&gt; $group) {
      if ($key === 'info') {
        continue;
      }
  
      foreach ($group['fields'] as $k =&gt; $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;
  }
  </code></pre>
  
  <p>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</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-19T14:35:34.683Z
Answers.Text: 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 =]
Answers.UserDisplayName: John
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-08T07:23:28.520Z
Answers.LastActivityDate: 2018-11-08T07:23:28.520Z
Answers.UserDisplayName: madhavi malgaonkar
Body: <p>Currently using CiviCRM 5.3.2 and drupal 7.60</p>
  
  <p>Receipts for events paid via PayPal have extra information related to contribution.</p>
  
  <p><strong>To reproduce issue:</strong></p>
  
  <ol>
  <li>Add custom fields of your choice for Contributions</li>
  <li>Create a paid event and assign <code>PayPal Standard</code> payment processor.</li>
  <li>Enable online registration for the event and set <code>Send Confirmation Email</code> to <code>Yes</code>.</li>
  <li>Register a participant for the event.</li>
  <li>Check the receipt received and see if you get Contribution related custom fields in the email.</li>
  </ol>
  
  <p>Anyone is facing this issue? May be with other payment processor?</p>
  
Tags: <civievent><civicontribute>
Title: Event receipts for paid events contains extraneous information
ThreadText: # Event receipts for paid events contains extraneous information
  
  (Asked by: username_0 on 2018-11-08)
  
  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?
  
  **Tags:** civievent, civicontribute
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-11-08. Score: 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
  
  > **Comments:**
  > **username_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 =]  
  
  ---
  
  