fix calls to get_template_and_user in label-item-search.pl
authorMichael Hafen <mdhafen@tech.washk12.org>
Thu, 16 Oct 2008 19:59:44 +0000 (13:59 -0600)
committerHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Wed, 12 Nov 2008 14:00:44 +0000 (15:00 +0100)
remove extra flagsrequired line.
move call in first branch to the top.
  This will be important is IndepenantBranches code is later added to,
for example, C4::Items::get_itemnumbers_of()

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
labels/label-item-search.pl

index 6871616..9f97dfb 100755 (executable)
@@ -86,6 +86,17 @@ if ( $op eq "do_search" ) {
 }
 
 if ( $show_results ) {
+  ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+        {
+            template_name   => "labels/result.tmpl",
+            query           => $query,
+            type            => "intranet",
+            authnotrequired => 0,
+            flagsrequired   => { catalogue => 1 },
+            debug           => 1,
+        }
+    );
+
        my $hits = $show_results;
         my (@results, @items);
         # This code needs to be refactored using these subs...
@@ -126,18 +137,6 @@ if ( $show_results ) {
         $debug and warn "**********\@results**********\n";
         $debug and warn Dumper(@results);
   
-  ( $template, $loggedinuser, $cookie ) = get_template_and_user(
-        {
-            template_name   => "labels/result.tmpl",
-            query           => $query,
-            type            => "intranet",
-            authnotrequired => 0,
-            flagsrequired   => { borrowers => 1 },
-            flagsrequired   => { catalogue => 1 },
-            debug           => 1,
-        }
-    );
-
     my @field_data = ();
 
        # FIXME: this relies on symmetric order of CGI params that IS NOT GUARANTEED by spec.