Bug 36188

Summary: Allow to sort lists by items.dateaccessioned of item records
Product: Koha Reporter: Alex Buckley <alexbuckley>
Component: ListsAssignee: Alex Buckley <alexbuckley>
Status: Passed QA --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: aleisha, baptiste.bayche, esther.melander, koha, lucas, m.de.rooy, ovezina
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: Sponsored Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 36188: Sort lists by items.dateaccessioned in the staff client
Bug 36188: Sort lists by items.dateaccessioned in the OPAC
Bug 36188: Sort lists by items.dateaccessioned in the staff client
Bug 36188: Sort lists by items.dateaccessioned in the OPAC
Bug 36188: Sort lists by items.dateaccessioned in the staff client
Bug 36188: Sort lists by items.dateaccessioned in the OPAC
List sort in the staff interface
Different list sort in the OPAC
Bug 36188: Sort lists by items.dateaccessioned in the OPAC
Bug 36188: Sort lists by Date acquired (items.dateaccessioned) in the staff client
Bug 36188: Sort lists by date acquired (items.dateaccessioned) in the OPAC
Bug 36188: Sort lists by date acquired (items.dateaccessioned) in the OPAC
Bug 36188: Sort lists by Date acquired (items.dateaccessioned) in the staff client
Bug 36188: Sort lists by date acquired (items.dateaccessioned) in the OPAC
Bug 36188: Sort lists by Date acquired (items.dateaccessioned) in the staff client
Bug 36188: Sort lists by date acquired (items.dateaccessioned) in the OPAC
Bug 36188: Sort lists by Date acquired (items.dateaccessioned) in the staff client
Bug 36188: Sort lists by date acquired (items.dateaccessioned) in the OPAC
Bug 36188: Sort lists by Date acquired (items.dateaccessioned) in the staff client
Bug 36188: Sort lists by date acquired (items.dateaccessioned) in the OPAC
Bug 36188: (QA follow-up) Tidy code

Description Alex Buckley 2024-02-28 05:26:09 UTC
Currently you can sort a list by 'Date added', but this is the date the record was added to the list.

It would be nice if libraries could sort lists by the items.dateaccessioned of linked items. 

A use case for this would be a 'New resources' list - where the library curates a list of records including bib records who have linked items recently purchased. The library would want the list to be sorted by items.dateaccessioned descending i.e. newest first.
Comment 1 Alex Buckley 2024-02-28 05:30:20 UTC
Created attachment 162524 [details] [review]
Bug 36188: Sort lists by items.dateaccessioned in the staff client

WIP

Sponsored-By: The Treasury, New Zealand
Comment 2 Alex Buckley 2024-02-28 05:30:37 UTC
Created attachment 162525 [details] [review]
Bug 36188: Sort lists by items.dateaccessioned in the OPAC

WIP

Sponsored-By: The Treasury, New Zealand
Comment 3 Alex Buckley 2024-02-28 05:31:04 UTC
Patches written, test plans to come. 

Not ready for testing yet.
Comment 4 Alex Buckley 2024-02-28 21:54:59 UTC
Created attachment 162548 [details] [review]
Bug 36188: Sort lists by items.dateaccessioned in the staff client

WIP

Sponsored-By: The Treasury, New Zealand
Comment 5 Alex Buckley 2024-02-28 21:55:13 UTC
Created attachment 162549 [details] [review]
Bug 36188: Sort lists by items.dateaccessioned in the OPAC

WIP

Sponsored-By: The Treasury, New Zealand
Comment 6 Alex Buckley 2024-02-29 01:08:12 UTC
Created attachment 162554 [details] [review]
Bug 36188: Sort lists by items.dateaccessioned in the staff client

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. 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. Observe the list records are ordered by the 'Date accessioned'
column:
- Records with the newest dateaccessioned values displayed first.
- The items.dateaccessioned value for each title item record is listed in this column.
6. Switch to order dateaccessioned ascending by clicking on the 'Date
accessioned' column label - records with the oldest dateaccessioned
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
Comment 7 Alex Buckley 2024-02-29 01:08:26 UTC
Created attachment 162555 [details] [review]
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
Comment 8 Alex Buckley 2024-02-29 01:39:47 UTC
Patches updated and test plans added. 

As noted in the commit messages, when sorting by dateaccessioned the order will be descending by default - i.e. titles with newest dateaccessioned will be displayed first. 

This is different to the default ascending order for all other sort options.

