Koha/koha-tmpl/intranet-tmpl/prog/en/modules/circ/set-library.tt
Lucas Gass e6c49d642f
Bug 30624: Add loggedinlibrary permission and DB update
To test:
1. Apply patch, updatedatabase, restart_all
2. Have a user with superlibrarian privileges ( User1 )
3. Have a user who has staff access and circulate privileges but is not a super librarian. ( User2 ) Make note of this users home library
4. Turn on the system preference 'CircSidebar'.

-MAIN log in ( auth.tt )
5. As User1, go to the main login screen and try logging in. You should be able to log in AND you should be able to properly chnage your branch BEFORE logging in.
6. As User2, to to the main login screnn amd try logging in. You should be able to but if you try and switch your libraray to anything beside the user's home branch it will not work. You will be logged in at your home branch.
7. For User2, set the new top level permission 'Allow staff to change logged in library (loggedinlibrary).
8. Now you should be able to successfully switch libraries before log in.
9. Turn the 'loggedinlibrary' permission back off for User2.

-AFTER log in-
10. With User1, click on your name/branch in the top right, you should see the the link 'Set library' at the top. If you turn on 'UseCirculationDesks' the link will be 'Set library and desk'.
11. With User2, click on your name/branch in the top right. If you have 'UseCirculationDesks' on, you should see 'Set desk', otherwise you should see nothing.
12. Repeat step 7.
13. NOw if you click on your name/branch in the top right, you should see the the link 'Set library' at the top. If you turn on 'UseCirculationDesks' the link will be 'Set library and desk'.
14. Repeat Step 9.

-CircSideBar-
15. With 'CircSideBar' turned on, go to any ciculation page (Holds queue, Holds to pull, Holds awaiting pickup) with User1. You will see the 'Set library' link. If 'UseCirculationDesks' is on you will see a 'Set library and desk'.
16. Try with User2 and you will not see a 'Set library' link. If 'UseCirculationDesks' is on you will see a 'Set desk' link.
17. Repeat step 7.
18. For with User2 you go to any ciculation page (Holds queue, Holds to pull, Holds awaiting pickup). You will see the 'Set library' link. If 'UseCirculationDesks' is on you will see a 'Set library and desk'.
19. Repeat step 9.

