@@ -, +, @@ --- C4/VirtualShelves.pm | 3 +- C4/VirtualShelves/Page.pm | 8 +++- .../prog/en/modules/virtualshelves/shelves.tt | 35 ++++++++++++++++++-- .../opac-tmpl/prog/en/modules/opac-shelves.tt | 34 +++++++++++++++++++ 4 files changed, 74 insertions(+), 6 deletions(-) --- a/C4/VirtualShelves.pm +++ a/C4/VirtualShelves.pm @@ -255,7 +255,7 @@ from C4::Circulation. =cut sub GetShelfContents { - my ($shelfnumber, $row_count, $offset, $sortfield) = @_; + my ($shelfnumber, $row_count, $offset, $sortfield, $sort_direction ) = @_; my $dbh=C4::Context->dbh(); my $sth1 = $dbh->prepare("SELECT count(*) FROM virtualshelfcontents WHERE shelfnumber = ?"); $sth1->execute($shelfnumber); @@ -277,6 +277,7 @@ sub GetShelfContents { my @params = ($shelfnumber); if($sortfield) { $query .= " ORDER BY " . $sortfield; + $query .= " DESC " if ( uc($sort_direction) eq 'DESC' ); $query .= " DESC " if ($sortfield eq 'copyrightdate'); } if($row_count){ --- a/C4/VirtualShelves/Page.pm +++ a/C4/VirtualShelves/Page.pm @@ -249,7 +249,9 @@ sub shelfpage { my $items; my $tag_quantity; my $sortfield = ( $sorton ? $sorton : 'title' ); - ( $items, $totitems ) = GetShelfContents( $shelfnumber, $shelflimit, $shelfoffset, $sortfield ); + $sortfield = $query->param('sort') || $sortfield; ## Passed in sorting overrides default sorting + my $direction = $query->param('direction'); + ( $items, $totitems ) = GetShelfContents( $shelfnumber, $shelflimit, $shelfoffset, $sortfield, $direction ); for my $this_item (@$items) { my $biblionumber = $this_item->{'biblionumber'}; my $record = GetMarcBiblio($biblionumber); @@ -419,7 +421,7 @@ sub shelfpage { my $url = $type eq 'opac' ? "/cgi-bin/koha/opac-shelves.pl" : "/cgi-bin/koha/virtualshelves/shelves.pl"; my %qhash = (); - foreach (qw(display viewshelf sortfield)) { + foreach (qw(display viewshelf sortfield sort direction)) { $qhash{$_} = $query->param($_) if $query->param($_); } ( scalar keys %qhash ) and $url .= '?' . join '&', map { "$_=$qhash{$_}" } keys %qhash; @@ -459,6 +461,8 @@ 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; --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt @@ -202,15 +202,44 @@ function placeHold () {

[% END %] + [% IF direction == 'asc' %][% direction = 'desc' %][% ELSE %][% direction = 'asc' %][% END %]
[% pagination_bar %]
[% IF ( itemsloop ) %][% END %] + [% UNLESS ( item_level_itypes ) %][% END %] - - + + - + [% FOREACH itemsloo IN itemsloop %] --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt +++ a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt @@ -188,6 +188,11 @@ $(function() { alert(alertString2); } } + +$(document).ready(function() { + $('#sort-submit').hide(); +}); + //]]> @@ -287,6 +292,35 @@ $(function() { Print list + + + + + + + + [% IF ( manageshelf ) %] | --
 Item typeTitleAuthor + Title + [% IF sort == 'title' %] + [% IF direction == 'asc' %] + + [% ELSIF direction == 'desc' %] + + [% END %] + [% END %] + + Author + [% IF sort == 'author' %] + [% IF direction == 'asc' %] + + [% ELSIF direction == 'desc' %] + + [% END %] + [% END %] + Date addedCall number + Call number + [% IF sort == 'itemcallnumber' %] + [% IF direction == 'asc' %] + + [% ELSIF direction == 'desc' %] + + [% END %] + [% END %] +