Skip to content

Commit

Permalink
Use a more robust method to check if we've already created a membersh…
Browse files Browse the repository at this point in the history
…ip payment
  • Loading branch information
mattwire committed Jul 28, 2019
1 parent c9cc6e3 commit dedbf76
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions CRM/Member/BAO/Membership.php
Original file line number Diff line number Diff line change
Expand Up @@ -2492,8 +2492,11 @@ public static function recordMembershipContribution(&$params, $ids = array()) {
// store contribution id
$params['contribution_id'] = $contribution->id;

//insert payment record for this membership
if (empty($ids['contribution']) || !empty($params['is_recur'])) {
// Create membership payment if it does not already exist
$membershipPayment = civicrm_api3('MembershipPayment', 'get', [
'contribution_id' => $contribution->id,
]);
if (empty($membershipPayment['count'])) {
civicrm_api3('MembershipPayment', 'create', [
'membership_id' => $membershipId,
'contribution_id' => $contribution->id,
Expand Down

0 comments on commit dedbf76

Please sign in to comment.