Bug 22786: Prevent fund creation for locked budgets
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Sun, 23 Jun 2019 00:29:42 +0000 (19:29 -0500)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 6 Sep 2019 12:17:47 +0000 (13:17 +0100)
commit9215ca42d28bec10f55a9c660bb5816045bb9656
tree01c32d6e4b3df44e7275ab22dc0ec107ede521c6
parentb94b58aa746188ee3699a2e4bc0a6b24d2dd86c5
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>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
admin/aqbudgets.pl
koha-tmpl/intranet-tmpl/prog/en/includes/blocking_errors.inc
koha-tmpl/intranet-tmpl/prog/en/includes/budgets-admin-toolbar.inc