Bug 22786 - Can create new funds for locked budgets
Summary: Can create new funds for locked budgets
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on: 9628
Blocks: 23524
  Show dependency treegraph
 
Reported: 2019-04-26 17:23 UTC by Nick Clemens
Modified: 2020-11-30 21:44 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.11.00,19.05.03


Attachments
Bug 22786: Prevent fund creation for locked budgets (4.04 KB, patch)
2019-06-23 00:36 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22786: Prevent fund creation for locked budgets (4.16 KB, patch)
2019-08-27 02:16 UTC, Hayley Pelham
Details | Diff | Splinter Review
Bug 22786: Prevent fund creation for locked budgets (4.10 KB, patch)
2019-08-27 02:17 UTC, Hayley Pelham
Details | Diff | Splinter Review
Bug 22786: Prevent fund creation for locked budgets (4.15 KB, patch)
2019-08-30 13:19 UTC, Nick Clemens
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens 2019-04-26 17:23:03 UTC
To recreate:
1 - Have a budget
2 - Lock it
3 - Click on a fund from acqui-home to view funds for the budget
4 - Select new->New fund for budget
5 - Note the link displays as disabled 
6 - Click it and note it is not disabled
7 - Add a new budget
Comment 1 Jonathan Druart 2019-04-29 20:46:44 UTC
1. It seems that there is an ergonomic issue, the link should not be there. I guess we should reuse the tooltip behavior we have on the patron's detail page.
Other links are impacted as well.
Owen, do you agree?

2. There is a business logic issue, we must raise an exception when we want to create a new fund for a budget that is locked (do we really want that?)
Comment 2 Owen Leonard 2019-04-30 12:11:43 UTC
(In reply to Jonathan Druart from comment #1)
> Owen, do you agree?

Yes.
Comment 3 Jonathan Druart 2019-06-23 00:36:17 UTC
Created attachment 90938 [details] [review]
Bug 22786: Prevent fund creation for locked budgets

If a budget is locked, there is a "New fund for $budget" link that is
disabled but clickable.
We should ensure that the link is not clickable and prevent it at
controller level (do we need it at module level, ie.
Koha::Acquisition::Fund->store?)

Test plan:
- Create a budget, lock it
- Go to /cgi-bin/koha/admin/aqbudgetperiods.pl
- Click on the name of the budget you just created
=> The "New > New fund for $budget_name" button should be disabled
- Click it anyway
=> Without this patch the form to add a new fund is displayed
=> With this patch applied nothing happens
- Hit /cgi-bin/koha/admin/aqbudgets.pl?op=add_form&budget_period_id=XXX
With XXX the budget's id
=> Without this patch the form is displayed
=> With this patch applied you get a message:
  "The budget is locked, fund creation is not possible."
And you are not able to create a new fund

QA notes:
1. See description
2. The add_validate op can still be forced, let trust librarians with
administration permissions for now.
Comment 4 Hayley Pelham 2019-08-27 02:16:58 UTC
Created attachment 92479 [details] [review]
Bug 22786: Prevent fund creation for locked budgets

If a budget is locked, there is a "New fund for $budget" link that is
disabled but clickable.
We should ensure that the link is not clickable and prevent it at
controller level (do we need it at module level, ie.
Koha::Acquisition::Fund->store?)

Test plan:
- Create a budget, lock it
- Go to /cgi-bin/koha/admin/aqbudgetperiods.pl
- Click on the name of the budget you just created
=> The "New > New fund for $budget_name" button should be disabled
- Click it anyway
=> Without this patch the form to add a new fund is displayed
=> With this patch applied nothing happens
- Hit /cgi-bin/koha/admin/aqbudgets.pl?op=add_form&budget_period_id=XXX
With XXX the budget's id
=> Without this patch the form is displayed
=> With this patch applied you get a message:
  "The budget is locked, fund creation is not possible."
And you are not able to create a new fund

QA notes:
1. See description
2. The add_validate op can still be forced, let trust librarians with
administration permissions for now.

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>

https://bugs.koha-community.org/show_bug.cgi?id=22876
Comment 5 Hayley Pelham 2019-08-27 02:17:59 UTC
Created attachment 92480 [details] [review]
Bug 22786: Prevent fund creation for locked budgets

If a budget is locked, there is a "New fund for $budget" link that is
disabled but clickable.
We should ensure that the link is not clickable and prevent it at
controller level (do we need it at module level, ie.
Koha::Acquisition::Fund->store?)

Test plan:
- Create a budget, lock it
- Go to /cgi-bin/koha/admin/aqbudgetperiods.pl
- Click on the name of the budget you just created
=> The "New > New fund for $budget_name" button should be disabled
- Click it anyway
=> Without this patch the form to add a new fund is displayed
=> With this patch applied nothing happens
- Hit /cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_period_id=XXX
With XXX the budget's id
=> Without this patch the form is displayed
=> With this patch applied you get a message:
  "The budget is locked, fund creation is not possible."
And you are not able to create a new fund

QA notes:
1. See description
2. The add_validate op can still be forced, let trust librarians with
administration permissions for now.

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
Comment 6 Nick Clemens 2019-08-30 13:19:39 UTC
Created attachment 92505 [details] [review]
Bug 22786: Prevent fund creation for locked budgets

If a budget is locked, there is a "New fund for $budget" link that is
disabled but clickable.
We should ensure that the link is not clickable and prevent it at
controller level (do we need it at module level, ie.
Koha::Acquisition::Fund->store?)

Test plan:
- Create a budget, lock it
- Go to /cgi-bin/koha/admin/aqbudgetperiods.pl
- Click on the name of the budget you just created
=> The "New > New fund for $budget_name" button should be disabled
- Click it anyway
=> Without this patch the form to add a new fund is displayed
=> With this patch applied nothing happens
- Hit /cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_period_id=XXX
With XXX the budget's id
=> Without this patch the form is displayed
=> With this patch applied you get a message:
  "The budget is locked, fund creation is not possible."
And you are not able to create a new fund

QA notes:
1. See description
2. The add_validate op can still be forced, let trust librarians with
administration permissions for now.

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 7 Nick Clemens 2019-08-30 13:26:23 UTC
Passing QA here, I don't really like that we can force add a fund, especially since we can do it with no code or name or amount.

Hit that a bunch and create lots of new empty funds, then you can edit and add amounts
http://localhost:8081/cgi-bin/koha/admin/aqbudgets.pl?op=add_validate&budget_period_id=1

Opening a new bug 23524 for fact that you can still edit/delete funds
Comment 8 Martin Renvoize 2019-09-06 12:12:14 UTC
Nice work!

Pushed to master for 19.11.00
Comment 9 Fridolin Somers 2019-09-09 08:02:03 UTC
Pushed to 19.05.x for 19.05.04
Comment 10 Lucas Gass 2019-09-24 22:10:37 UTC
backported to 18.11.x for 18.11.10