Bug 10300: (follow-up) add controls on transfers page
authorFridolin Somers <fridolin.somers@biblibre.com>
Thu, 28 Feb 2019 15:23:22 +0000 (16:23 +0100)
committerNick Clemens <nick@bywatersolutions.com>
Fri, 26 Apr 2019 11:49:08 +0000 (11:49 +0000)
This patch moves the check of IndependentBranchesTransfers pref to templates and adds permission test inside branchtransfers.pl.
It also corrects the libraries combobox in branchtransfers.tt, this list can contain all libraries, it is the access to the page that may be protected.

Additions to test plan :
1)
1.1) Enable CircSidebar
1.2) In circulation home page check the effect of IndependentBranchesTransfers on "Transfer" link
1.3) Go to return page and check then effect of IndependentBranchesTransfers on "Transfer" link

2)
2.1) In circ/branchtransfers.pl, with and without IndependentBranches you see all libraries are in combobox

3)
3.1) Set IndependentBranchesTransfers to no and go to circ/branchtransfers.pl
3.2) You are redirected to page 403 unless you are superlibarian

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

circ/branchtransfers.pl
koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc
koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt
koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt

index e2280a2..d5b8e9e 100755 (executable)
@@ -64,6 +64,12 @@ my ($template, $user, $cookie, $flags ) = get_template_and_user(
     }
 );
 
+# Check transfers is allowed from system preference
+if ( C4::Context->preference("IndependentBranchesTransfers") && !C4::Context->IsSuperLibrarian() ) {
+    print $query->redirect("/cgi-bin/koha/errors/403.pl");
+    exit;
+}
+
 my $messages;
 my $found;
 my $reserved;
index bba7bea..708ff33 100644 (file)
@@ -11,7 +11,7 @@
             <li><a href="/cgi-bin/koha/circ/circulation.pl">Check out</a></li>
             <li><a href="/cgi-bin/koha/circ/returns.pl">Check in</a></li>
             <li><a href="/cgi-bin/koha/circ/renew.pl">Renew</a></li>
-            [% IF Branches.InIndependentBranchesMode %]
+            [% IF !Koha.Preference('IndependentBranchesTransfers') || CAN_user_superlibrarian %]
                 <li><a href="/cgi-bin/koha/circ/branchtransfers.pl">Transfer</a></li>
             [% END %]
             [% IF ( AutoLocation ) %][% ELSE %][% IF ( IndependentBranches ) %][% ELSE %]
index 10c3477..4859333 100644 (file)
                        <li>
                 <label for="tobranchcd">Destination library: </label>
                     <select name="tobranchcd" id="tobranchcd">
-                        [% PROCESS options_for_libraries libraries => Branches.all( selected => tobranchcd ) %]
+                        [% PROCESS options_for_libraries libraries => Branches.all( selected => tobranchcd, unfiltered => 1) %]
                     </select>
             </li>
             <li>
index f59fcaa..b1bac4a 100644 (file)
@@ -88,7 +88,7 @@
                 <h3>Transfers</h3>
 
                 <ul class="buttons-list">
-                    [% IF Branches.InIndependentBranchesMode %]
+                    [% IF !Koha.Preference('IndependentBranchesTransfers') || CAN_user_superlibrarian %]
                         <li>
                             <a class="circ-button" href="/cgi-bin/koha/circ/branchtransfers.pl"><i class="fa fa-exchange"></i> Transfer</a>
                         </li>