Bug 31367 - Display of sub-funds does not include totals of sub-sub-funds on acquisitions home page
Summary: Display of sub-funds does not include totals of sub-sub-funds on acquisitions...
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Nick Clemens
QA Contact: Martin Renvoize
URL:
Keywords:
Depends on: 29287
Blocks:
  Show dependency treegraph
 
Reported: 2022-08-16 12:08 UTC by Nick Clemens
Modified: 2023-12-28 20:43 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00, 22.05.07, 21.11.14


Attachments
Bug 31367: Add subtotals if budget has children (3.25 KB, patch)
2022-08-26 13:37 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 31367: Add subtotals if budget has children (3.31 KB, patch)
2022-08-26 20:20 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 31367: Add subtotals if budget has children (3.38 KB, patch)
2022-09-12 16:40 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens 2022-08-16 12:08:47 UTC
Bug 29287 added totalling of subfunds, however, it does not take care of subfunds of subfunds - the logic should be updated to add recursively
Comment 1 Nick Clemens 2022-08-26 13:37:52 UTC
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
Comment 2 ByWater Sandboxes 2022-08-26 20:20:55 UTC
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>
Comment 3 Martin Renvoize 2022-09-12 16:40:20 UTC
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>
Comment 4 Martin Renvoize 2022-09-12 16:40:41 UTC
Nice fix, works as expected.. Passing QA
Comment 5 Tomás Cohen Arazi 2022-09-23 12:11:59 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 6 Lucas Gass 2022-10-31 23:06:07 UTC
Backported to 22.05.x for upcoming 22.05.07 release
Comment 7 Arthur Suzuki 2022-11-14 16:52:25 UTC
applied to 21.11 for 21.11.14
Comment 8 Victor Grousset/tuxayo 2022-11-26 03:57:25 UTC
Not backported to oldoldstable (21.05.x). Feel free to ask if it's needed.

Nothing to document it seems, marking resolved.