diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index 54e82d0d368e..6f1828389d1f 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -1474,7 +1474,6 @@ public function submit($params) { } // Insert payment record for this participant - if (empty($ids['contribution'])) { foreach ($this->_contactIds as $num => $contactID) { $participantPaymentParams = [ 'participant_id' => $participants[$num]->id, @@ -1482,7 +1481,6 @@ public function submit($params) { ]; civicrm_api3('ParticipantPayment', 'create', $participantPaymentParams); } - } // CRM-11124 if ($this->_params['discount_id']) { diff --git a/CRM/Event/Form/Registration.php b/CRM/Event/Form/Registration.php index d12d4ed4cd1a..239e2023bc27 100644 --- a/CRM/Event/Form/Registration.php +++ b/CRM/Event/Form/Registration.php @@ -731,24 +731,19 @@ public function confirmPostProcess($contactID = NULL, $contribution = NULL) { 'Participant' ); - $createPayment = (CRM_Utils_Array::value('amount', $this->_params, 0) != 0) ? TRUE : FALSE; - - // force to create zero amount payment, CRM-5095 - // we know the amout is zero since createPayment is false - if (!$createPayment && - (isset($contribution) && $contribution->id) && - $this->_priceSetId && - $this->_lineItem - ) { - $createPayment = TRUE; + if ($contribution) { + $contributionID = $contribution->id; + } + elseif (CRM_Utils_Array::value('contributionID', $this->_params)) { + $contributionID = $this->_params['contributionID']; } - if ($createPayment && $this->_values['event']['is_monetary'] && !empty($this->_params['contributionID'])) { - $paymentParams = [ + if (!empty($contributionID)) { + $participantPaymentParams = [ 'participant_id' => $participant->id, - 'contribution_id' => $contribution->id, + 'contribution_id' => $contributionID, ]; - civicrm_api3('ParticipantPayment', 'create', $paymentParams); + civicrm_api3('ParticipantPayment', 'create', $participantPaymentParams); } $this->assign('action', $this->_action);