Bug 6942 - Add link to manual to help/authorities/authorities-home.tt
[koha.git] / catalogue / search.pl
index e49507e..907efdb 100755 (executable)
@@ -294,7 +294,7 @@ if ( $template_type eq 'advsearch' ) {
         my $default_sort_by =
             C4::Context->preference('defaultSortField') . '_'
           . C4::Context->preference('defaultSortOrder');
-        $template->param( $default_sort_by => 1 );
+        $template->param( sort_by => $default_sort_by  );
     }
 
     # determine what to display next to the search boxes (ie, boolean option
@@ -369,7 +369,7 @@ if (   C4::Context->preference('defaultSortField')
 @sort_by = split("\0",$params->{'sort_by'}) if $params->{'sort_by'};
 $sort_by[0] = $default_sort_by unless $sort_by[0];
 foreach my $sort (@sort_by) {
-    $template->param($sort => 1);
+    $template->param($sort => 1) if $sort;
 }
 $template->param('sort_by' => $sort_by[0]);
 
@@ -471,7 +471,7 @@ my ( $error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit
 my @results;
 
 ## I. BUILD THE QUERY
-my $lang = C4::Output::getlanguagecookie($cgi);
+my $lang = C4::Templates::getlanguagecookie($cgi);
 ( $error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type) = buildQuery(\@operators,\@operands,\@indexes,\@limits,\@sort_by,$scan,$lang);
 
 ## parse the query_cgi string and put it into a form suitable for <input>s