Bugzilla – Attachment 4139 Details for
Bug 6092
default sort field and order when syspref are NULL
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
BUG6092 default sort field and order when syspref are NULL
BUG6092-default-sort-field-and-order-when-syspref-.patch (text/plain), 4.84 KB, created by
Chris Cormack
on 2011-05-17 08:04:46 UTC
(
hide
)
Description:
BUG6092 default sort field and order when syspref are NULL
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2011-05-17 08:04:46 UTC
Size:
4.84 KB
patch
obsolete
>From 6fc6ba64e4505f0809e5f47c46d669882ca8f80d Mon Sep 17 00:00:00 2001 >From: Fridolyn SOMERS <fridolyn.somers@progilone.fr> >Date: Wed, 6 Apr 2011 16:44:07 +0200 >Subject: [PATCH] BUG6092 default sort field and order when syspref are NULL > >Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> >--- > catalogue/search.pl | 10 +++++----- > .../en/modules/admin/preferences/searching.pref | 2 ++ > opac/opac-search.pl | 10 +++++----- > 3 files changed, 12 insertions(+), 10 deletions(-) > >diff --git a/catalogue/search.pl b/catalogue/search.pl >index e1e9a98..ae1218a 100755 >--- a/catalogue/search.pl >+++ b/catalogue/search.pl >@@ -193,6 +193,11 @@ if($cgi->cookie("holdfor")){ > ); > } > >+# Default sort field and order >+my $default_sort_field = C4::Context->preference('defaultSortField') || 'relevance'; # relevance field by default >+my $default_sort_order = C4::Context->preference('defaultSortOrder') || 'dsc'; # decreasing order by default >+my $default_sort_by = $default_sort_field.'_'.$default_sort_order; >+ > ## URI Re-Writing > # Deprecated, but preserved because it's interesting :-) > # The same thing can be accomplished with mod_rewrite in >@@ -289,8 +294,6 @@ if ( $template_type eq 'advsearch' ) { > $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 >@@ -354,9 +357,6 @@ 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') >- 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]; > foreach my $sort (@sort_by) { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >index 12075ec..476e3c1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >@@ -100,6 +100,7 @@ Searching: > author: author > - ',' > - pref: defaultSortOrder >+ default: dsc > choices: > asc: ascending. > dsc: descending. >@@ -132,6 +133,7 @@ Searching: > author: author > - "," > - pref: OPACdefaultSortOrder >+ default: dsc > choices: > asc: ascending. > dsc: descending. >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index 68018b6..c51d71f 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -118,6 +118,11 @@ if (C4::Context->preference('TagsEnabled')) { > } > } > >+# Default sort field and order >+my $default_sort_field = C4::Context->preference('OPACdefaultSortField') || 'relevance'; # relevance field by default >+my $default_sort_order = C4::Context->preference('OPACdefaultSortOrder') || 'dsc'; # decreasing order by default >+my $default_sort_by = $default_sort_field.'_'.$default_sort_order; >+ > ## URI Re-Writing > # Deprecated, but preserved because it's interesting :-) > # The same thing can be accomplished with mod_rewrite in >@@ -207,8 +212,6 @@ if ( $template_type && $template_type eq 'advsearch' ) { > $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 >@@ -273,9 +276,6 @@ $tag = $params->{tag} if $params->{tag}; > # 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('OPACdefaultSortField')."_".C4::Context->preference('OPACdefaultSortOrder') >- if (C4::Context->preference('OPACdefaultSortField') && C4::Context->preference('OPACdefaultSortOrder')); >- > @sort_by = split("\0",$params->{'sort_by'}) if $params->{'sort_by'}; > $sort_by[0] = $default_sort_by if !$sort_by[0] && defined($default_sort_by); > foreach my $sort (@sort_by) { >-- >1.7.4.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 6092
:
3750
| 4139