Bug 19039: Results of virtual shelves (lists) not sortable by date
authorMaryse Simard <maryse.simard@inlibro.com>
Tue, 12 Jun 2018 17:42:23 +0000 (13:42 -0400)
committerNick Clemens <nick@bywatersolutions.com>
Fri, 24 Aug 2018 16:23:26 +0000 (16:23 +0000)
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'

Signed-off-by: Dilan Johnpullé <dilan@calyx.net.au>

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt
virtualshelves/shelves.pl

index 0c7ee12..68b47d7 100644 (file)
                        <img src="[% interface | html %]/[% theme | html %]/img/ascdesc.gif" alt="" />
                    [% END %]
                  </th>
-                <th>Date added</th>
+                <th>
+                    <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&amp;shelfnumber=[% shelf.shelfnumber %]&amp;sortfield=dateadded&amp;direction=[% IF sortfield != 'dateadded' %]asc[% ELSE %][% new_direction %][% END %]">Date added</a>
+                    [% IF sortfield == 'dateadded' %]
+                        <img src="[% interface %]/[% theme %]/img/[% direction %].gif" alt="[% direction %] sort" />
+                    [% ELSE %]
+                        <img src="[% interface %]/[% theme %]/img/ascdesc.gif" alt="" />
+                    [% END %]
+                </th>
                 <th>
                     <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&amp;shelfnumber=[% shelf.shelfnumber | html %]&amp;sortfield=itemcallnumber&amp;direction=[% IF sortfield != 'itemcallnumber' %]asc[% ELSE %][% new_direction | html %][% END %]">Call number</a>
                    [% IF sortfield == 'itemcallnumber' %]
index 192580f..bc54559 100755 (executable)
@@ -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 );