From 824d50c50dc2c1754bb01cc73dcf9b7cb9145f2d Mon Sep 17 00:00:00 2001 From: Joshua Ferraro Date: Sun, 25 Nov 2007 18:46:35 -0600 Subject: [PATCH] forward-porting default sort by options Signed-off-by: Joshua Ferraro --- catalogue/search.pl | 3 ++- koha-tmpl/intranet-tmpl/prog/en/includes/resort_form.inc | 2 +- koha-tmpl/opac-tmpl/prog/en/includes/resort_form.inc | 2 +- opac/opac-search.pl | 4 ++++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/catalogue/search.pl b/catalogue/search.pl index d98c5adfdc..0b6fba641f 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -337,7 +337,8 @@ my $params = $cgi->Vars; # sort by is used to sort the query # in theory can have more than one but generally there's just one my @sort_by; -my $default_sort_by = C4::Context->preference('defaultSortField')."_".C4::Context->preference('defaultSortOrder'); +my $default_sort_by = C4::Context->preference('defaultSortField')."_".C4::Context->preference('defaultSortOrder') + if (C4::Context->preference('defaultSortField') && C4::Context->preference('defaultSortOrder')); @sort_by = split("\0",$params->{'sort_by'}) if $params->{'sort_by'}; $sort_by[0] = $default_sort_by unless $sort_by[0]; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/resort_form.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/resort_form.inc index 315d382c7f..fcbfb76350 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/resort_form.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/resort_form.inc @@ -1,4 +1,4 @@ - + diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/resort_form.inc b/koha-tmpl/opac-tmpl/prog/en/includes/resort_form.inc index 315d382c7f..fcbfb76350 100644 --- a/koha-tmpl/opac-tmpl/prog/en/includes/resort_form.inc +++ b/koha-tmpl/opac-tmpl/prog/en/includes/resort_form.inc @@ -1,4 +1,4 @@ - + diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 044b2a0091..7b50134094 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -335,8 +335,12 @@ my $params = $cgi->Vars; # Params that can have more than one value # sort by is used to sort the query # in theory can have more than one but generally there's just one +my $default_sort_by = C4::Context->preference('OPACdefaultSortField')."_".C4::Context->preference('OPACdefaultSortOrder') + if (C4::Context->preference('OPACdefaultSortField') && C4::Context->preference('OPACdefaultSortOrder')); + my @sort_by; @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); } -- 2.39.5