CRM-20834 - Drupal user not created via Profile due to missing email
authorJitendra Purohit <jitendra@fuzion.co.nz>
Tue, 11 Jul 2017 03:29:07 +0000 (08:59 +0530)
committerJitendra Purohit <jitendra@fuzion.co.nz>
Tue, 11 Jul 2017 03:29:07 +0000 (08:59 +0530)
CRM/Contribute/Form/Contribution/Confirm.php
CRM/Contribute/Form/ContributionBase.php

index 419f9491293857010fbb618a149cb6742d2a707e..85a9130faf3bd20d71706fde80b307c03fa51db6 100644 (file)
@@ -2046,6 +2046,14 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     if (!empty($this->_ccid)) {
       $this->_params['contribution_id'] = $this->_ccid;
     }
+    //Set email-bltID if pre/post profile contains an email.
+    if ($this->_emailExists == TRUE) {
+      foreach ($this->_params as $key => $val) {
+        if (substr($key, 0, 6) == 'email-' && empty($this->_params["email-{$this->_bltID}"])) {
+          $this->_params["email-{$this->_bltID}"] = $this->_params[$key];
+        }
+      }
+    }
     // add a description field at the very beginning
     $this->_params['description'] = ts('Online Contribution') . ': ' . (($this->_pcpInfo['title']) ? $this->_pcpInfo['title'] : $this->_values['title']);
 
index fe5b484c0d79bf8622de11bd0f5853a7bc2ca430..cffecc784e3684b527e326a3468eb5b1018930d1 100644 (file)
@@ -227,6 +227,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form {
       // lets just bump this to a regular session error and redirect user to main page
       $this->controller->invalidKeyRedirect();
     }
+    $this->_emailExists = $this->get('emailExists');
 
     // this was used prior to the cleverer this_>getContactID - unsure now
     $this->_userID = CRM_Core_Session::singleton()->getLoggedInContactID();
@@ -652,6 +653,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form {
               !in_array($profileContactType, array('honor', 'onbehalf'))
           ) {
             $this->_emailExists = TRUE;
+            $this->set('emailExists', TRUE);
           }
         }