Bug 29287 added totalling of subfunds, however, it does not take care of subfunds of subfunds - the logic should be updated to add recursively
Created attachment 139829 [details] [review] Bug 31367: Add subtotals if budget has children On bug 29287 we added child funds if a fund had no parent id It turns out funds can have a parent, and still have children (sub-sub-funds) This patch simply checks for children, rather than checking for lack of parent. Totals are already calculated correctly in GetBudgetHierarchy To test: 1 - Add a fund "Fund" to a budget - assign 1000 dollars 2 - Add a sub-fund "SubFund" - assign 100 dollars 3 - Add a sub-sub-fund "SubSubFund" - assign 10 dollars 4 - Add to a basket $5 order from SubSubFund 5 - Add to a basket $50 order from SubFund 6 - Add to a basket $500 order form Fun 7 - View acqui home - note 'SubFund' does not include total from 'SubSubFund' 8 - Apply patch 9 - Confirm all sub-sub-funds totaled in sub-funds and that fund total correctly adds sub and sub-sub funds
Created attachment 139850 [details] [review] Bug 31367: Add subtotals if budget has children On bug 29287 we added child funds if a fund had no parent id It turns out funds can have a parent, and still have children (sub-sub-funds) This patch simply checks for children, rather than checking for lack of parent. Totals are already calculated correctly in GetBudgetHierarchy To test: 1 - Add a fund "Fund" to a budget - assign 1000 dollars 2 - Add a sub-fund "SubFund" - assign 100 dollars 3 - Add a sub-sub-fund "SubSubFund" - assign 10 dollars 4 - Add to a basket $5 order from SubSubFund 5 - Add to a basket $50 order from SubFund 6 - Add to a basket $500 order form Fun 7 - View acqui home - note 'SubFund' does not include total from 'SubSubFund' 8 - Apply patch 9 - Confirm all sub-sub-funds totaled in sub-funds and that fund total correctly adds sub and sub-sub funds Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Created attachment 140480 [details] [review] Bug 31367: Add subtotals if budget has children On bug 29287 we added child funds if a fund had no parent id It turns out funds can have a parent, and still have children (sub-sub-funds) This patch simply checks for children, rather than checking for lack of parent. Totals are already calculated correctly in GetBudgetHierarchy To test: 1 - Add a fund "Fund" to a budget - assign 1000 dollars 2 - Add a sub-fund "SubFund" - assign 100 dollars 3 - Add a sub-sub-fund "SubSubFund" - assign 10 dollars 4 - Add to a basket $5 order from SubSubFund 5 - Add to a basket $50 order from SubFund 6 - Add to a basket $500 order form Fun 7 - View acqui home - note 'SubFund' does not include total from 'SubSubFund' 8 - Apply patch 9 - Confirm all sub-sub-funds totaled in sub-funds and that fund total correctly adds sub and sub-sub funds Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Nice fix, works as expected.. Passing QA
Pushed to master for 22.11. Nice work everyone, thanks!
Backported to 22.05.x for upcoming 22.05.07 release
applied to 21.11 for 21.11.14
Not backported to oldoldstable (21.05.x). Feel free to ask if it's needed. Nothing to document it seems, marking resolved.