[Koha-patches] [PATCH] (bug #2881) preselect default sorting
Nahuel ANGELINETTI
nahuel.angelinetti at biblibre.com
Tue Dec 23 15:00:27 CET 2008
This patch just set a variable with the name of default sorting, and value 1
---
catalogue/search.pl | 7 ++++++-
opac/opac-search.pl | 7 ++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/catalogue/search.pl b/catalogue/search.pl
index 13b137b..014d4f6 100755
--- a/catalogue/search.pl
+++ b/catalogue/search.pl
@@ -265,7 +265,12 @@ if ( $template_type eq 'advsearch' ) {
my $secondary_servers_loop;# = displaySecondaryServers();
$template->param(outer_sup_servers_loop => $secondary_servers_loop,);
-
+
+ # set the default sorting
+ my $default_sort_by = C4::Context->preference('defaultSortField')."_".C4::Context->preference('defaultSortOrder')
+ if (C4::Context->preference('OPACdefaultSortField') && C4::Context->preference('OPACdefaultSortOrder'));
+ $template->param($default_sort_by => 1);
+
# determine what to display next to the search boxes (ie, boolean option
# shouldn't appear on the first one, scan indexes should, adding a new
# box should only appear on the last, etc.
diff --git a/opac/opac-search.pl b/opac/opac-search.pl
index 21dc131..0acd00c 100755
--- a/opac/opac-search.pl
+++ b/opac/opac-search.pl
@@ -179,7 +179,12 @@ if ( $template_type eq 'advsearch' ) {
my $secondary_servers_loop;# = displaySecondaryServers();
$template->param(outer_sup_servers_loop => $secondary_servers_loop,);
-
+
+ # set the default sorting
+ my $default_sort_by = C4::Context->preference('OPACdefaultSortField')."_".C4::Context->preference('OPACdefaultSortOrder')
+ if (C4::Context->preference('OPACdefaultSortField') && C4::Context->preference('OPACdefaultSortOrder'));
+ $template->param($default_sort_by => 1);
+
# determine what to display next to the search boxes (ie, boolean option
# shouldn't appear on the first one, scan indexes should, adding a new
# box should only appear on the last, etc.
--
1.5.6.3
More information about the Koha-patches
mailing list