From 98143eabc7cf4a8ff67c67d4026688bef7f41c65 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 Signed-off-by: Jonathan Druart Signed-off-by: Jared Camins-Esakov (cherry picked from commit bc9f606ca7025417f3f2fddd393983cc0beec0ba) Solved Conflicts: C4/VirtualShelves/Page.pm koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt Signed-off-by: Bernardo Gonzalez Kriegel (cherry picked from commit bc9f606ca7025417f3f2fddd393983cc0beec0ba) --- C4/VirtualShelves.pm | 2 +- C4/VirtualShelves/Page.pm | 10 +++++---- .../prog/en/modules/virtualshelves/shelves.tt | 10 ++++++--- .../opac-tmpl/prog/en/modules/opac-shelves.tt | 22 ++++++++++++++++++- 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/C4/VirtualShelves.pm b/C4/VirtualShelves.pm index 9702ad9c00..46884169c0 100644 --- a/C4/VirtualShelves.pm +++ b/C4/VirtualShelves.pm @@ -276,7 +276,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 61a4565d28..33b6fc14d1 100644 --- a/C4/VirtualShelves/Page.pm +++ b/C4/VirtualShelves/Page.pm @@ -258,8 +258,12 @@ sub shelfpage { if ( $sortfield eq 'year' ) { $yearsort = 'year'; } - $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'}; @@ -480,8 +484,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 8fad486e88..746441cc59 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt @@ -204,7 +204,7 @@ function placeHold () {

[% END %] - [% IF direction == 'asc' %][% direction = 'desc' %][% ELSE %][% direction = 'asc' %][% END %] + [% IF direction == 'asc' %][% SET new_direction = 'desc' %][% ELSE %][% SET new_direction = 'asc' %][% END %]
[% pagination_bar %]
@@ -212,23 +212,27 @@ function placeHold () { [% UNLESS ( item_level_itypes ) %][% END %] diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt index 5a700a9c7d..f7c02d7f2c 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt @@ -317,8 +317,28 @@ $(document).ready(function() { [% END %] - + [% IF sort == 'copyrightdate' %] + + [% ELSE %] + + [% END %] + + + + + [% IF ( manageshelf ) %] | -- 2.39.5
Item type - Title + Title [% IF sort == 'title' %] [% IF direction == 'asc' %] [% ELSIF direction == 'desc' %] [% END %] + [% ELSE %] + [% END %] - Author + Author [% IF sort == 'author' %] [% IF direction == 'asc' %] [% ELSIF direction == 'desc' %] [% END %] + [% ELSE %] + [% END %] Date added