Bug 18906

Summary: Superlibrarian and budget_manage_all users should always see all funds
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: AcquisitionsAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: fridolin.somers, jonathan.druart, mtj, nick
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 18906: Display all funds the logged in user can use
Bug 18906: Display all funds the logged in user can use
Bug 18906: Display all funds the logged in user can use

Description Katrin Fischer 2017-07-06 17:48:22 UTC
If you have the superlibrarian or budget_manage_all permission you should be able to see all funds at all times - otherwise it's not possible to centrally manage and edit funds in a multi-branch system. Also, if someone logged themselves out from a fund by wrong configuration, users with those permissions need to be able to fix it.

To test:
- Make sure your user has superlibrarian permission
- Go into acquisisitions
- Create a new budget
- Create a new fund
  - set library to 'not your home library'
  - set restricted to 'owner, users and library'
- Verify that after saving the fund, you can no longer access it.
- Change your home branch
- log out and log in again
- Verify you can now see the fund

Repeat with all acq permissions including budget_manage_all - you will also experience that you are logged out from accessing the fund you created.

Note: visibility on the acq start page will work correctly in these scenarios.
Comment 1 Jonathan Druart 2017-07-06 21:11:48 UTC
Created attachment 64874 [details] [review]
Bug 18906: Display all funds the logged in user can use

There are complex conditions to know if a librarian can use a fund, we
cannot do that with a SQL query, we need to use C4::Budgets::CanUserUseBudget
Comment 2 Jonathan Druart 2017-07-06 21:12:26 UTC
I do not provide a test plan as I am not sure what is the expected behaviours.
Comment 3 Alex Buckley 2017-07-26 22:39:46 UTC
Created attachment 65288 [details] [review]
Bug 18906: Display all funds the logged in user can use

There are complex conditions to know if a librarian can use a fund, we
cannot do that with a SQL query, we need to use C4::Budgets::CanUserUseBudget

When this patch is applied then all funds are visible to both
superlibrarian patrons and patrons with all acq permissions

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Comment 4 Nick Clemens 2017-07-31 15:29:38 UTC
Created attachment 65361 [details] [review]
Bug 18906: Display all funds the logged in user can use

There are complex conditions to know if a librarian can use a fund, we
cannot do that with a SQL query, we need to use C4::Budgets::CanUserUseBudget

When this patch is applied then all funds are visible to both
superlibrarian patrons and patrons with all acq permissions

Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 5 Nick Clemens 2017-07-31 15:30:59 UTC
Permissions could be more thought out, but this ensures that superlibrarians and users that can manage_all_budgets can access any fund to correct permissions/add users/etc.
Comment 6 Jonathan Druart 2017-08-09 19:54:13 UTC
Pushed to master for 17.11, thanks to everybody involved!
Comment 7 Fridolin Somers 2017-09-12 14:01:13 UTC
Pushed to 17.05.x, will be in 17.05.04.
Comment 8 Katrin Fischer 2017-09-15 23:23:02 UTC
This patch has been pushed to 16.11.x and will be in 16.11.12.
Comment 9 Mason James 2017-11-23 21:28:02 UTC
Pushed to 16.05.x, for 16.05.17 release