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

Provide precautionary handling for theoretical error scenario. #15748

Merged

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Nov 6, 2019

Overview

Provides protection against fatal errors when adding payments if financial_items have not been created. This may only be a theoretical risk but it buys us more time to ensure it is not a 'thing' without users hitting regressions if it is.

Before

Adding a payment to a contribution with no line item financial items results in a fatal.

It's unclear at this stage if there is any legitimate way to create a contribution with line items & no financial items for those lines but should that be the case it would be handled with this patch.

After

Missing item is created, no fatal.

Technical Details

While testing payments I hit a bug where I tried to add a payment to a contribution with no financial items.

I never managed to replicate it again or determine how the payment came to be in that state but
it's been playing in my mind that people could get fatal errors if the financial_items don't exist
and dealing with those as regression reports will very tough. So my plan is

Comments

@kcristiano this provides at least a band-aid for the non-replicable error I hit that has been playing on my mind

@civibot
Copy link

civibot bot commented Nov 6, 2019

(Standard links)

@civibot civibot bot added the master label Nov 6, 2019
@eileenmcnaughton eileenmcnaughton force-pushed the line_item_belt_braces branch 2 times, most recently from d7a884f to e5e642d Compare November 6, 2019 22:06
@kcristiano
Copy link
Member

This will need rebasing if 15740 is merged first. I'll do that locally to test

@kcristiano
Copy link
Member

I've tested applying after #15740 This works fine. I'll add and do more testing, but this looks good. Obviously the failing test needs to be sorted.

While testing payments I hit a bug where I tried to add a payment to a contribution with no financial items.

I never managed to replicate it again or determine how the payment came to be in that state but
it's been playing in my mind that people could get fatal errors if the financial_items don't exist
and dealing with those as regression reports will very tough. So my plan is
- for 5.20 add this extra routine to create it if it does not exist
- use this mechanism + more digging to figure out how legit an issue it is civicrm#15706
- in future releases 'get noisy' about having to create them if they don't exist
- eventually remove this routine
@eileenmcnaughton
Copy link
Contributor Author

rebased - MOP added based on @kcristiano's input

@eileenmcnaughton
Copy link
Contributor Author

unrelated fail

@eileenmcnaughton eileenmcnaughton merged commit f682331 into civicrm:master Nov 7, 2019
@eileenmcnaughton eileenmcnaughton deleted the line_item_belt_braces branch November 7, 2019 01:02
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