Minor fix: CRM-18282
authorWeb Access <rohan.katkar@webaccessglobal.com>
Fri, 1 Apr 2016 09:03:20 +0000 (14:33 +0530)
committerWeb Access <rohan.katkar@webaccessglobal.com>
Fri, 1 Apr 2016 11:45:30 +0000 (17:15 +0530)
minor fix

CRM/Contribute/Form/Contribution/Confirm.php

index d586bd039761e8d3e2c3f95c29cade5acfe5a54c..6450cf416ec6a0a93f33df5a4d863243927b9790 100644 (file)
@@ -1515,10 +1515,8 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
       }
       if ($form->_priceSetId && !empty($form->_useForMember) && !empty($form->_lineItem)) {
         foreach ($form->_lineItem[$form->_priceSetId] as & $priceFieldOp) {
-          if (!empty($priceFieldOp['membership_type_id']) &&
-            isset($membership[$priceFieldOp['membership_type_id']])
-          ) {
-            $membershipOb = $membership[$priceFieldOp['membership_type_id']];
+          if (!empty($priceFieldOp['membership_type_id']) && $membership->membership_type_id == $priceFieldOp['membership_type_id']) {
+            $membershipOb = $membership;
             $priceFieldOp['start_date'] = $membershipOb->start_date ? CRM_Utils_Date::customFormat($membershipOb->start_date, '%B %E%f, %Y') : '-';
             $priceFieldOp['end_date'] = $membershipOb->end_date ? CRM_Utils_Date::customFormat($membershipOb->end_date, '%B %E%f, %Y') : '-';
           }
@@ -1542,14 +1540,14 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     CRM_Core_BAO_CustomValueTable::postProcess($form->_params, 'civicrm_membership', $membership->id, 'Membership');
     $form->_params['createdMembershipIDs'][] = $membership->id;
 
-    if (count($membership) == 1) {
+    if ($membership) {
       //presumably this is only relevant for exactly 1 membership
       $form->_params['membershipID'] = $membership->id;
     }
 
     //CRM-15232: Check if membership is created and on the basis of it use
     //membership receipt template to send payment receipt
-    if (count($membership)) {
+    if ($membership) {
       $form->_values['isMembership'] = TRUE;
     }
     if (isset($membershipContributionID)) {