From 67c998f4c34d1a0043a1b7d103de67390c8e893f Mon Sep 17 00:00:00 2001 From: Jitendra Purohit Date: Tue, 11 Jul 2017 08:59:07 +0530 Subject: [PATCH] CRM-20834 - Drupal user not created via Profile due to missing email --- CRM/Contribute/Form/Contribution/Confirm.php | 8 ++++++++ CRM/Contribute/Form/ContributionBase.php | 2 ++ 2 files changed, 10 insertions(+) diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index 419f949129..85a9130faf 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -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']); diff --git a/CRM/Contribute/Form/ContributionBase.php b/CRM/Contribute/Form/ContributionBase.php index fe5b484c0d..cffecc784e 100644 --- a/CRM/Contribute/Form/ContributionBase.php +++ b/CRM/Contribute/Form/ContributionBase.php @@ -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); } } -- 2.25.1