Bug 12168: fix spent and ordered budget values are wrong when depth >= 2
authorJonathan Druart <jonathan.druart@biblibre.com>
Thu, 1 May 2014 12:12:18 +0000 (14:12 +0200)
committerGalen Charlton <gmc@esilibrary.com>
Mon, 19 May 2014 21:54:41 +0000 (21:54 +0000)
commit75f00c3e304738f2eb77acbb60242e3c0fe4d6c2
tree7b29b22d20d2e257a5a2aeb77890069a9d25162b
parent2c5f927689c24323128e88cfa26ffe9adcfbd832
Bug 12168: fix spent and ordered budget values are wrong when depth >= 2

A really weird (and old) code process the calculation for the spent and
ordered sublevel funds.

It only takes into account the direct children.

So if you have:
fund1 (spent=100) parent of fund11 (spent=10) parent of fund111 (spent=1),
you get:

fund     | base-level | total spent
fund1    | 100        | 110
fund11   | 10         | 11
fund111  | 1          | 1

which is wrong, it should be

fund     | base-level | total spent
fund1    | 100        | 111
fund11   | 10         | 11
fund111  | 1          | 1

Test plan:
- Create 1 budget and 3 funds with the same structure as above.
- Create some orders and receive them (not all).
- Go on the fund list view and verify the values are correct.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
C4/Budgets.pm
admin/aqbudgets.pl