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

Use saved contribution's line items rather than the primaryContributionID #18033

Merged
merged 1 commit into from
Aug 3, 2020

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Aug 1, 2020

Overview

Simplifies the completeOrder function by not using 2 methods to calculate which contribution to get the membership number of terms from

Before

$lineItems either already exists or were created in repeattrransaction and have the num_terms parameter. However, we ignore & calculate num_terms separately

After

We no longer use 2 calculations

Technical Details

By the time we reach this point in the code we know that

  1. the contributon exists and it has an id
  2. it has line items - either those created in it's pending stage or those calculated in repeattransaction

Therefore we can reasonably assume these line items are accurate now and use them, rather than the confusing
primaryContributionID that we have doubts about the validity of

Comments

@mattwire - I need to check that there is relevant & specific test cover - but I think removing the second usage of primaryContributionID might actually be this simple

@civibot
Copy link

civibot bot commented Aug 1, 2020

(Standard links)

@civibot civibot bot added the master label Aug 1, 2020
@eileenmcnaughton eileenmcnaughton force-pushed the cont_id branch 2 times, most recently from 5c3e5ab to eeb60d6 Compare August 2, 2020 03:01
@eileenmcnaughton
Copy link
Contributor Author

So this passed - I found that on the completetransaction side it is clearly tested (I added a comment to the relevant test)

@eileenmcnaughton
Copy link
Contributor Author

There was no test cover on this for repeattransaction - I added

@eileenmcnaughton
Copy link
Contributor Author

test this please

…onID

By the time we reach this point in the code we know that
1) the contributon exists and it has an id
2) it has line items  - either those created in it's pending stage or those calculated in repeattransaction

Therefore we can reasonably assume these line items are accurate now and use them, rather than the confusing
primaryContributionID that we have doubts about the validity of
@eileenmcnaughton
Copy link
Contributor Author

This is passing now

@mattwire mattwire merged commit 93764e9 into civicrm:master Aug 3, 2020
@eileenmcnaughton eileenmcnaughton deleted the cont_id branch August 3, 2020 23:59
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