From 1dc0fb573667c1a8106433e2ba50da48a9d4a129 Mon Sep 17 00:00:00 2001
From: Lucas Gass
Date: Fri, 14 Jan 2022 21:37:49 +0000
Subject: [PATCH] Bug 29887: Add system preference
IndependentBranchesLoggedInLibrary
To test:
1. Have a user who has staff access and circulate privileges but is not a super librarian
2. Apply the patches and run updatedatabase.pl
3. From a superlibrarian account enable IndependentBranches and IndependentBranchesLoggedInLibrary set to Yes.
4. Also turn on the system preference 'CircSidebar'
5. Prepare to login as the non-superlibrarian user. Before logging on notice on auth.tt there is no dropdown allowing you to choose a branch.
6. Log in as the non-superlibrarian.
7. In the top left hand corner notice you are logged in under that users homebranch.
8. Click the dropdown, there is no link for 'Set library'.
9. Go to circulation-home.pl, there is no link for 'Set library' under the heading 'Circulation'
10. With 'CircSidebar' turned on look at the left navigation bar on some of the circulation pages ( Holds queue, Holds to pull, Holds awaiting pickup ). There should be no 'Set library' link on any of these pages.
11. Direct your browser to /cgi-bin/koha/circ/set-library.pl and notice there is no option to change your logged in branch
12. From a superlibrarian account, Turn off IndependentBranches but leave IndependentBranchesLoggedInLibrary set to Yes.
13. Repeat steps 5-11. Nothing should change, the non-superlibrarian should still see no 'Set library' links.
14. From a superlibrarian account, Turn on IndependentBranches and IndependentBranchesLoggedInLibrary set to No
15. Going through steps 5-11 again the non-superlibrarian should see all of the 'Set library' links and be able to successfully switch branches
Signed-off-by: Bob Bennhoff
---
installer/data/mysql/mandatory/sysprefs.sql | 1 +
koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc | 2 +-
koha-tmpl/intranet-tmpl/prog/en/includes/header.inc | 2 +-
.../prog/en/modules/admin/preferences/admin.pref | 7 +++++++
koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt | 2 +-
.../intranet-tmpl/prog/en/modules/circ/circulation-home.tt | 3 +--
.../intranet-tmpl/prog/en/modules/circ/set-library.tt | 2 +-
7 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql
index dd83a00fd8..b11a132bea 100644
--- a/installer/data/mysql/mandatory/sysprefs.sql
+++ b/installer/data/mysql/mandatory/sysprefs.sql
@@ -267,6 +267,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('IndependentBranches','0',NULL,'If ON, increases security between libraries','YesNo'),
('IndependentBranchesPatronModifications','0', NULL, 'Show only modification request for the logged in branch','YesNo'),
('IndependentBranchesTransfers','0', NULL, 'Allow non-superlibrarians to transfer items between libraries','YesNo'),
+('IndependentBranchesLoggedInLibrary','0', NULL, 'Allow only superlibrarians the ability to set or change their logged in location','YesNo'),
('IntranetCatalogSearchPulldown','0', NULL, 'Show a search field pulldown for \"Search the catalog\" boxes','YesNo'),
('RecordedBooksClientSecret','','30','Client key for RecordedBooks integration','Free'),
('RecordedBooksDomain','','','RecordedBooks domain','Free'),
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc
index 14931325fd..0e2af5664d 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc
@@ -15,7 +15,7 @@
[% IF !Koha.Preference('IndependentBranchesTransfers') || CAN_user_superlibrarian %]