Bug 10577: Improve semantics of GetBudgetPeriod()
authorGalen Charlton <gmc@esilibrary.com>
Thu, 11 Jul 2013 16:41:26 +0000 (16:41 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Thu, 28 Mar 2019 12:46:14 +0000 (12:46 +0000)
commitcc2a62bdee88908edb429155ae0d274ee9a6dfdb
tree98ec474d39743a8bf7c57de85c032e94ae7b64b7
parent9a321c128fed457bf6d11d2ce7ee7edf7dd28004
Bug 10577: Improve semantics of GetBudgetPeriod()

Remove the option to pass zero to this function in
order to get "the" active budget.  This was a problem
in three ways:

- Koha doesn't require that there be only one active
  budget at a time, so the concept of "the" active
  budget doesn't make sense.
- Having the single parameter be either an ID or a flag
  based on its value is poor function design.
- No callers of GetBudgetPeriod() were actually using this
  modality.

This patch also improves the DB-dependent tests for budgets by

- wrapping the test in a transaction
- counting budgets correctly

To test:

[1] Apply the patch.
[2] Verify that prove -v t/db_dependent/Budgets.t passes
[3] Verify in the staff interface that:
    - the budget hierarchy displays correctly
    - you can add and modify a budget

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Rescued-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
C4/Budgets.pm
t/db_dependent/Budgets.t