Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/core#1255 - fix display of email address on pay later contribution #15314

Merged
merged 2 commits into from
Jan 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions CRM/Contribute/Form/ContributionBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -576,17 +576,33 @@ public function assignToTemplate() {
$this->assign('onBehalfEmail', $this->_params['onbehalf_location']['email'][$locTypeId[0]]['email']);
}
$this->assignPaymentFields();

$this->assign('email',
$this->controller->exportValue('Main', "email-{$this->_bltID}")
);
$this->assignEmailField();

// also assign the receipt_text
if (isset($this->_values['receipt_text'])) {
$this->assign('receipt_text', $this->_values['receipt_text']);
}
}

/**
* Assign email variable in the template.
*/
public function assignEmailField() {
//If email exist in a profile, the default billing email field is not loaded on the page.
//Hence, assign the existing location type email by iterating through the params.
if ($this->_emailExists && empty($this->_params["email-{$this->_bltID}"])) {
foreach ($this->_params as $key => $val) {
if (substr($key, 0, 6) == 'email-') {
$this->assign('email', $this->_params[$key]);
break;
}
}
}
else {
$this->assign('email', CRM_Utils_Array::value("email-{$this->_bltID}", $this->_params));
}
}

/**
* Add the custom fields.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,11 @@ private function getThankYouFormWithContribution($paymentProcessorID, $withPendi
$pageContribution = $this->getPageContribution((($withPendingContribution) ? 2 : 1), $isTestContribution);
$form = $this->getThankYouForm();
$form->_lineItem = [];
$form->_bltID = 5;

$form->_params['contributionID'] = $pageContribution['contribution_id'];
$form->_params['invoiceID'] = $pageContribution['invoice_id'];
$form->_params['email-5'] = 'demo@example.com';
$form->_params['payment_processor_id'] = $paymentProcessorID;
if ($isTestContribution) {
$form->_mode = 'test';
Expand Down