-- CRM-14645, fixed notice error
authorPradeep Nayak <pradeep.nayak@webaccess.co.in>
Fri, 20 Jun 2014 11:07:34 +0000 (16:37 +0530)
committerPradeep Nayak <pradeep.nayak@webaccess.co.in>
Fri, 20 Jun 2014 11:07:34 +0000 (16:37 +0530)
----------------------------------------
* CRM-14645: Contribution is accepted even if Membership is not renewed.
  https://issues.civicrm.org/jira/browse/CRM-14645

CRM/Contribute/Form/Contribution/Main.php

index fa99274e3958afa703325a874506be7bf2ac052f..6dd1995c23a02f851692b2b757338cda29555d78 100644 (file)
@@ -819,13 +819,15 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
         foreach ($self->_values['fee'] as $fieldKey => $fieldValue) {
           if ($fieldValue['html_type'] != 'Text' && CRM_Utils_Array::value('price_' . $fieldKey, $fields)) {
             if (!is_array($fields['price_' . $fieldKey])) {
-              if (in_array($fieldValue['options'][$fields['price_' . $fieldKey]]['membership_type_id'], $currentMemberships)) {
-                $errors['price_' . $fieldKey] = ts($errorText, array( 1 => CRM_Member_PseudoConstant::membershipType($fieldValue['options'][$fields['price_' . $fieldKey]]['membership_type_id'])));
+              if (array_key_exists('membership_type_id', $fieldValue['options'][$fields['price_' . $fieldKey]]) 
+                && in_array($fieldValue['options'][$fields['price_' . $fieldKey]]['membership_type_id'], $currentMemberships)) {
+                $errors['price_' . $fieldKey] = ts($errorText, array(1 => CRM_Member_PseudoConstant::membershipType($fieldValue['options'][$fields['price_' . $fieldKey]]['membership_type_id'])));
               }
             }
             else {
               foreach ($fields['price_' . $fieldKey] as $key => $ignore) {
-                if (in_array($fieldValue['options'][$key]['membership_type_id'], $currentMemberships)) {
+                if (array_key_exists('membership_type_id', $fieldValue['options'][$key]) 
+                  && in_array($fieldValue['options'][$key]['membership_type_id'], $currentMemberships)) {
                   $errors['price_' . $fieldKey] = ts($errorText, array(1 => CRM_Member_PseudoConstant::membershipType($fieldValue['options'][$key]['membership_type_id'])));
                 }
               }