Bug 28223

Summary: Total for budgets is incorrect when child funds have negative values
Product: Koha Reporter: Nick Clemens <nick>
Component: AcquisitionsAssignee: Nick Clemens <nick>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: andrewfh, fridolin.somers, martin.renvoize, victor
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.06,20.05.12
Bug Depends on: 23767    
Bug Blocks:    
Attachments: Bug 28223 - Add data elements to negative budgets
Bug 28223 - Add data elements to negative budgets
Bug 28223: Add data elements to negative budgets

Description Nick Clemens 2021-04-26 12:40:35 UTC
The math that we do on this page uses data elements parent_id and self_id to ensure we add only the parent budgets and don't add any more than once.

When a budget is negative, however, we don't add these elements and this then totals child funds an additional time

To recreate:
1 - Have a parent fund and a child fund
2 - Order an amount from the child fund that is greater than the amount available
3 - Browse to acquisitions
4 - Confirm the totals look right
5 - Click on the over spent fund to go to 'Funds for main budget'
6 - Note the totals are incorrect
Comment 1 Nick Clemens 2021-04-26 12:42:00 UTC
Created attachment 120172 [details] [review]
Bug 28223 - Add data elements to negative budgets

To test:
1 - Have a parent fund and a child fund
2 - Order an amount from the child fund that is greater than the amount available
3 - Browse to acquisitions
4 - Confirm the totals look right
5 - Click on the over spent fund to go to 'Funds for main budget'
6 - Note the totals are incorrect
7 - Apply patch
8 - Reload
9 - Totals are now correct
Comment 2 Martin Renvoize 2021-04-26 12:53:36 UTC
Created attachment 120173 [details] [review]
Bug 28223 - Add data elements to negative budgets

To test:
1 - Have a parent fund and a child fund
2 - Order an amount from the child fund that is greater than the amount available
3 - Browse to acquisitions
4 - Confirm the totals look right
5 - Click on the over spent fund to go to 'Funds for main budget'
6 - Note the totals are incorrect
7 - Apply patch
8 - Reload
9 - Totals are now correct

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 3 Martin Renvoize 2021-04-26 12:54:15 UTC
Works as expected.. can't believe I missed this during QA first time around!

Passing QA
Comment 4 Jonathan Druart 2021-04-27 10:15:15 UTC
Created attachment 120207 [details] [review]
Bug 28223: Add data elements to negative budgets

To test:
1 - Have a parent fund and a child fund
2 - Order an amount from the child fund that is greater than the amount available
3 - Browse to acquisitions
4 - Confirm the totals look right
5 - Click on the over spent fund to go to 'Funds for main budget'
6 - Note the totals are incorrect
7 - Apply patch
8 - Reload
9 - Totals are now correct

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 5 Jonathan Druart 2021-04-27 14:26:22 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 6 Fridolin Somers 2021-04-30 08:53:47 UTC
Pushed to 20.11.x for 20.11.06
Comment 7 Andrew Fuerste-Henry 2021-05-24 18:47:00 UTC
Pushed to 20.05.x for 20.05.12
Comment 8 Victor Grousset/tuxayo 2021-05-24 18:55:16 UTC
Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.