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

CRM-20949 - Fix payment processor assignment #10734

Merged
merged 1 commit into from
Aug 30, 2017

Conversation

jitendrapurohit
Copy link
Contributor

@jitendrapurohit jitendrapurohit commented Jul 24, 2017

@@ -368,7 +368,7 @@ public function assignProcessors() {

// this required to show billing block
// @todo remove this assignment the billing block is now designed to be always included but will not show fieldsets unless those sets of fields are assigned
$this->assign_by_ref('paymentProcessor', $processor);
$this->assign_by_ref('paymentProcessor', $this->_paymentProcessor);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$processor is the variable that iterates in the foreach loop written above and assigns the last iterated value to the paymentProcessor var. $this->_paymentProcessor holds the correct value that needs to be assigned.

@eileenmcnaughton
Copy link
Contributor

@jitendrapurohit does the $mode parameter affect this - in theory it should be pay_later processor if mode is not set

@jitendrapurohit
Copy link
Contributor Author

The handling for $mode not set is already done above the for loop. So I guess what we get in $this->_paymentProcessor at the end of this function is a correctly calculated value.

@eileenmcnaughton
Copy link
Contributor

@jitendrapurohit I just looked at this again - does this have any symptoms other than an incorrect assignment? I ask because the todo says to remove those lines.

I will merge this as I agree it is more correct, & if the code is going to stay we should make it right. But I'd prefer to understand why it is an issue.

@eileenmcnaughton eileenmcnaughton merged commit 4782a39 into civicrm:master Aug 30, 2017
@eileenmcnaughton
Copy link
Contributor

(I would also note there are other tangental bugs to getting this more correct may help with them)

@jitendrapurohit
Copy link
Contributor Author

Thanks @eileenmcnaughton - I recall we had the overridden copy of BillingBlock.tpl where the usage of $paymentProcessor worked correctly. It failed due to this inaccurate assignment.

With the removal of this line - I don't see $paymentProcessor var to be available on offline New Contribution or New Credit Card Contribution forms which may affect any external tpl files using this variable.

@eileenmcnaughton
Copy link
Contributor

Ok - that's a marginal reason for keeping the line - overridden tpls is not something core needs to be worry about & we actively discourage people from doing that.

Having said that I think we can let this drop for now. I'm happy that the merge was at least more correct in than out.

@jitendrapurohit jitendrapurohit deleted the CRM-20949 branch August 30, 2017 08:38
@jitendrapurohit
Copy link
Contributor Author

+1 for the first statement. I just fixed as the assignment looked wrong to me in the code. But the above explanation might contradict the requirement of this PR - #10757. Feel free to close if it doesn't make any sense to you. I might find a different way to obtain that result ;-).

@eileenmcnaughton
Copy link
Contributor

That PR is already merged & yeah - it's a bit grey - because while I don't particularly support tpl overrides you could equally be using that data in a hook (supported).

The bottom line is if you may an obscure core change to support an extension usage & want it to not break then unit tests are your friend

@petednz
Copy link

petednz commented Sep 6, 2017

@jitendrapurohit pinged me to say this had been applied on a site where having a non-credit card set as default results in Direct Debit fields showing on a Pledge, even though a CC processor shows in the selector.
As far as I can see this has made no difference to the site in question. I still get Direct Debit fields.
Am going to resolve issue for that client but setting no default processor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants