Bugzilla – Attachment 186356 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 OPAC
Bug-36188-Sort-lists-by-date-acquired-itemsdateacc.patch (text/plain), 5.68 KB, created by
Aleisha Amohia
on 2025-09-11 02:23:12 UTC
(
hide
)
Description:
Bug 36188: Sort lists by date acquired (items.dateaccessioned) in the OPAC
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2025-09-11 02:23:12 UTC
Size:
5.68 KB
patch
obsolete
>From 91f27aa2bf5abaaafbb8e5627b55ac519a348aa7 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 date acquired > (items.dateaccessioned) in the OPAC > >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. In the Staff client, 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 date acquired dates >5. In the staff client observe the list records are ordered by the 'Date >acquired' in descending order - i.e. titles with newest date acquired 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 acquired (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: baptiste <baptiste.bayche@inlibro.com> >Signed-off-by: Olivier V <olivier.vezina@inLibro.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > .../bootstrap/en/modules/opac-shelves.tt | 17 +++++++++++++++++ > opac/opac-shelves.pl | 5 +++-- > 2 files changed, 20 insertions(+), 2 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 875a88da234..182a4b02260 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >@@ -368,6 +368,18 @@ > <option value="dateadded" data-direction="asc">Date added (oldest to newest)</option> > [% END %] > </optgroup> >+ <optgroup label="Date acquired"> >+ [% IF sortfield == "dateaccessioned" && direction == 'asc' %] >+ <option value="dateaccessioned" data-direction="desc" selected="selected">Date acquired (newest to oldest)</option> >+ [% ELSE %] >+ <option value="dateaccessioned" data-direction="desc">Date acquired (newest to oldest)</option> >+ [% END %] >+ [% IF sortfield == "dateaccessioned" && direction == 'desc' %] >+ <option value="dateaccessioned" data-direction="asc" selected="selected">Date acquired (oldest to newest)</option> >+ [% ELSE %] >+ <option value="dateaccessioned" data-direction="asc">Date acquired (oldest to newest)</option> >+ [% END %] >+ </optgroup> > </select> > > <input type="submit" class="btn btn-primary btn-sm" id="sort-submit" value="Resort list" /> >@@ -647,6 +659,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> > [% IF Koha.Preference('OpacAllowPublicListCreation') OR public == 1 %] >diff --git a/opac/opac-shelves.pl b/opac/opac-shelves.pl >index 5f008cb0589..83bfb46fbc8 100755 >--- a/opac/opac-shelves.pl >+++ b/opac/opac-shelves.pl >@@ -154,7 +154,8 @@ 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 ( $sortfield eq 'copyrightdate' and C4::Context->preference('marcflavour') eq 'UNIMARC' ) { > $sortfield = 'publicationyear'; > } >@@ -330,7 +331,7 @@ if ( $op eq 'view' ) { > $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 ); >+ or !grep { $_ eq $sortfield } qw( title author copyrightdate itemcallnumber dateadded dateaccessioned ); > if ( $sortfield eq 'copyrightdate' and C4::Context->preference('marcflavour') eq 'UNIMARC' ) { > $sortfield = 'publicationyear'; > } >-- >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
|
186355
| 186356