CRM-16259, get particiant id if contribution is related to event
authorPradeep Nayak <pradpnayak@gmail.com>
Wed, 20 Jan 2016 10:41:03 +0000 (16:11 +0530)
committerPradeep Nayak <pradpnayak@gmail.com>
Wed, 20 Jan 2016 10:41:03 +0000 (16:11 +0530)
----------------------------------------
* CRM-16259: Create Payment API
  https://issues.civicrm.org/jira/browse/CRM-16259

CRM/Contribute/BAO/Contribution.php

index 432585681b41f705bf99733f24d0bc61911a57a1..102bf1fce4c22a9a84d7c6898ca09573e4eb65eb 100644 (file)
@@ -3652,6 +3652,9 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
     $getInfoOf['id'] = $contributionId;
     $defaults = array();
     $contributionDAO = CRM_Contribute_BAO_Contribution::retrieve($getInfoOf, $defaults, CRM_Core_DAO::$_nullArray);
+    if (!$participantId) {
+      $participantId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $contributionId, 'participant_id');
+    }
 
     if ($paymentType == 'owed') {
       // build params for recording financial trxn entry