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 ContributionRecur.payment_processor_id pseudoconstant #22750

Merged
merged 1 commit into from
Feb 11, 2022

Conversation

colemanw
Copy link
Member

@colemanw colemanw commented Feb 10, 2022

Overview

Fixes several bugs introduced by #13698 which are causing a test failure in #22740.

Before

  • Pseudoconstant mistakenly uses 'name' instead of 'title' for the labelColumn
  • Bad caching in ContributionRecur::buildOptions causes incorrect output
  • Unit test was locking in the incorrect behavior

After

Name and title are treated correctly, test updated.

Comments

This solves the blatant bugs in #13698 however I think we should discuss with @mattwire and @eileenmcnaughton the bigger picture here. I'm concerned that the design of #13698 seems like an incomplete workaround to a deeper problem of how to tell the difference between live & test processors. Appending _test when fetching options seems incomplete because:

  1. There is more than one entity in the schema with a payment_processor_id field and Add pseudoconstant support for payment_processor_id on ContributionRecur #13698 only applies to one of them.
  2. In general we are trying to get away from duplicating FKs and Pseudoconstants on the same field, preferring just one or the other. If the PR to add the pseudoconstant was put up today I wouldn't have merged it on those grounds.
  3. It seems to me that a more stable solution would involve adding a unique index on the name column of the PaymentProcessor entity, and forcing unique names by appending _test to test processors when they are created.

@civibot
Copy link

civibot bot commented Feb 10, 2022

(Standard links)

@colemanw
Copy link
Member Author

Test failure looks unrelated. Retest this please.

@colemanw colemanw changed the base branch from master to 5.47 February 11, 2022 00:33
@civibot civibot bot added 5.47 and removed master labels Feb 11, 2022
Before: Pseudoconstant mistakenly uses 'name' instead of title
After: Name and title are treated correctly
@colemanw colemanw force-pushed the fixProcessorPseudoconstant branch from 1ebc909 to 202723a Compare February 11, 2022 00:36
@totten
Copy link
Member

totten commented Feb 11, 2022

Chatted a bit with @eileenmcnaughton and we both agreed the change to TokenConsistencyTest.php was appropriate (ie the old test value was a reflection of buggy behavior). All the other changes also look individually reasonable.

Given that Coleman+Eileen are both +1 for this on the RC, and that this is wrapped-up with the regression-fix for https://lab.civicrm.org/dev/core/-/issues/3063 -- and that we want to maximize exposure during RC period -- I'm inclined to say merge on pass.

... I think we should discuss with @mattwire and @eileenmcnaughton the bigger picture here. I'm concerned that the design of #13698 seems like an incomplete workaround to a deeper problem...

Is there any reason that discussion should be regarded as a blocker for this PR? Would it work just as well as a separate Gitlab issue?

@colemanw
Copy link
Member Author

@totten no, further discussion is not a blocker to merging this.

@totten totten merged commit 3e47681 into civicrm:5.47 Feb 11, 2022
@totten totten deleted the fixProcessorPseudoconstant branch February 11, 2022 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants