Bug 34188: Require Library Branch Selection when Logging in

This patch adds the ability to force staff to select a library when
logging into the staff interface. This is done via a new system
preference: 'ForcedLibrarySelection'

To test:
1) Apply patch, restart_all, and updatedatabase
2) Log out of the staff interface. Notice the login form looks the same
   and the "Library:" dropdown has 'My Library" selected as default. Log
   back into the staff interface.
3) In Administration, search for the system preference
   "ForcedLibrarySelection". Set it to 'Force' and press save.
4) Log out of the staff interface. Notice that this time, the "Library:"
   dropdown is required and has a blank selection as the default.
5) Fill in the username and password but do not select a library. Click
   'Log in'
6) Notice you cannot log in and are asked to 'Please select an item in
   the list'
7) Select a library from the drop down and click 'Log in'
8) Notice the login was successful and you were logged in to the library
   you selected.
9) Try loggin in with some other libraries to verify it works as
   expected
10) Sign-off :)

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Sam Lau 2023-07-06 19:59:50 +00:00 committed by Tomas Cohen Arazi
parent f4001d5462
commit 9603f11883
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
4 changed files with 36 additions and 2 deletions

View file

@ -0,0 +1,17 @@
use Modern::Perl;
return {
bug_number => "34188",
description => "Force staff to select a library when logging into the staff interface.",
up => sub {
my ($args) = @_;
my ($dbh, $out) = @$args{qw(dbh out)};
$dbh->do(q{
INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` )
VALUES ('ForcedLibrarySelection', '0', NULL,'Force staff to select a library when logging into the staff interface.', 'YesNo')});
# sysprefs
say $out "Added new system preference 'ForcedLibrarySelection'";
},
};

View file

@ -265,6 +265,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('FinesIncludeGracePeriod','1',NULL,'If enabled, fines calculations will include the grace period.','YesNo'),
('FinesLog','1',NULL,'If ON, log fines','YesNo'),
('finesMode','off','off|production','Choose the fines mode, \'off\' (no charges), \'production\' (accrue overdue fines). Requires accruefines cronjob.','Choice'),
('ForcedLibrarySelection','0',NULL,'Force staff to select a library when logging into the staff interface.','YesNo'),
('FRBRizeEditions','0','','If ON, Koha will query one or more ISBN web services for associated ISBNs and display an Editions tab on the details pages','YesNo'),
('GenerateAuthorityField667', 'Machine generated authority record', NULL, 'When BiblioAddsAuthorities and AutoCreateAuthorities are enabled, use this as a default value for the 667$a field of MARC21 records', 'free'),
('GenerateAuthorityField670', 'Work cat.', NULL, 'When BiblioAddsAuthorities and AutoCreateAuthorities are enabled, use this as a default value for the 670$a field of MARC21 records', 'free'),

View file

@ -138,6 +138,13 @@ Administration:
choices:
1: "Yes"
0: "No"
-
- pref: ForcedLibrarySelection
choices:
1: "Force"
0: "Don't force"
- "library selection when logging into the staff interface."
CAS authentication:
-
- "Use CAS for login authentication: "

View file

@ -135,13 +135,22 @@
[% UNLESS IndependentBranches %]
<p>
<label for="branch">Library:</label>
<select name="branch" id="branch" class="input" tabindex="3">
[% IF Koha.Preference('ForcedLibrarySelection') %]
<label for="branch" class="required">Library:</label>
<select name="branch" id="branch" class="input" tabindex="3" required="required">
<option value=""></option>
[% ELSE %]
<label for="branch">Library:</label>
<select name="branch" id="branch" class="input" tabindex="3">
<option value="">My library</option>
[% END %]
[% FOREACH l IN Branches.all( unfiltered => 1 ) %]
<option value="[% l.branchcode | html %]">[% l.branchname | html %]</option>
[% END %]
</select>
[% IF Koha.Preference('ForcedLibrarySelection') %]
<span class="required">Required</span>
[% END %]
</p>
[% IF Koha.Preference('UseCirculationDesks') && Desks.all %]