From db42742a3a8e974ab3b8eaea0e825915ebbd5b9a Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Thu, 12 Sep 2024 17:32:23 -0700 Subject: [PATCH] Bug 34159: Budget planning shouldn't add every authorized value starting with A In aqplan.pl there are two different sets of params for things you can plan by: for the toolbar "Planning" menubutton the script looks up what AVs are used for "Statistic 1|2 done on" for the budget's fund(s), and passes them to the template which knows to hardcode the MONTHS, ITEMTYPES, and BRANCHES choices, but for "Select planning type" in the Filter sidebar box, the script inserts the harcoded ones itself, adds in the ones used by a fund, and for no apparent reason adds in every authorized value category that starts with the letter A and has at least one value. Those things do not actually work, because for things other than the hardcoded ones the script checks whether they are in a fund's "Statistic 1|2" and if not refuses to let you plan by them. Test plan: 1. Administration - Budgets 2. If you don't have a budget, create one and add a fund to it, but with the default data click the name Main budget 3. In the row for Main fund, click Actions->Edit 4. For Statistic 1 done on choose an authorized value which does not start with A, like BOR_NOTES, and Save 5. In the top toolbar, Planning->Plan by months 6. In the sidebar Filter box, note that there is an option to plan by AR_CANCELLATION even though you didn't select that for Statistic 1 7. Select the by BOR_NOTE choice and Submit 8. Note that you now only see Main fund, because that's the only one which uses that AV 9. Select the by months choice and Submit, see that it changes back, then select the by AR_CANCELLATION choice and see that nothing is displayed, select the by months choice again and Submit, see that the display is now completely broken 9. Apply patch, restart_all, reload the page 10. Note that the AR_CANCELLATION choice is gone, and all the choices you do have work correctly Sponsored-by: Chetco Community Public Library Signed-off-by: Caroline Cyr La Rose Signed-off-by: Jonathan Druart Signed-off-by: Katrin Fischer --- admin/aqplan.pl | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/admin/aqplan.pl b/admin/aqplan.pl index a6d863e1c2..676b247b1f 100755 --- a/admin/aqplan.pl +++ b/admin/aqplan.pl @@ -119,19 +119,8 @@ my $budgets_ref = GetBudgetHierarchy( ); # build categories list -my $sth = $dbh->prepare("select distinct category from authorised_values where category like 'A%' "); -$sth->execute; - -# the list my @category_list; -# a hash, to check that some hardcoded categories exist. -my %categories; -while ( my ($category) = $sth->fetchrow_array ) { - push( @category_list, $category ); - $categories{$category} = 1; -} - # push koha system categories push( @category_list, 'MONTHS' ); push( @category_list, 'ITEMTYPES' ); -- 2.39.5