From 5b0d7197f6b13b402dd69bd1ac00e2e69312e017 Mon Sep 17 00:00:00 2001 From: Emily-Rose Francoeur Date: Wed, 29 Nov 2023 10:42:54 -0500 Subject: [PATCH] Bug 35434: IndependentBranches prevents non-superlibrarians from placing holds in other libraries I updated the hold page on the staff interface so that non-superlibrarians can't place holds in other libraries when the system preference 'IndependentBranches' is enabled. TEST PLAN 1) Appy the patch. 2) In 'Koha administration > System preferences', set 'IndependentBranches' to 'yes'. 3) In 'Koha administration > Circulation and fines rules', add a rule by only clicking the 'Save' button (this will create a circulation rule for all patron categories and all item types, allowing unlimited holds). 4) Create a staff patron (with username and password). ---> In 'Patrons > + New patron > Staff', fill the required fields, add a username and password. ---> Remember the home library. ---> Click the 'Save' button. 5) Add permissions to the created patron. ---> In the patron detail page, click on 'More > Set permissions' and check the following boxes: - Staff access, allows viewing of catalogue in staff interface - Add, modify and view patron information - Place and modify holds for patrons ---> Click the 'Save' button. 6) Create an other patron of any patron category with the same home library as the staff patron you created. 7) Create a record with one item. ---> In 'Cataloging > + New record', fill the required fields. ---> Click the 'Save' button. ---> You should now be in the item form. Fill the required field (home library and current library should be the same as the patron's home library). ---> Click the 'Add item' button. 8) On the record details page, click 'Place hold' and search for the patron you created in step 6. ---> In the 'Pickup at' field, you should see all the libraries. ---> In the 'Allowed pickup locations' column of the item, you should see the same. 9) Log out from the staff interface and login with the staff patron you created. 10) Click 'Search catalog' from the search bar and search for the record you created. 11) On the record details page, click 'Place hold', then search for the patron in step 6. ---> In the 'Pickup at' field, you should only see the home library of the item. ---> In the 'Allowed pickup locations' column of the item, you should see the same. --- Koha/Item.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Koha/Item.pm b/Koha/Item.pm index 22eaceac94..d8a1dde237 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -948,6 +948,8 @@ is not passed. sub pickup_locations { my ($self, $params) = @_; + return Koha::Libraries->search( { branchcode => $self->holdingbranch } ) if C4::Context->preference("IndependentBranches") && !C4::Context->IsSuperLibrarian(); + Koha::Exceptions::MissingParameter->throw( parameter => 'patron' ) unless exists $params->{patron}; -- 2.34.1