bug: add items to label batch - need userenv loaded before call to SimpleSearch
authorMichael Hafen <mdhafen@tech.washk12.org>
Wed, 11 Mar 2009 19:25:40 +0000 (13:25 -0600)
committerGalen Charlton <galen.charlton@liblime.com>
Wed, 8 Apr 2009 18:01:27 +0000 (13:01 -0500)
Since I added more IndependantBranches code to my git repo I need
userenv loaded before SimpleSearch() is called.  I think
get_template_and_user() should be called as soon as possible.  In this
case it could mean two calls, but it has to be so.

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

index 140f5d7..a04a9dc 100755 (executable)
@@ -82,6 +82,18 @@ if ( $op eq "do_search" ) {
     $datefrom = $query->param('datefrom');
     $dateto   = $query->param('dateto');
 
+    ( $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,
+        }
+    );
+
     if ($datefrom) {
         $datefrom = C4::Dates->new($datefrom);
         $ccl_query .= ' and ' if $ccl_textbox;
@@ -177,18 +189,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,
-        }
-    );
-
     # build page nav stuff.
     my ( @field_data, @numbers );
     $total = $total_hits;