From 1d5b96672821f04f78e03c3fc3140e570f4742c6 Mon Sep 17 00:00:00 2001 From: Maryse Simard Date: Tue, 12 Jun 2018 13:42:23 -0400 Subject: [PATCH] Bug 19039: Results of virtual shelves (lists) not sortable by date In the staff client, when viewing the content of a list, it can be sorted by 'title', 'author' or 'call number' but not by 'date added'. Test plan: 1) In the staff client, view a list containing several items 2) Notice that you can't sort by 'date added' 3) Apply the patch 4) Repeat step 1 5) The list can now be sorted by 'date added' --- .../intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt | 9 ++++++++- virtualshelves/shelves.pl | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) 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 35a70ff..760e6b9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt @@ -182,7 +182,14 @@ [% END %] - Date added + + Date added + [% IF sortfield == 'dateadded' %] + [% direction %] sort + [% ELSE %] + + [% END %] + Call number [% IF sortfield == 'itemcallnumber' %] diff --git a/virtualshelves/shelves.pl b/virtualshelves/shelves.pl index 192580f..bc54559 100755 --- a/virtualshelves/shelves.pl +++ b/virtualshelves/shelves.pl @@ -233,7 +233,7 @@ if ( $op eq 'view' ) { if ( $shelf ) { if ( $shelf->can_be_viewed( $loggedinuser ) ) { my $sortfield = $query->param('sortfield') || $shelf->sortfield || 'title'; # Passed in sorting overrides default sorting - $sortfield = 'title' unless grep {/^$sortfield$/}qw( title author copyrightdate itemcallnumber ); + $sortfield = 'title' unless grep {/^$sortfield$/}qw( title author copyrightdate itemcallnumber dateadded ); my $direction = $query->param('direction') || 'asc'; $direction = 'asc' if $direction ne 'asc' and $direction ne 'desc'; my ( $rows, $page ); -- 2.7.4