This is ready to test.
Comment 9 Owen Leonard 2024-02-29 15:26:08 UTC
Is there a difference in the way sort is calculated between the staff interface and the OPAC? I'm seeing some differences with my own testing data. I'm wondering if it has to do with how titles with the same dateaccessioned are handled.

I'm a little bit concerned about using dateaccessioned for sorting, since ordering search results by date uses other data. I imagine it might also be confusing to users who see a title at the top of the list which isn't new per se, it just has a new copy.
Comment 10 Owen Leonard 2024-02-29 15:36:50 UTC
(In reply to Owen Leonard from comment #9)
 
> I'm a little bit concerned about using dateaccessioned for sorting

Ignore me, I wasn't thinking about the fact that there is already a "Date added" sorting option.

I wonder if there is a more user-friendly way to say "Date accessioned?" Some way to express that the order is by newest item?
Comment 11 Owen Leonard 2024-02-29 15:48:29 UTC
Created attachment 162606 [details]
List sort in the staff interface

Note that I edited one item in each record to have the same dateaccessioned.
Comment 12 Owen Leonard 2024-02-29 15:49:23 UTC
Created attachment 162607 [details]
Different list sort in the OPAC
Comment 13 Alex Buckley 2024-02-29 20:16:17 UTC
(In reply to Owen Leonard from comment #10)
> (In reply to Owen Leonard from comment #9)
>  
> > I'm a little bit concerned about using dateaccessioned for sorting
> 
> Ignore me, I wasn't thinking about the fact that there is already a "Date
> added" sorting option.
> 
> I wonder if there is a more user-friendly way to say "Date accessioned?"
> Some way to express that the order is by newest item?

Hi Owen, 

Thanks for your feedback and taking a look!

Looking at your screenshots now.

Do you think 'Date acquired' might be a more helpful wording? Happy to change the wording.

Alex
Comment 14 Lucas Gass (lukeg) 2024-03-01 17:29:42 UTC
(In reply to Alex Buckley from comment #13)
> (In reply to Owen Leonard from comment #10)
> > (In reply to Owen Leonard from comment #9)
> >  
> > > I'm a little bit concerned about using dateaccessioned for sorting
> > 
> > Ignore me, I wasn't thinking about the fact that there is already a "Date
> > added" sorting option.
> > 
> > I wonder if there is a more user-friendly way to say "Date accessioned?"
> > Some way to express that the order is by newest item?
> 
> Hi Owen, 
> 
> Thanks for your feedback and taking a look!
> 
> Looking at your screenshots now.
> 
> Do you think 'Date acquired' might be a more helpful wording? Happy to
> change the wording.
> 
> Alex

Looks like 'Date acquired' is used on returns.tt and catalogue_stats.tt and that seems to make sure much sense to me.
Comment 15 Esther Melander 2024-03-07 19:48:36 UTC
I tested this and it appears to work when selecting the date accessioned. However, I couldn't sort the list at all when clicking on the sort button for the other columns. Even though I selected the sort order by date accessioned, I would expect to retain the ability to continue to sort the list in different way when viewing. For example, maybe I want the date accessioned to reverse the sort, or maybe I need to sort by call number next. Clicking on the sort icons in the column header does nothing.
Comment 16 Esther Melander 2024-03-07 19:55:34 UTC
Testing other tables in Koha, it is possible to click on the sort arrows and have the column sort. In lists, it looks like you have to click on the column name. This is inconsistent behavior, but is perhaps a separate bug.
Comment 17 Biblibre Sandboxes 2024-03-07 20:11:28 UTC
Created attachment 162931 [details] [review]
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>
Comment 18 Esther Melander 2024-03-07 20:15:21 UTC
Signing off because this works according to the test plan.

I agree that Date Added versus Date Accessioned are a bit confusing. They could mean the same thing, but these dates are pulled from different places. Date Added comes from the bibliographic record (?) and Date accessioned comes from the item record, if I understand the difference.
Comment 19 Lucas Gass (lukeg) 2024-03-07 20:30:40 UTC
(In reply to Esther Melander from comment #16)
> Testing other tables in Koha, it is possible to click on the sort arrows and
> have the column sort. In lists, it looks like you have to click on the
> column name. This is inconsistent behavior, but is perhaps a separate bug.

Lists are one place in Koha that are not yet "DataTable'ed". There is an open bug regarding this:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30031
Comment 20 Alex Buckley 2024-03-12 21:23:37 UTC
Created attachment 163100 [details] [review]
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
Comment 21 Alex Buckley 2024-03-12 21:33:30 UTC
Created attachment 163101 [details] [review]
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
Comment 22 Alex Buckley 2024-03-12 22:22:57 UTC
Hi Lucas, Esther and Owen,

I've just attached two amended patches which change the text displayed to 'Date acquired'. Would you mind please taking a look and letting us know if that look alright?

Also, Owen would you mind please checking if the sorting is still inconsistent between the OPAC and staff client?

Alex
Comment 23 Esther Melander 2024-03-13 19:34:48 UTC
The change to Date acquired looks fine.

Setting the sort to Date acquired in the list edit screen does seem to sort correctly. I had one bibliographic record with two items with different dates. The list sorted correctly even though the one item was acquired earlier than the other. For example, the top bibliographic record had items with dates acquired that looked like this:

09/04/2014
09/10/2020

The second bibliographic record had an item with this date:

03/17/2016

This sorting is correct since the bibliographic record with the newest item (09/10/2020) is at the top of the list. But is it confusing if the dates themselves are still out of order? Bibliographic records with multiple copies acquired at different times add to the appearance of an incorrect sort. Is there a way to deal with multiple copies acquired at different times.
Comment 24 Baptiste Bayche 2024-05-09 19:29:52 UTC
Created attachment 166472 [details] [review]
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>
Comment 25 Baptiste Bayche 2024-05-09 19:37:02 UTC
The test plan working correctly, 
But the lists are not exactly the same between the OPAC side and the staff side if the items are the same date acquired.
Comment 26 Aleisha Amohia 2024-09-26 18:54:27 UTC
kohadev-koha@kohadevbox:koha((b4054dbb157...))$ git bz apply 36188

Bug 36188 - Allow to sort lists by items.dateaccessioned of item records

163100 - Bug 36188: Sort lists by Date acquired (items.dateaccessioned) in the staff client
166472 - Bug 36188: Sort lists by date acquired (items.dateaccessioned) in the OPAC

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 36188: Sort lists by Date acquired (items.dateaccessioned) in the staff client
Using index info to reconstruct a base tree...
M	koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt
M	virtualshelves/shelves.pl
Falling back to patching base and 3-way merge...
Auto-merging virtualshelves/shelves.pl
CONFLICT (content): Merge conflict in virtualshelves/shelves.pl
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt
error: Failed to merge in the changes.
Patch failed at 0001 Bug 36188: Sort lists by Date acquired (items.dateaccessioned) in the staff client
hint: Use 'git am --show-current-patch=diff' to see the failed patch
When you have resolved this problem run "git bz apply --continue".
If you would prefer to skip this patch, instead run "git bz apply --skip".
To restore the original branch and stop patching run "git bz apply --abort".
Patch left in /tmp/Bug-36188-Sort-lists-by-Date-acquired-itemsdateacc-450ljhgm.patch
Comment 27 Aleisha Amohia 2024-09-26 19:05:44 UTC
Created attachment 172025 [details] [review]
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
Comment 28 Aleisha Amohia 2024-09-26 19:05:46 UTC
Created attachment 172026 [details] [review]
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>
Comment 29 Olivier Vezina 2024-09-26 19:27:54 UTC
Created attachment 172050 [details] [review]
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
Signed-off-by: Olivier V <olivier.vezina@inLibro.com>
Comment 30 Olivier Vezina 2024-09-26 19:27:56 UTC
Created attachment 172051 [details] [review]
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>
Comment 31 Lucas Gass (lukeg) 2025-01-17 14:54:28 UTC
Created attachment 176735 [details] [review]
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
Signed-off-by: Olivier V <olivier.vezina@inLibro.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 32 Lucas Gass (lukeg) 2025-01-17 14:54:31 UTC
Created attachment 176736 [details] [review]
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: Lucas Gass <lucas@bywatersolutions.com>
Comment 33 Kyle M Hall (khall) 2025-01-17 14:56:30 UTC
Created attachment 176737 [details] [review]
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
Signed-off-by: Olivier V <olivier.vezina@inLibro.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 34 Kyle M Hall (khall) 2025-01-17 14:56:37 UTC
Created attachment 176738 [details] [review]
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>
Comment 35 Kyle M Hall (khall) 2025-01-17 14:56:40 UTC
Created attachment 176739 [details] [review]
Bug 36188: (QA follow-up) Tidy code

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>