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] Further deconstruction of updateFinancialAccounts #15631

Merged
merged 1 commit into from
Oct 28, 2019

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

Further incremental code cleanup step in updateFinancialAccounts

Before

non-generic code in generic function

After

non generic code in the bit of function it relates to

Technical Details

updateFinancialAccounts is only called from one place with the context of 'changedStatus'. When called this
way the function updateFinancialAccountsOnContributionStatusChange is called & that 'tells'
the calling function whether to call the rest of this function.

Since this handling is specific to one place from which the function is called we can move that logic
back to the place that calls it & further simplify the updateFinancialAccounts function
which has been a bit of a haven of chaos

Comments

updateFinancialAccounts is only called from one place with the context of 'changedStatus'. When called this
way the function updateFinancialAccountsOnContributionStatusChange is called & that 'tells'
the calling function whether to call the rest of this function.

Since this handling is specific to one place from which the function is called we can move that logic
back to the place that calls it & further simplify the updateFinancialAccounts function
which has been a bit of a haven of chaos
@civibot
Copy link

civibot bot commented Oct 27, 2019

(Standard links)

@civibot civibot bot added the master label Oct 27, 2019
@@ -3691,7 +3691,10 @@ public static function recordFinancialAccounts(&$params, $financialTrxnValues =
$params['prevContribution']->contribution_status_id != $params['contribution']->contribution_status_id
) {
//Update Financial Records
self::updateFinancialAccounts($params, 'changedStatus');
$callUpdateFinancialAccounts = self::updateFinancialAccountsOnContributionStatusChange($params);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this var isn't strictly needed but I used it because the function being called does not do a good job of implying the meaning of it's return value

@eileenmcnaughton
Copy link
Contributor Author

@seamuslee001 are you ok to merge this- the code has a LOT of unit tests covering it

@seamuslee001
Copy link
Contributor

Took me a while to try and get my heads around this but it looks fine to me merging

@seamuslee001 seamuslee001 merged commit b11d2e1 into civicrm:master Oct 28, 2019
@seamuslee001 seamuslee001 deleted the fix_it branch October 28, 2019 04:04
@eileenmcnaughton
Copy link
Contributor Author

@seamuslee001 took me a while to simplify the code enough for that change to be do-able :-)

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