CRM-15366 - Gift Membership Bug Fixes
authoratif-shaikh <shaikh388@gmail.com>
Wed, 24 Sep 2014 13:33:56 +0000 (19:03 +0530)
committeratif-shaikh <shaikh388@gmail.com>
Wed, 24 Sep 2014 13:33:56 +0000 (19:03 +0530)
https://issues.civicrm.org/jira/browse/CRM-15366

CRM/Contribute/Form/Contribution/Confirm.php
CRM/Member/Form/Membership.php
templates/CRM/Member/Form/Membership.tpl

index 0d23c3bbd6b031660fba92de1f4bef8136c71e85..f30d26b1d66cf0f5866e706d41c88d938874f188 100644 (file)
@@ -1182,7 +1182,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     // a better fix would be to set the values in the respective forms rather than require
     // a function being shared by two forms to deal with their respective values
     // moving it to the BAO & not taking the $form as a param would make sense here.
-    if(!isset($params['is_email_receipt'])){
+    if(!isset($params['is_email_receipt']) && !empty($form->_values['is_email_receipt'])){
       $params['is_email_receipt'] = CRM_Utils_Array::value( 'is_email_receipt', $form->_values );
     }
     $recurringContributionID = self::processRecurringContribution($form, $params, $contactID, $financialType, $online);
@@ -1271,8 +1271,12 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     }
 
     if (isset($params['amount'])) {
+      $isMonetary = NULL;
+      if (!empty($form->_values['is_monetary'])) {
+        $isMonetary = $form->_values['is_monetary'];
+      }
       $contribParams = self::getContributionParams(
-        $params, $contactID, $financialType->id, $online, $contributionPageId, $nonDeductibleAmount, $campaignId, $form->_values['is_monetary'], $pending, $result, $receiptDate,
+        $params, $contactID, $financialType->id, $online, $contributionPageId, $nonDeductibleAmount, $campaignId,  $isMonetary, $pending, $result, $receiptDate,
         $recurringContributionID, $isTest, $addressID, $contribSoftContactId, $lineItems
       );
       $contribution = CRM_Contribute_BAO_Contribution::add($contribParams);
@@ -1458,7 +1462,8 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
 
     // CRM-14354: For an auto-renewing membership with an additional contribution,
     // if separate payments is not enabled, make sure only the membership fee recurs
-    if ($form->_membershipBlock['is_separate_payment'] === '0'
+    if (!empty($form->_membershipBlock)
+      && $form->_membershipBlock['is_separate_payment'] === '0'
       && isset($params['selectMembership'])
       && $form->_values['is_allow_other_amount'] == '1'
     ) {
index c3df268fbc939ee7bb6cd0fde8b8808b453bceee..d3fea7053db4bd7c6963d404151582a7e6113791 100644 (file)
@@ -1525,6 +1525,10 @@ WHERE   id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )';
         }
 
         $membershipParams = array_merge($membershipTypeValues[$memType], $params);
+        //CRM-15320
+        if (!empty($softParams) && empty($paymentParams['is_recur'])) {
+          $membershipParams['soft_credit'] = $softParams;
+        }
         $membership = CRM_Member_BAO_Membership::create($membershipParams, $ids);
         $params['contribution'] = CRM_Utils_Array::value('contribution', $membershipParams);
         unset($params['lineItems']);
index bc88ff4c1a1de62d0f8342576e86772ca98cff76..defcaf90110e3ae3c4a3870c434a20b0d920001b 100644 (file)
             <td>
               <table class="compressed">
                 <tr class="crm-membership-form-block-soft-credit-type">
-                  <td class="label">{$form.soft_credit_type.label}</td>
-                  <td>{$form.soft_credit_type.html}</td>
+                  <td class="label">{$form.soft_credit_type_id.label}</td>
+                  <td>{$form.soft_credit_type_id.html}</td>
                 </tr>
                 <tr class="crm-membership-form-block-soft-credit-contact-id">
                   <td class="label">{$form.soft_credit_contact_id.label}</td>