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

[REF] Move calls to CRM_Core_BAO_FinancialTrxn::createDeferredTrxn back to the calling functions. #15641

Merged
merged 1 commit into from
Nov 1, 2019

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

Code -re-arrangment

Before

Harder to see what is happening in updateFinancialAccount function

After

Easier to see what is happening in updateFinancialAccount function

Technical Details

Although this seems like we are increasing duplication - by having more calls to one line of code I feel like
we are better off moving it back to the calling functions as there is 'preparatory wrangling' that also belongs
in the calling functions - notably in changeFinancialType.

I believe we should be able to get to the point where the updateFinancialAccounts funcgtion does not
need to receive context as a parameter because all the context specific stuff will be done in the calling functions
and it will have a clear objective - which I have finally realised is creating the financial transaction
and the financial items - however in some cases it is called twice to do a reversal followed by a line item
and I believe the calling functions could be cleaned up a lot more by 'returning' code to them as
passing by reference leaves us very unclear as to what is happening to them at each point in the process.

Comments

…the calling functions.

Although this seems like we are increasing duplication - by having more calls to one line of code I feel like
we are better off moving it back to the calling functions as there is 'preparatory wrangling' that also belongs
in the calling functions - notably in changeFinancialType.

I believe we should be able to get to the point where the updateFinancialAccounts funcgtion does not
need to receive context as a parameter because all the context specific stuff will be done in the calling functions
and it will have a clear objective - which I have finally realised is creating the financial transaction
and the financial items - however in some cases it is called twice to do a reversal followed by a line item
and I believe the calling functions could be cleaned up a lot more by 'returning' code to them as
passing  by reference leaves us very unclear as to what is happening to them at each point in the process.
@civibot
Copy link

civibot bot commented Oct 28, 2019

(Standard links)

@civibot civibot bot added the master label Oct 28, 2019
@mattwire
Copy link
Contributor

mattwire commented Nov 1, 2019

Yes this makes sense

@mattwire mattwire merged commit 1244e13 into civicrm:master Nov 1, 2019
@eileenmcnaughton eileenmcnaughton deleted the cont_clean branch November 1, 2019 20:46
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.

2 participants