-
-
Notifications
You must be signed in to change notification settings - Fork 824
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
ensure recur options are present on backend cc contribution form. #21577
ensure recur options are present on backend cc contribution form. #21577
Conversation
(Standard links)
|
@jmcclelland I think maybe I think the whole point of the IF is to faciliate that early exit. (and we should add a bool type hint - true vs null is silly) |
Oh I see. I agree - that NULL should be FALSE in your snippet (and I can update my pull request to include that and a type hint). But I don't think it will solve the problem. It seems like Maybe my PR should keep For the record - Stripe does not get caught in the early return that you reference. It overrides |
@jmcclelland since this is the only place the return value is used I guess if it doesn't make sense for it to return anything if it's not helpful to this form. I think I'm OK with this then - @mattwire ? |
Thanks @jmcclelland this was on my list "to look at one day". We need to keep the call to It would be nice to iterate this further in future PRs to simplify the code further and work out why/where |
We seem to be adding an extra check to see if the given payment processor has any credit card fields before including the recur option on the backend contribution page. But some processors, like Stripe, insert the fields via javascript. It should be enough to just test for the existence of a payment processor that supports recur to run the block. Also, no other code is checking the return value of buildPaymentForm so removing it.
7249e48
to
3148d4c
Compare
Thanks for the feedback. I put the call to And I removed the return values from that function since they are not being used anywhere now. |
Thanks @jmcclelland |
Overview
CiviCRM seems to be adding an extra check to see if the given payment processor has any credit card fields before including the recur option on the backend contribution page. But some processors, like Stripe, insert the fields via javascript. It should be enough to just test for the existence of a payment processor that supports recur to run the block.
Before
When using the stripe payment processor via the backend, there is no option to set a recurring contribution.
After
After applying the patch, it appears:
Technical Details
Messing with this kind of code is somewhat terrying. And... I really don't know why this check was put there in the first place.
Also tagging @mattwire - as far as I can tell, the ability to add recurring contributions via the back end has not been possible for a while, but I'm honestly not sure. This discovery came up somewhat randomly for us.
Also, despite the complicated looking diff, the only non-white space change introduced is to remove this if clause:
if (CRM_Core_Payment_Form::buildPaymentForm($this, $this->_paymentProcessor, FALSE, TRUE, $this->payment_instrument_id) == TRUE)
Instead, we simply rely on
if (!empty($this->_recurPaymentProcessors)) {
to determine whether or not to include the recur block.