- // Debugging related to possible missing membership linkage
- if ($contributionRecurID && $this->retrieve('membershipID', 'Integer', FALSE)) {
- $templateContribution = CRM_Contribute_BAO_ContributionRecur::getTemplateContribution($contributionRecurID);
- $membershipPayment = civicrm_api3('MembershipPayment', 'get', [
- 'contribution_id' => $templateContribution['id'],
- 'membership_id' => $membershipID,
- ]);
- $lineItems = civicrm_api3('LineItem', 'get', [
- 'contribution_id' => $templateContribution['id'],
- 'entity_id' => $membershipID,
- 'entity_table' => 'civicrm_membership',
- ]);
- Civi::log()->debug('PayPalIPN: Received payment for membership ' . (int) $membershipID
- . '. Original contribution was ' . (int) $contributionID . '. The template for this contribution is '
- . $templateContribution['id'] . ' it is linked to ' . $membershipPayment['count']
- . 'payments for this membership. It has ' . $lineItems['count'] . ' line items linked to this membership.'
- . ' it is expected the original contribution will be linked by both entities to the membership.'
- );
- if (empty($membershipPayment['count']) && empty($lineItems['count'])) {
- Civi::log()->debug('PayPalIPN: Will attempt to compensate');
- $input['membership_id'] = $this->retrieve('membershipID', 'Integer', FALSE);
- }
- if ($contributionRecurID) {
- $recurLinks = civicrm_api3('ContributionRecur', 'get', [
+ // Debugging related to possible missing membership linkage
+ if ($contributionRecurID && $this->retrieve('membershipID', 'Integer', FALSE)) {
+ $templateContribution = CRM_Contribute_BAO_ContributionRecur::getTemplateContribution($contributionRecurID);
+ $membershipPayment = civicrm_api3('MembershipPayment', 'get', [
+ 'contribution_id' => $templateContribution['id'],