Skip to content

Commit

Permalink
Merge pull request #20790 from eileenmcnaughton/partor
Browse files Browse the repository at this point in the history
Handle participant payment create in line item
  • Loading branch information
eileenmcnaughton authored Jul 7, 2021
2 parents 3ac708c + b87dd88 commit 42ab5fa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 9 additions & 0 deletions CRM/Price/BAO/LineItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ public static function create(&$params) {
civicrm_api3('MembershipPayment', 'create', $membershipPaymentParams);
}
}
if ($lineItemBAO->entity_table === 'civicrm_participant' && $lineItemBAO->contribution_id && $lineItemBAO->entity_id) {
$participantPaymentParams = [
'participant_id' => $lineItemBAO->entity_id,
'contribution_id' => $lineItemBAO->contribution_id,
];
if (!civicrm_api3('ParticipantPayment', 'getcount', $participantPaymentParams)) {
civicrm_api3('ParticipantPayment', 'create', $participantPaymentParams);
}
}

if ($id) {
// CRM-21281: Restore entity reference in case the post hook needs it
Expand Down
4 changes: 0 additions & 4 deletions api/v3/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,6 @@ function civicrm_api3_order_create(array $params): array {
CRM_Core_Error::deprecatedWarning('This should be unreachable & tests show it is never tested.');
civicrm_api3('PledgePayment', 'create', $paymentParams);
}
if ($entity === 'participant') {
civicrm_api3('ParticipantPayment', 'create', $paymentParams);
}

}
}
return civicrm_api3_create_success($contribution['values'] ?? [], $params, 'Order', 'create');
Expand Down

0 comments on commit 42ab5fa

Please sign in to comment.