[Bug 10577] New: C4::Budgets::GetBudgetPeriod has inappropriate overloading of its behavior
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10577 Bug ID: 10577 Summary: C4::Budgets::GetBudgetPeriod has inappropriate overloading of its behavior Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: minor Priority: P5 - low Component: Acquisitions Assignee: koha-bugs@lists.koha-community.org Reporter: gmcharlt@gmail.com GetBudgetPeriod, when passed a fund ID (budget_period_id), returns a hashref of an individual budget, consistent with other functions of its sort. However, it also has a special mode -- if you pass 0 as its parameter, it returns a hashref of the first active budget. This is a problem for several reasons: [1] Nothing in Koha requires that there be only one active budget. Consequently, a function that returns "the" active one is working from an incorrect assumption (albeit, maybe one that used to be true when acquisitions support was originally added?). [2] Even the assumption were true that there can be only one active budget at a time, it is still bad practice for the one parameter of a function to either be an ID or a flag. [3] There is no code, other than a test case, that actually calls GetBudgetPeriod(0). -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10577 Galen Charlton <gmcharlt@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10577 --- Comment #1 from Galen Charlton <gmcharlt@gmail.com> --- Created attachment 19578 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=19578&action=edit 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> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10577 Galen Charlton <gmcharlt@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |10535 -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10577 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Failed QA CC| |katrin.fischer@bsz-bw.de --- Comment #2 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Galen, I think I found a problem with this - you said it's never used, but from the description I thought about the funds page and spotted a problem there: - Apply the patch - Go to the funds page - The heading is missing the budget information now - it shows: Funds for '' I think this is a design issue of the funds page really. Maybe we just should add a budget column to the table and reword the heading so it can deal with funds from multiple budgets? But not sure how that would affect other functionality on that page. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10577 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10577 Galen Charlton <gmcharlt@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |In Discussion --- Comment #3 from Galen Charlton <gmcharlt@gmail.com> --- (In reply to Katrin Fischer from comment #2)
Galen, I think I found a problem with this - you said it's never used, but from the description I thought about the funds page and spotted a problem there:
- Apply the patch - Go to the funds page - The heading is missing the budget information now - it shows: Funds for ''
I think this is a design issue of the funds page really. Maybe we just should add a budget column to the table and reword the heading so it can deal with funds from multiple budgets? But not sure how that would affect other functionality on that page.
Good catch. The funds page appears to still partially reflect an (old?) assumption that there would be only one active budget at a time. That assumption is nonsense nowadays, so I still believe that I'm on the right track with the change I made to GetBudgetPeriod(). Of course, it does need to be accompanied by a follow-up so that we don't have the Funds for '' situation. My proposal: - add a column for the parent budget (should it always be displayed, or only when no specific budget_period_id is passed?) - adjust the code that generates the hover to make sure that the parent budget is supplied. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org