From 82651461ab68483ad56f63dfb90529fe574bd326 Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Wed, 28 Feb 2024 05:26:25 +0000 Subject: [PATCH] Bug 36188: Sort lists by items.dateaccessioned in the staff client WIP Sponsored-By: The Treasury, New Zealand --- .../prog/en/modules/virtualshelves/shelves.tt | 25 +++++++++++++++++++ .../virtualshelves/tables/shelves_results.tt | 2 +- virtualshelves/shelves.pl | 5 ++-- 3 files changed, 29 insertions(+), 3 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 b80a7fbe69d..44656985502 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt @@ -315,6 +315,14 @@ [% END %] Call number + [% IF sortfield == 'dateaccessioned' %] + + [% ELSE %] + + [% END %] + Date accessioned + + [% FOREACH itemsloo IN itemsloop %] @@ -383,6 +391,17 @@ [% END # /FOREACH item %] + + + [% END #/FOREACH itemsloo %] @@ -452,6 +471,11 @@ [% ELSE %] [% END %] + [% IF shelf.sortfield == "dateaccessioned" %] + + [% ELSE %] + + [% END %]
  • @@ -526,6 +550,7 @@ + diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/tables/shelves_results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/tables/shelves_results.tt index a25ee522592..ecd6e3687f7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/tables/shelves_results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/tables/shelves_results.tt @@ -20,7 +20,7 @@ "dt_owner": "[% d.firstname | html | $To %] [% d.surname | html | $To %]", "dt_sortby": - [% IF d.sortby == "author" %]"Author"[% ELSIF d.sortby == "copyrightdate" %]"Year"[% ELSIF d.sortby == "itemcallnumber" %]"Call number"[% ELSIF d.sortby == "dateadded" %]"Date added"[% ELSE %]"Title"[% END %], + [% IF d.sortby == "author" %]"Author"[% ELSIF d.sortby == "copyrightdate" %]"Year"[% ELSIF d.sortby == "itemcallnumber" %]"Call number"[% ELSIF d.sortby == "dateadded" %]"Date added"[% ELSIF d.sortby == "dateaccessioned" %]"Date accessioned"[% ELSE %]"Title"[% END %], "dt_created_on": "[% d.created_on | $KohaDates %]", "dt_modification_time": diff --git a/virtualshelves/shelves.pl b/virtualshelves/shelves.pl index a4a6e41ec71..546514eb938 100755 --- a/virtualshelves/shelves.pl +++ b/virtualshelves/shelves.pl @@ -113,7 +113,7 @@ if ( $op eq 'add_form' ) { if ( $shelf ) { $op = $referer; my $sortfield = $query->param('sortfield'); - $sortfield = 'title' unless grep { $_ eq $sortfield } qw( title author copyrightdate itemcallnumber dateadded ); + $sortfield = 'title' unless grep { $_ eq $sortfield } qw( title author copyrightdate itemcallnumber dateadded dateaccessioned ); if ( $shelf->can_be_managed( $loggedinuser ) ) { $shelf->shelfname( scalar $query->param('shelfname') ); $shelf->sortfield( $sortfield ); @@ -268,7 +268,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 { $_ eq $sortfield } qw( title author copyrightdate itemcallnumber dateadded ); + $sortfield = 'title' unless grep { $_ eq $sortfield } qw( title author copyrightdate itemcallnumber dateadded dateaccessioned ); my $direction = $query->param('direction') || 'asc'; $direction = 'asc' if $direction ne 'asc' and $direction ne 'desc'; my ( $rows, $page ); @@ -314,6 +314,7 @@ if ( $op eq 'view' ) { $this_item->{part_name} = $biblio->part_name; $this_item->{author} = $biblio->author; $this_item->{dateadded} = $content->dateadded; + $this_item->{dateaccessioned} = $biblio->items->get_column("dateaccessioned"); $this_item->{imageurl} = $itemtype ? C4::Koha::getitemtypeimagelocation( 'intranet', $itemtype->imageurl ) : q{}; $this_item->{description} = $itemtype ? $itemtype->description : q{}; #FIXME Should this be translated_description ? $this_item->{notforloan} = $itemtype->notforloan if $itemtype; -- 2.20.1