Bug 20730: Move the authentication block before doing anything
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 8 May 2018 17:27:38 +0000 (14:27 -0300)
committerFridolin Somers <fridolin.somers@biblibre.com>
Wed, 23 May 2018 19:11:25 +0000 (21:11 +0200)
No need to add more information here, it's self-explanatory...

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 43a297efc9b923ecfe5c703e2be4c99549b48954)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

serials/routing.pl

index 32f42e5..2201760 100755 (executable)
@@ -51,6 +51,16 @@ my $date_selected = $query->param('date_selected');
 $date_selected ||= q{};
 my $dbh = C4::Context->dbh;
 
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+    {
+        template_name   => 'serials/routing.tt',
+        query           => $query,
+        type            => 'intranet',
+        authnotrequired => 0,
+        flagsrequired   => { serials => 'routing' },
+    }
+);
+
 if($op eq 'delete'){
     delroutingmember($routingid,$subscriptionid);
 }
@@ -84,15 +94,6 @@ foreach my $dateseq (@{$serialdates}) {
     push @{$dates}, $d;
 }
 
-my ($template, $loggedinuser, $cookie)
-= get_template_and_user({template_name => 'serials/routing.tt',
-                               query => $query,
-                               type => 'intranet',
-                               authnotrequired => 0,
-                               flagsrequired => {serials => 'routing'},
-                               debug => 1,
-                               });
-
 my $member_loop = [];
 for my $routing ( @routinglist ) {
     my $member=GetMember('borrowernumber' => $routing->{borrowernumber});