From 41f27e49967e0b4c0b20096840233e5baff37a2c Mon Sep 17 00:00:00 2001
From: Pradeep Nayak <pradeep@pradeep.(none)>
Date: Wed, 3 Apr 2013 16:10:32 +0530
Subject: [PATCH] -- added comments CRM-12233

---
 CRM/Contribute/Form/Contribution/Main.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php
index 892c1d8c31..c33904b337 100644
--- a/CRM/Contribute/Form/Contribution/Main.php
+++ b/CRM/Contribute/Form/Contribution/Main.php
@@ -816,6 +816,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
         && $self->_values['amount_block_is_active']) {
         $membershipFieldId = $contributionFieldId = $errorKey = $otherFieldId = NULL;
         foreach ($self->_values['fee'] as $fieldKey => $fieldValue) {
+          // if 'No thank you' membership is selected then set $membershipFieldId
           if ($fieldValue['name'] == 'membership_amount' && CRM_Utils_Array::value('price_' . $fieldKey, $fields) == 0) {
             $membershipFieldId = $fieldKey;
           }
@@ -832,7 +833,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
             }
           }
         }
-
+        // $membershipFieldId is set and additional amount is 'No thank you' or NULL then throw error
         if ($membershipFieldId && !(CRM_Utils_Array::value('price_' . $contributionFieldId, $fields, -1) > 0)
           && !CRM_Utils_Array::value('price_' . $otherFieldId, $fields)) {
           $errors["price_{$errorKey}"] = ts('Additional Contribution is required.');
-- 
GitLab