Bugzilla – Attachment 162931 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 items.dateaccessioned in the OPAC
Bug-36188-Sort-lists-by-itemsdateaccessioned-in-th.patch (text/plain), 6.02 KB, created by
Biblibre Sandboxes
on 2024-03-07 20:11:28 UTC
(
hide
)
Description:
Bug 36188: Sort lists by items.dateaccessioned in the OPAC
Filename:
MIME Type:
Creator:
Biblibre Sandboxes
Created:
2024-03-07 20:11:28 UTC
Size:
6.02 KB
patch
obsolete
>From b498487012255a7b8e835291bf8d5c34ddb6cd8b Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Wed, 28 Feb 2024 05:28:57 +0000 >Subject: [PATCH] Bug 36188: Sort lists by items.dateaccessioned in the OPAC > >When a list is sorted by dateaccessioned 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. In the Staff client, go to the Lists module and create a new list >3. Set the 'Sort this list by' dropdown = 'Date accessioned' >4. Add several barcodes to the list belonging to items with a range of different items.dateaccessioned dates >5. In the staff client observe the list records are ordered by the 'Date >accessioned' in descending order - i.e. titles with newest dateaccessioned are displayed first >6. In a new browser window navigate to the list in the Koha OPAC >7. Confirm the list titles in the OPAC are ordered in the same order as the staff >client >8. In the OPAC click on the 'Sort' button and select 'Date accession (oldest to >newest) >9. Confirm the OPAC list order reverses >10. In the OPAC choose other values from the 'Sort' button and confirm >the list is re-sorted correctly > >Sponsored-By: The Treasury, New Zealand >Signed-off-by: esther <esther@bywatersolutions.com> >--- > .../bootstrap/en/modules/opac-shelves.tt | 18 ++++++++++++++++++ > opac/opac-shelves.pl | 12 +++++++++--- > 2 files changed, 27 insertions(+), 3 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >index d96774390d..6db74e677f 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >@@ -340,6 +340,19 @@ > <option value="dateadded" data-direction="asc">Date added (oldest to newest)</option> > [% END %] > </optgroup> >+ <optgroup label="Date accessioned"> >+ [% IF sortfield == "dateaccessioned" && direction == 'asc' %] >+ <option value="dateaccessioned" data-direction="desc" selected="selected">Date accessioned (newest to oldest)</option> >+ [% ELSE %] >+ <option value="dateaccessioned" data-direction="desc">Date accessioned (newest to oldest)</option> >+ [% END %] >+ [% IF sortfield == "dateaccessioned" && direction == 'desc' %] >+ <option value="dateaccessioned" data-direction="asc" selected="selected">Date accessioned (oldest to newest)</option> >+ >+ [% ELSE %] >+ <option value="dateaccessioned" data-direction="asc">Date accessioned (oldest to newest)</option> >+ [% END %] >+ </optgroup> > </select> > > <input type="submit" class="btn btn-primary btn-sm" id="sort-submit" value="Resort list" /> >@@ -627,6 +640,11 @@ > [% ELSE %] > <option value="dateadded">Date added</option> > [% END %] >+ [% IF shelf.sortfield == "dateaccessioned" %] >+ <option value="dateaccessioned" selected="selected">Date accessioned</option> >+ [% ELSE %] >+ <option value="dateaccessioned">Date accessioned</option> >+ [% END %] > </select> > </li> > [% IF Koha.Preference('OpacAllowPublicListCreation') OR public == 1 %] >diff --git a/opac/opac-shelves.pl b/opac/opac-shelves.pl >index 85bfb38c6b..c72b6565d8 100755 >--- a/opac/opac-shelves.pl >+++ b/opac/opac-shelves.pl >@@ -147,7 +147,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 ); >@@ -311,9 +311,15 @@ if ( $op eq 'view' ) { > $sortfield = $shelf->sortfield; > $direction = 'asc'; > } >- $direction = $query->param('direction') if $query->param('direction'); >+ >+ # By default order descending if sorting by dateaccessioned >+ if ( $query->param('direction') ) { >+ $direction = $query->param('direction'); >+ } elsif ( $sortfield eq 'dateaccessioned' and !$query->param('direction') ) { >+ $direction = 'desc'; >+ } > $direction = 'asc' if !$direction or ( $direction ne 'asc' and $direction ne 'desc' ); >- $sortfield = 'title' if !$sortfield or !grep { $_ eq $sortfield } qw( title author copyrightdate itemcallnumber dateadded ); >+ $sortfield = 'title' if !$sortfield or !grep { $_ eq $sortfield } qw( title author copyrightdate itemcallnumber dateadded dateaccessioned ); > > my ( $page, $rows ); > unless ( $query->param('print') or $query->param('rss') ) { >-- >2.30.2
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