-
-
Notifications
You must be signed in to change notification settings - Fork 825
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[REF] Move wrangling of Front end form contribution param for autoRen…
…ew back to form The processAmount function is really problematic because it's trying to do several disparate things & is called from all over the place with unclear intent. From looking at it I see it does a few things. It reformats line items, it does some obscure & likely flawed filtering, it generates a total cost & a tax cost and it generates a very specifically formatted array of autoreneal properties, The way I see this going is 1) Move the formatting of the autorenewal back to the calling form (this PR) & simplify it 2) Split out the foreach so it goes through once & formats - this can be shoved out to a separate function - and then it goes through the formatted array & calculates total_amount & tax_amount - we should have a wrapper function that just returns these & we might see that is most of what is needed 3) Move all that awful partial_payment_total stuff back to the event form. Note that we are working to entirely remove that from here are it makes so much less than no sense. 4) Calculates amount_level text - that should have it's own function. It worth noting all of this does very little intensive work - a DB lookup or 2 that could be cached & an iteration through a very small array so it would be fine to have 3 functions - - getAmountTotal - getTaxTotal - getAmountText that each go through the same process of generating a formatted array from price_x => 5 etc rather than trying to pass the array around for 'performance' or to 'save work'. From previous refactorings I would suggest we add an Order class where by you set the price fields & then you can call 'getLineItems' - but that is a few steps after this....
- Loading branch information
1 parent
0be5362
commit bdcbbfe
Showing
8 changed files
with
42 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters