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

Fix bug whereby cidZero does not prepopulate billing details for selected contact for pay later. #15565

Merged
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
7 changes: 1 addition & 6 deletions CRM/Contribute/Form/Contribution/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,13 +336,8 @@ public function buildQuickForm() {
$this->add('text', 'total_amount', ts('Total Amount'), ['readonly' => TRUE], FALSE);
}
$pps = [];
//@todo - this should be replaced by a check as to whether billing fields are set
$onlinePaymentProcessorEnabled = FALSE;
if (!empty($this->_paymentProcessors)) {
foreach ($this->_paymentProcessors as $key => $name) {
if ($name['billing_mode'] == 1) {
$onlinePaymentProcessorEnabled = TRUE;
}
$pps[$key] = $name['name'];
}
}
Expand All @@ -367,7 +362,7 @@ public function buildQuickForm() {

$contactID = $this->getContactID();
if ($this->getContactID() === 0) {
$this->addCidZeroOptions($onlinePaymentProcessorEnabled);
$this->addCidZeroOptions();
}

//build pledge block.
Expand Down
8 changes: 2 additions & 6 deletions CRM/Core/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -2248,10 +2248,8 @@ public function canUseAjaxContactLookups() {
* that small pieces of duplication are not being refactored into separate functions because their only shared parent
* is this form. Inserting a class FrontEndForm.php between the contribution & event & this class would allow functions like this
* and a dozen other small ones to be refactored into a shared parent with the reduction of much code duplication
*
* @param $onlinePaymentProcessorEnabled
*/
public function addCIDZeroOptions($onlinePaymentProcessorEnabled) {
public function addCIDZeroOptions() {
$this->assign('nocid', TRUE);
$profiles = [];
if ($this->_values['custom_pre_id']) {
Expand All @@ -2260,9 +2258,7 @@ public function addCIDZeroOptions($onlinePaymentProcessorEnabled) {
if ($this->_values['custom_post_id']) {
$profiles = array_merge($profiles, (array) $this->_values['custom_post_id']);
}
if ($onlinePaymentProcessorEnabled) {
$profiles[] = 'billing';
}
$profiles[] = 'billing';
if (!empty($this->_values)) {
$this->addAutoSelector($profiles);
}
Expand Down
6 changes: 1 addition & 5 deletions CRM/Event/Form/Registration/Register.php
Original file line number Diff line number Diff line change
Expand Up @@ -413,18 +413,14 @@ public function buildQuickForm() {
$pps = [];
//@todo this processor adding fn is another one duplicated on contribute - a shared
// common class would make this sort of thing extractable
$onlinePaymentProcessorEnabled = FALSE;
if (!empty($this->_paymentProcessors)) {
foreach ($this->_paymentProcessors as $key => $name) {
if ($name['billing_mode'] == 1) {
$onlinePaymentProcessorEnabled = TRUE;
}
$pps[$key] = $name['name'];
}
}
if ($this->getContactID() === 0 && !$this->_values['event']['is_multiple_registrations']) {
//@todo we are blocking for multiple registrations because we haven't tested
$this->addCIDZeroOptions($onlinePaymentProcessorEnabled);
$this->addCIDZeroOptions();
}
if (!empty($this->_values['event']['is_pay_later']) &&
($this->_allowConfirmation || (!$this->_requireApproval && !$this->_allowWaitlist))
Expand Down