From: root Date: Wed, 8 Jun 2016 12:26:22 +0000 (+0530) Subject: CRM-18688: Cancel IPN cancels entire membership X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=55a32ea04b53622363720164e38ca0571427550b;p=civicrm-core.git CRM-18688: Cancel IPN cancels entire membership --- diff --git a/CRM/Core/Payment/BaseIPN.php b/CRM/Core/Payment/BaseIPN.php index f8cba5dadf..8bbbd788cb 100644 --- a/CRM/Core/Payment/BaseIPN.php +++ b/CRM/Core/Payment/BaseIPN.php @@ -328,8 +328,15 @@ class CRM_Core_Payment_BaseIPN { 'labelColumn' => 'name', 'flip' => 1, )); + // Prevent active memberships from being cancelled + // CRM-18688 + $activeStatuses = array( + $membershipStatuses['New'], + $membershipStatuses['Current'], + $membershipStatuses['Grace'], + ); foreach ($memberships as $membership) { - if ($membership) { + if ($membership && !in_array($membership->status_id, $activeStatuses)) { $membership->status_id = $membershipStatuses['Cancelled']; $membership->save();