I'm not sure if this is my data, but I see it on my local master as well as on the bywater and ptfs-e sandboxes... When I go to Plan by X in the Funds administration, there is an option to Plan by AR_CANCELLATION, which is weird and uncecessary (and also doesn't work). To recreate: 1. Add a budget 1.1. Go to Administration > Budgets 1.2. Click 'New budget' 1.3. Fill in the form (make sure there are a couple of months between the start and end dates), e.g. - Start date: 01/01/2023 - End date: 12/31/2023 - Description: 2023 - Total amount: 10000 - Make budget active: check - Lock budget: leave unchecked 1.4. Click 'Save' 2. Add at least one fund to the budget, make sure not to choose any statistics 1/2 2.1. Click 'Actions' next to the budget and choose 'Add fund' 2.2. Fill out the form, e.g. - Fund code: PRINT - Fund name: Print material - Amount: 6000 2.3. Click 'Submit' 3. View the planning page, e.g. Plan by months 3.1. Click 'Planning' at the top of the page and choose 'Plan by months' 3.2. In the Filter box on the left, open the 'Select planning type' drop-down menu --> There is one choice called 'Plan by AR_CANCELLATION' I checked all my funds and all the funds in the sandboxes and none have AR_CANCELLATION as a statistic 1 or 2. If you select this option and click 'Submit', it says there is nothing to show.
*** Bug 36448 has been marked as a duplicate of this bug. ***
From bug 36448: """ 122 my $sth = $dbh->prepare("select distinct category from authorised_values where category like 'A%' ") What is that?! http://localhost:8081/cgi-bin/koha/admin/aqplan.pl?budget_period_id=1&authcat=MONTHS On the left " Select planning type:" you can see "By AR_CANCELLATION". That does not make any sense! """
I really hoped git archaeology would show that the separate parts made sense at different times, but they didn't, they've both been that way since the intial commit. Selecting A% has always been there, and so has the code which refuses to actually do anything for anything that A% finds unless it is also in the fund's "Statistic 1|2 done on" field (and if you use Asort1|2 for that, then you have two entries, because things that will work are added separately from A%).
Created attachment 171433 [details] [review] 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
Created attachment 171469 [details] [review] 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 <caroline.cyr-la-rose@inlibro.com>
Thanks Phil!
Created attachment 171521 [details] [review] 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 <caroline.cyr-la-rose@inlibro.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Pushed for 24.11! Well done everyone, thank you!
Backported to 24.05.x for upcoming 24.05.06