CRM-12306 - only save ->values['is_email_receipt'] to ['is_email_receipt'] if not...
authoreileen <eileen@fuzion.co.nz>
Tue, 9 Apr 2013 07:28:51 +0000 (19:28 +1200)
committereileen <eileen@fuzion.co.nz>
Tue, 9 Apr 2013 07:47:11 +0000 (19:47 +1200)
CRM/Contribute/Form/Contribution/Confirm.php

index 6d2f76c4b1d741289f1e4c823b149611e5817ffd..ca96a812fd02c53f37f3b1508a082237c7df77b8 100644 (file)
@@ -919,7 +919,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
             }
           }
         }
-        
+
         CRM_Member_BAO_Membership::postProcessMembership($membershipParams, $contactID,
           $this, $premiumParams, $customFieldsFormatted,
           $fieldTypes
@@ -1100,8 +1100,15 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
 
     // add these values for the recurringContrib function ,CRM-10188
     $params['financial_type_id'] = $contributionType->id;
-    $params['is_email_receipt'] = CRM_Utils_Array::value( 'is_email_receipt', $form->_values );
-
+    //@todo - this is being set from the form to resolve CRM-10188 - an
+    // eNotice caused by it not being set @ the front end
+    // however, we then get it being over-written with null for backend contributions
+    // 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'])){
+      $params['is_email_receipt'] = CRM_Utils_Array::value( 'is_email_receipt', $form->_values );
+    }
     $recurringContributionID = self::processRecurringContribution($form, $params, $contactID, $contributionType, $online);
 
     if (!$online && isset($params['honor_contact_id'])) {