script now used only when currencies rates modified in acqui/acqui-home.pl page ...
[koha_fer] / search.pl
index 3a41869..0e59718 100755 (executable)
--- a/search.pl
+++ b/search.pl
 use strict;
 require Exporter;
 use CGI;
+use C4::Auth;
 use HTML::Template;
 use C4::Context;
 use C4::Search;
 use C4::Auth;
 use C4::Output;
+use C4::Interface::CGI::Output;
 
 my $query=new CGI;
 my $type=$query->param('type');
-warn $type;            # FIXME - What's this for?
 
 #(-e "opac") && ($type='opac');
 
 my ($loggedinuser, $cookie, $sessionID) = checkauth($query, ($type eq 'opac') ? (1) : (0));
-warn $type;            # FIXME - What's this for?
 
 my $startfrom=$query->param('startfrom');
 ($startfrom) || ($startfrom=0);
 
 my $subject=$query->param('subject');
-my $template;
 # if it's a subject we need to use the subject.tmpl
+my ($template, $loggedinuser, $cookie);
 if ($subject) {
-       $template = gettemplate("catalogue/subject.tmpl",0);
+       ($template, $loggedinuser, $cookie)
+               = get_template_and_user({template_name => "catalogue/subject.tmpl",
+                            query => $query,
+                            type => "intranet",
+                            authnotrequired => 0,
+                            flagsrequired => {catalogue => 1},
+                            debug => 1,
+                            });
 } else {
-       $template = gettemplate("catalogue/searchresults.tmpl", 0);
+       ($template, $loggedinuser, $cookie)
+               = get_template_and_user({template_name => "catalogue/searchresults.tmpl",
+                            query => $query,
+                            type => "intranet",
+                            authnotrequired => 0,
+                            flagsrequired => {catalogue => 1},
+                            debug => 1,
+                            });
 }
 
 # %env
@@ -69,7 +83,6 @@ foreach my $term (qw(keyword subject author illustrator itemnumber
                     publisher ttype))
 {
        my $value = $query->param($term);
-
        next unless defined $value && $value ne "";
                                # Skip blank search terms
        $search{$term} = $value;
@@ -186,5 +199,5 @@ if (C4::Context->preference('acquisitions') eq 'simple') {
 }
 
 # Print the page
-print $query->header(-cookie => $cookie), $template->output;
+output_html_with_http_headers $query, $cookie, $template->output;