[Koha-patches] [PATCH] fix calls to get_template_and_user in label-item-search.pl

Michael Hafen mdhafen at tech.washk12.org
Tue Oct 7 21:15:34 CEST 2008


make debug conditional in call.
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()
---
 labels/label-item-search.pl |   25 ++++++++++++-------------
 1 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/labels/label-item-search.pl b/labels/label-item-search.pl
index 6871616..8ce38cc 100755
--- a/labels/label-item-search.pl
+++ b/labels/label-item-search.pl
@@ -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           => $debug,
+        }
+    );
+
 	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.
@@ -206,7 +205,7 @@ else {
             type            => "intranet",
             authnotrequired => 0,
             flagsrequired   => { catalogue => 1 },
-            debug           => 1,
+            debug           => $debug,
         }
     );
     my $itemtypes = GetItemTypes;
-- 
1.5.4.3




More information about the Koha-patches mailing list