From 026a3349d9e14cd1adeaf2a66d707d2f11532854 Mon Sep 17 00:00:00 2001 From: Joshua Ferraro Date: Mon, 29 Oct 2007 17:42:29 -0500 Subject: [PATCH] fixing re-sorting in staff client Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- C4/Search.pm | 43 +++++++++-- catalogue/search.pl | 7 +- .../prog/en/includes/resort_form.inc | 14 ++++ .../prog/en/modules/catalogue/advsearch.tmpl | 68 +---------------- .../prog/en/modules/catalogue/results.tmpl | 76 ++----------------- 5 files changed, 65 insertions(+), 143 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/resort_form.inc diff --git a/C4/Search.pm b/C4/Search.pm index 4027d35d5e..1df61cf3a0 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -342,16 +342,47 @@ sub getRecords { my $sort_by; foreach my $sort (@sort_by) { if ($sort eq "author_az") { - $sort_by.="1=1003 <i "; + $sort_by.="1=1003 sort( "yaz", $sort_by ) if $sort_by; + if ($sort_by) { + if ( $results[$i]->sort( "yaz", $sort_by ) < 0) { + warn "WARNING sort $sort_by failed"; + } + } } while ( ( my $i = ZOOM::event( \@zconns ) ) != 0 ) { my $ev = $zconns[ $i - 1 ]->last_event(); diff --git a/catalogue/search.pl b/catalogue/search.pl index 825101a5a2..0879c02072 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -343,7 +343,12 @@ my $params = $cgi->Vars; # sort by is used to sort the query my @sort_by; @sort_by = split("\0",$params->{'sort_by'}) if $params->{'sort_by'}; -# + +# FIXME: this is a quick hack +foreach my $sort (@sort_by) { + $template->param($sort => 1); +} + # Use the servers defined, or just search our local catalog(default) my @servers; @servers = split("\0",$params->{'server'}) if $params->{'server'}; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/resort_form.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/resort_form.inc new file mode 100644 index 0000000000..f46e23929b --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/resort_form.inc @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tmpl index 3824ed805f..6df5d5e239 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tmpl @@ -287,74 +287,10 @@ +
Sort by:

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl index 492011c832..d3b3bb25ce 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl @@ -179,84 +179,20 @@
-
+ " /> - +

Re-sort results + +

-
+ + -- 2.39.5