From 099662b6fe92c8aae1b5d396c2075c51e6873839 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 19 Feb 2013 08:42:11 -0500 Subject: [PATCH] Bug 9458 - Add sorting to lists - QA Followup --- C4/VirtualShelves.pm | 2 +- C4/VirtualShelves/Page.pm | 10 ++++++---- .../prog/en/modules/virtualshelves/shelves.tt | 6 ++++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/C4/VirtualShelves.pm b/C4/VirtualShelves.pm index f632416..37babc1 100644 --- a/C4/VirtualShelves.pm +++ b/C4/VirtualShelves.pm @@ -277,7 +277,7 @@ sub GetShelfContents { my @params = ($shelfnumber); if($sortfield) { $query .= " ORDER BY " . $sortfield; - $query .= " DESC " if ( ( $sortfield eq 'copyrightdate' ) || ( $sort_direction eq 'desc' ) ); + $query .= " DESC " if ( $sort_direction eq 'desc' ); } if($row_count){ $query .= " LIMIT ?, ? "; diff --git a/C4/VirtualShelves/Page.pm b/C4/VirtualShelves/Page.pm index ab807da..3dfbe60 100644 --- a/C4/VirtualShelves/Page.pm +++ b/C4/VirtualShelves/Page.pm @@ -249,8 +249,12 @@ sub shelfpage { my $items; my $tag_quantity; my $sortfield = ( $sorton ? $sorton : 'title' ); - $sortfield = $query->param('sort') || $sortfield; ## Passed in sorting overrides default sorting - my $direction = $query->param('direction'); + $sortfield = $query->param('sort') || $sortfield || 'title'; ## Passed in sorting overrides default sorting + my $direction = $query->param('direction') || 'asc'; + $template->param( + sort => $sortfield, + direction => $direction, + ); ( $items, $totitems ) = GetShelfContents( $shelfnumber, $shelflimit, $shelfoffset, $sortfield, $direction ); for my $this_item (@$items) { my $biblionumber = $this_item->{'biblionumber'}; @@ -461,8 +465,6 @@ sub shelfpage { barshelvesloop => $barshelves, pubshelves => $total->{pubtotal}, pubshelvesloop => $pubshelves, - sort => $query->param('sort'), - direction => $query->param('direction'), ); output_html_with_http_headers $query, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt index e9f3994..6a82e2d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt @@ -219,6 +219,8 @@ function placeHold () { [% ELSIF direction == 'desc' %] [% END %] + [% ELSE %] + [% END %] @@ -229,6 +231,8 @@ function placeHold () { [% ELSIF direction == 'desc' %] [% END %] + [% ELSE %] + [% END %] Date added @@ -240,6 +244,8 @@ function placeHold () { [% ELSIF direction == 'desc' %] [% END %] + [% ELSE %] + [% END %]   -- 1.7.2.5