CRM-18118 fix
authordeb.monish <monish.deb@webaccessglobal.com>
Thu, 3 Mar 2016 19:22:04 +0000 (00:52 +0530)
committerdeb.monish <monish.deb@webaccessglobal.com>
Thu, 3 Mar 2016 19:22:04 +0000 (00:52 +0530)
CRM/Contribute/Form/Contribution/Main.php

index 7dd7574d28dd835d6225f36d0d26fc05cca37ba8..a358db803685cf471d6080551b8fb98c4be2f19f 100644 (file)
@@ -1024,14 +1024,15 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
               case 'membership_amount':
                 $this->_params['selectMembership'] = $params['selectMembership'] = CRM_Utils_Array::value('membership_type_id', $priceOptions[$selectedPriceOptionID]);
                 $this->set('selectMembership', $params['selectMembership']);
-                if (CRM_Utils_Array::value('is_separate_payment', $this->_membershipBlock) == 0) {
-                  $this->_values['amount'] = CRM_Utils_Array::value('amount', $priceOptions[$selectedPriceOptionID]);
-                }
-                break;
 
-              case 'contribution_amount':
+                case 'contribution_amount':
                 $params['amount'] = $selectedPriceOptionID;
-                $this->_values['amount'] = CRM_Utils_Array::value('amount', $priceOptions[$selectedPriceOptionID]);
+                if ($priceField->name == 'contribution_amount' ||
+                    ($priceField->name == 'membership_amount' &&
+                      CRM_Utils_Array::value('is_separate_payment', $this->_membershipBlock) == 0)
+                ) {
+                  $this->_values['amount'] = CRM_Utils_Array::value('amount', $priceOptions[$selectedPriceOptionID]);
+                }
                 $this->_values[$selectedPriceOptionID]['value'] = CRM_Utils_Array::value('amount', $priceOptions[$selectedPriceOptionID]);
                 $this->_values[$selectedPriceOptionID]['label'] = CRM_Utils_Array::value('label', $priceOptions[$selectedPriceOptionID]);
                 $this->_values[$selectedPriceOptionID]['amount_id'] = CRM_Utils_Array::value('id', $priceOptions[$selectedPriceOptionID]);
@@ -1048,7 +1049,6 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
     }
     // from here on down, $params['amount'] holds a monetary value (or null) rather than an option ID
     $params['amount'] = self::computeAmount($params, $this->_values);
-
     if (($this->_values['is_pay_later'] &&
         empty($this->_paymentProcessor) &&
         !array_key_exists('hidden_processor', $params)) ||