CRM-15735 Update payment status for pay-later membership renewal ignores Received...
authorjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Fri, 26 Dec 2014 11:37:55 +0000 (17:07 +0530)
committerjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Fri, 26 Dec 2014 11:37:55 +0000 (17:07 +0530)
CRM/Contribute/BAO/Contribution.php

index 8b08f86d7182e7dbf9cee3938691d35d2c459de0..70d0fa4f4e79819a7566fa90e7fdf27825f997d5 100644 (file)
@@ -1599,6 +1599,20 @@ LEFT JOIN  civicrm_contribution contribution ON ( componentPayment.contribution_
               }
             }
 
+            // CRM-15735-to update the membership status as per the contribution receive date
+            if (!empty($params['receive_date'])) {
+              $status = CRM_Member_BAO_MembershipStatus::getMembershipStatusByDate($membership->start_date,
+                $membership->end_date,
+                $membership->join_date,
+                $params['receive_date'],
+                FALSE,
+                $membership->membership_type_id,
+                (array) $membership
+              );
+              $membership->status_id = CRM_Utils_Array::value('id', $status, $membership->status_id);
+              $membership->save();
+            }
+
             if ($currentMembership) {
               CRM_Member_BAO_Membership::fixMembershipStatusBeforeRenew($currentMembership, NULL);
               $dates = CRM_Member_BAO_MembershipType::getRenewalDatesForMembershipType($membership->id, NULL, NULL, $numterms);