CRM-18071: free membership doesn't depend on is_monetary
authordeb.monish <monish.deb@webaccessglobal.com>
Wed, 15 Jun 2016 18:45:27 +0000 (00:15 +0530)
committerdeb.monish <monish.deb@webaccessglobal.com>
Thu, 16 Jun 2016 17:27:53 +0000 (22:57 +0530)
CRM/Contribute/BAO/Contribution/Utils.php
CRM/Contribute/Form/Contribution/Confirm.php

index 7415bd279796ba0181b530b1584e283264ba5948..3ef89a533aa0813ecb0590d4bcf19ce9d7c0d8f0 100644 (file)
@@ -89,8 +89,8 @@ class CRM_Contribute_BAO_Contribution_Utils {
     $form->assign('receive_date',
       CRM_Utils_Date::mysqlToIso($form->_params['receive_date'])
     );
-    if ($isPaymentTransaction) {
 
+    if ($isPaymentTransaction) {
       $contributionParams = array(
         'contact_id' => $contactID,
         'line_item' => $lineItems,
@@ -231,11 +231,7 @@ class CRM_Contribute_BAO_Contribution_Utils {
    * @return bool
    */
   static protected function isPaymentTransaction($form) {
-    if (!empty($form->_values['is_monetary']) && $form->_amount >= 0.0) {
-      return TRUE;
-    }
-    return FALSE;
-
+    return ($form->_amount >= 0.0) ? TRUE : FALSE;
   }
 
   /**
index b6ffa25239954ac5a2de800a4246e87c13115572..bb8ae0c4e2afe92153f081664b3c0b407b7674cf 100644 (file)
@@ -486,8 +486,8 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     // The concept of contributeMode is deprecated.
     // the is_monetary concept probably should be too as it can be calculated from
     // the existence of 'amount' & seems fragile.
-    if ($this->_contributeMode == 'notify' || !$this->_values['is_monetary'] ||
-      $this->_amount <= 0.0 || $this->_params['is_pay_later'] ||
+    if ($this->_contributeMode == 'notify' ||
+      $this->_amount < 0.0 || $this->_params['is_pay_later'] ||
       ($this->_separateMembershipPayment && $this->_amount <= 0.0)
     ) {
       $contribButton = ts('Continue');
@@ -1501,6 +1501,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
           $numTerms, $membershipID, $pending,
           $contributionRecurID, $membershipSource, $isPayLater, $campaignId
         );
+
         $form->set('renewal_mode', $renewalMode);
         if (!empty($dates)) {
           $form->assign('mem_start_date', CRM_Utils_Date::customFormat($dates['start_date'], '%Y%m%d'));
@@ -1591,7 +1592,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
       //CRM-18071, where on selecting $0 free membership payment section got hidden and
       // also it reset any payment processor selection result into pending free membership
       // so its a kind of hack to complete free membership at this point since there is no $form->_paymentProcessor info
-      if (empty($form->_params['is_pay_later']) && !empty($membershipContribution) && !is_a($membershipContribution, 'CRM_Core_Error')) {
+      if (!empty($membershipContribution) && !is_a($membershipContribution, 'CRM_Core_Error')) {
         $paymentProcessorIDs = explode(CRM_Core_DAO::VALUE_SEPARATOR, CRM_Utils_Array::value('payment_processor', $this->_values));
         if (empty($form->_paymentProcessor) && !empty($paymentProcessorIDs)) {
           $this->_paymentProcessor['id'] = $paymentProcessorIDs[0];