Bugzilla – Attachment 172025 Details for
Bug 36188
Allow to sort lists by items.dateaccessioned of item records
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36188: Sort lists by Date acquired (items.dateaccessioned) in the staff client
Bug-36188-Sort-lists-by-Date-acquired-itemsdateacc.patch (text/plain), 9.07 KB, created by
Aleisha Amohia
on 2024-09-26 19:05:44 UTC
(
hide
)
Description:
Bug 36188: Sort lists by Date acquired (items.dateaccessioned) in the staff client
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2024-09-26 19:05:44 UTC
Size:
9.07 KB
patch
obsolete
>From 559c0054633f7c4a13b18b5a8ca41889a4caaff6 Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Wed, 28 Feb 2024 05:26:25 +0000 >Subject: [PATCH] Bug 36188: Sort lists by Date acquired > (items.dateaccessioned) in the staff client > >When a list is sorted by date acquired it should be ordered descending by default. This is to ensure the newest items are displayed first. > >Test plan: >1. Apply patches and restart services >2. Go to the Lists module and create a new list >3. Set the 'Sort this list by' dropdown = 'Date acquired' >4. Add several barcodes to the list belonging to items with a range of different items.dateaccessioned dates (952$d subfields) >5. Observe the list records are ordered by the 'Date acquired' >column: >- Records with the newest date acquired values displayed first. >- The date acquired value for each title item record is listed in this column. >6. Switch to order date acquired ascending by clicking on the 'Date >acquired' column label - records with the oldest date acquired >should be displayed first. >7. Edit the list. Change the 'Sort this list by' dropdown to 'Title' >8. Notice the list records are ordered by the 'Title' column in an >ascending order - A-Z alphabetically. > >Sponsored-By: The Treasury, New Zealand >--- > .../prog/en/modules/virtualshelves/shelves.tt | 25 +++++++++++++++++++ > .../virtualshelves/tables/shelves_results.tt | 2 +- > virtualshelves/shelves.pl | 9 +++++-- > 3 files changed, 33 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 25929c88e82..1191910515c 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 %] > <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&shelfnumber=[% shelf.shelfnumber | uri %]&sortfield=itemcallnumber&direction=[% IF sortfield != 'itemcallnumber' %]asc[% ELSE %][% new_direction | uri %][% END %]">Call number</a> > </th> >+ [% IF sortfield == 'dateaccessioned' %] >+ <th class="sorting_[% direction | html %]"> >+ [% ELSE %] >+ <th class="sorting"> >+ [% END %] >+ <a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&shelfnumber=[% shelf.shelfnumber | uri %]&sortfield=dateaccessioned&direction=[% IF sortfield != 'dateaccessioned' %]asc[% ELSE %][% new_direction | uri %][% END %]">Date acquired</a> >+ >+ </th> > </tr> > </thead> > [% FOREACH itemsloo IN itemsloop %] >@@ -383,6 +391,17 @@ > [% END # /FOREACH item %] > </ul> > </td> >+ <td> >+ <ul> >+ [% FOREACH item IN itemsloo.ITEM_RESULTS %] >+ <li> >+ [% IF (item.dateaccessioned ) %] >+ [% item.dateaccessioned | $KohaDates %] >+ [% END %] >+ </li> >+ [% END %] >+ </ul> >+ </td> > </tr> > [% END #/FOREACH itemsloo %] > </table> <!-- /#searchresults --> >@@ -452,6 +471,11 @@ > [% ELSE %] > <option value="dateadded">Date added</option> > [% END %] >+ [% IF shelf.sortfield == "dateaccessioned" %] >+ <option value="dateaccessioned" selected="selected">Date acquired</option> >+ [% ELSE %] >+ <option value="dateaccessioned">Date acquired</option> >+ [% END %] > </select> > </li> > <li> >@@ -534,6 +558,7 @@ > <option value="copyrightdate">Copyrightdate</option> > <option value="itemcallnumber">Call number</option> > <option value="dateadded">Date added</option> >+ <option value="dateaccessioned">Date acquired</option> > </select> > </th> > <th></th> >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 de301479f3a..900bfdfbdcd 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": > "<a href='/cgi-bin/koha/members/moremember.pl?borrowernumber=[% d.owner | html %]'>[% d.firstname | html | $To %] [% d.surname | html | $To %]</a>", > "dt_sortby": >- [% IF d.sortby == "author" %]"<span>Author</span>"[% ELSIF d.sortby == "copyrightdate" %]"<span>Year</span>"[% ELSIF d.sortby == "itemcallnumber" %]"<span>Call number</span>"[% ELSIF d.sortby == "dateadded" %]"<span>Date added</span>"[% ELSE %]"<span>Title</span>"[% END %], >+ [% IF d.sortby == "author" %]"<span>Author</span>"[% ELSIF d.sortby == "copyrightdate" %]"<span>Year</span>"[% ELSIF d.sortby == "itemcallnumber" %]"<span>Call number</span>"[% ELSIF d.sortby == "dateadded" %]"<span>Date added</span>"[% ELSIF d.sortby == "dateaccessioned" %]"<span>Date acquired</span>"[% ELSE %]"<span>Title</span>"[% END %], > "dt_created_on": > "[% d.created_on | $KohaDates %]", > "dt_modification_time": >diff --git a/virtualshelves/shelves.pl b/virtualshelves/shelves.pl >index e3e7a868e41..b15641a7ada 100755 >--- a/virtualshelves/shelves.pl >+++ b/virtualshelves/shelves.pl >@@ -120,7 +120,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 ); >@@ -278,9 +278,13 @@ 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'; >+ >+ # If sorting by dateaccessioned set direction to descending by default >+ $direction = 'desc' if $sortfield eq 'dateaccessioned'; >+ > my $rows; > if ( $query->param('print') ) { > $page = ""; >@@ -326,6 +330,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.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 36188
:
162524
|
162525
|
162548
|
162549
|
162554
|
162555
|
162606
|
162607
|
162931
|
163100
|
163101
|
166472
|
172025
|
172026
|
172050
|
172051
|
176735
|
176736
|
176737
|
176738
|
176739