-Set library page-
20. Go to the set library page (http://localhost:8081/cgi-bin/koha/circ/set-library.pl) with User1. You will see a dropdown for 'Set library'. Make sure you can change your library successfully.
21. Go to the set library page (http://localhost:8081/cgi-bin/koha/circ/set-library.pl) with User2. You should NOT see see a dropdown for 'Set library'.
22. Repeat step 7.
23. Go to the set library page (http://localhost:8081/cgi-bin/koha/circ/set-library.pl) with User2. Now you should see a dropdown for 'Set library'.

Signed-off by: Bob Bennhoff/AspenCat Team

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-13 15:22:59 -03:00

163 lines
5.2 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE Branches %]
[% USE Desks %]
[% USE Registers %]
[% USE Koha %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
[% IF Koha.Preference('UseCirculationDesks') %]
<title>Set library and desk &rsaquo; Circulation &rsaquo; Koha</title>
[% ELSE %]
<title>Set library &rsaquo; Circulation &rsaquo; Koha</title>
[% END %]
[% INCLUDE 'doc-head-close.inc' %]
<style>
.noshow {display: none;}
</style>
</head>
<body id="circ_set-library" class="circ">
[% WRAPPER 'header.inc' %]
[% INCLUDE 'circ-search.inc' %]
[% END %]
[% WRAPPER 'sub-header.inc' %]
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
<ol>
<li>
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
</li>
<li>
<a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a>
</li>
<li>
<a href="#" aria-current="page">Set library</a>
</li>
</ol>
</nav>
[% END %]
<div class="main container-fluid">
<div class="row">
<div class="col-sm-12">
<main>
<div class="row">
[% IF Koha.Preference('CircSidebar') %]
<div class="col-sm-10 col-sm-push-2">
<h1>Set library</h1>
[% ELSE %]
<div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
<h1>Set library</h1>
[% END %]
[% IF ( updated ) %]
<h2>Update succeeded</h2>
Updated:<ul>
[% FOREACH update IN updated %]
[% IF ( update.updated_branch || update.updated_desk || update.updated_register ) %]
[% IF ( updated.updated_branch ) %]
<li>Library: [% update.old_branch or "?" | html %] &rArr; [% update.new_branch or "?" | html %]</li>
[% END %]
[% IF ( update.updated_desk ) %]
<li>Desk: [% update.old_desk or "?" | html %] &rArr; [% LoginDeskname or "?" | html %]</li>
[% END %]
[% IF ( updated.updated_register ) %]
<li>Register: [% updated.old_register or "?" | html %] &rArr; [% Registers.session_register_name or "?" | html %]</li>
[% END %]
[% ELSE %]
<li>ERROR - unknown</li>
[% END %]
[% END %]
</ul>
<form method="post" action="[% referer or "/cgi-bin/koha/circ/circulation.pl" %]">
<div class="noshow">
[% FOREACH recycle_loo IN recycle_loop %]
<input type="text" name="[% recycle_loo.param | html %]" value="[% recycle_loo.value | html %]" />
[% END %]
</div>
<button type="submit">Continue</button>
</form>
[% ELSE %]
<form method="post" action="set-library.pl">
[% IF ( CAN_user_superlibrarian || CAN_user_loggedinlibrary ) %]
<fieldset class="rows">
<legend>Set library</legend>
<ol>
<li><label for="branch">Choose library:</label>
<select name="branch" id="branch">
[% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
</select></li>
</ol>
</fieldset>
[% ELSE %]
<select name="branch" id="branch" style="visibility:hidden;">
[% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
</select>
[% END %]
[% IF Koha.Preference('UseCirculationDesks') && Desks.all %]
<fieldset class="rows">
<legend>Set desk</legend>
<ol>
<li><label for="desk">Choose desk:</label>
<select name="desk_id" id="desk_id">
[% PROCESS options_for_desks desks => Desks.all(), selected => desk_id %]
</select></li>
</ol>
</fieldset>
[% END %]
[% IF Koha.Preference('UseCashRegisters') %]
<fieldset class="rows">
<legend>Set cash register</legend>
<ol>
<li>
<label for="register_id">Choose cash register:</label>
<select name="register_id" id="register_id">
<option id="noregister" selected="selected" value="">-- None --</option>
[% PROCESS options_for_registers registers => Registers.all() %]
</select>
</li>
</ol>
</fieldset>
[% END %]
<fieldset class="action">
<input type="submit" class="btn btn-primary" value="Submit" />
<a class="cancel" id="cancel_set_library" href="[% referer or '/cgi-bin/koha/circ/circulation.pl' %]">Cancel</a>
</fieldset>
<div class="noshow">
[% FOREACH recycle_loo IN recycle_loop %]
<input type="text" name="[% recycle_loo.param | html %]" value="[% recycle_loo.value | html %]" />
[% END %]
<input type="hidden" name="oldreferer" value="[% referer or "/cgi-bin/koha/circ/circulation.pl" %]" />
</div>
</form>
<!-- /updated -->
[% END %]
[% IF Koha.Preference('CircSidebar') %]
</div> <!-- /.col-sm-10.col-sm-push-2 -->
<div class="col-sm-2 col-sm-pull-10">
<aside>
[% INCLUDE 'circ-nav.inc' %]
</aside>
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
</div> <!-- /.row -->
[% END %]
</main>
</div> <!-- /.col-sm-12 -->
</div> <!-- /.row -->
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/desk_selection.js") | $raw %]
[% Asset.js("js/register_selection.js") | $raw %]
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]