Bug 27813 - Purchase suggestions should sort by suggesteddate rather than title
Summary: Purchase suggestions should sort by suggesteddate rather than title
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on: 16784
Blocks:
  Show dependency treegraph
 
Reported: 2021-02-26 18:41 UTC by Andrew Fuerste-Henry
Modified: 2022-07-09 07:47 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
This changes the list of purchase suggestions so that the oldest suggestions are shown first, rather than by title. (This was the behaviour before Koha 20.05).
Version(s) released in:
21.05.00,20.11.04,20.05.10


Attachments
Bug 27813: Restore default order on suggestion list view (1.49 KB, patch)
2021-03-02 11:24 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 27813: Restore default order on suggestion list view (1.54 KB, patch)
2021-03-03 09:40 UTC, David Nind
Details | Diff | Splinter Review
Bug 27813: Restore default order on suggestion list view (1.60 KB, patch)
2021-03-08 16:09 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 27813: Restore default order on suggestion list view (1.48 KB, patch)
2021-03-10 08:50 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 27813: Restore default order on suggestion list view (1.47 KB, patch)
2021-03-10 09:08 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 27813: Restore default order on suggestion list view (1.54 KB, patch)
2021-03-10 13:38 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 27813: Restore default order on suggestion list view (1.60 KB, patch)
2021-03-11 10:05 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Fuerste-Henry 2021-02-26 18:41:10 UTC
Prior to 20.05, suggestions on /cgi-bin/koha/suggestion/suggestion.pl sorted by suggesteddate by default. On 20.05 and later, they're sorting by title instead. We should go back to the previous behavior.
Comment 1 Jonathan Druart 2021-03-02 11:22:21 UTC
Caused by:
  commit fb526fb155143a62ea24a8433f58c1c79c1a0179
  Bug 16784: Add table configuration on suggestions table
Comment 2 Jonathan Druart 2021-03-02 11:24:30 UTC
Created attachment 117505 [details] [review]
Bug 27813: Restore default order on suggestion list view

Prior to 20.05, suggestions on /cgi-bin/koha/suggestion/suggestion.pl sorted by
suggesteddate by default. On 20.05 and later, they're sorting by title instead.
We should go back to the previous behavior.

Test plan:
Create some suggestions
Edit the suggestions.suggesteddate in the DB
List the suggestions and confirm that there are sorted by new suggested
date first
Comment 3 Jonathan Druart 2021-03-02 11:25:01 UTC
Andrew, newer first, right?
Comment 4 Andrew Fuerste-Henry 2021-03-02 12:23:43 UTC
Oh, sorry, I didn't specify. In 19.11, they sort oldest to newest.
Comment 5 David Nind 2021-03-03 09:40:25 UTC
Created attachment 117555 [details] [review]
Bug 27813: Restore default order on suggestion list view

Prior to 20.05, suggestions on /cgi-bin/koha/suggestion/suggestion.pl sorted by
suggesteddate by default. On 20.05 and later, they're sorting by title instead.
We should go back to the previous behavior.

Test plan:
Create some suggestions
Edit the suggestions.suggesteddate in the DB
List the suggestions and confirm that there are sorted by new suggested
date first

Signed-off-by: David Nind <david@davidnind.com>
Comment 6 David Nind 2021-03-03 09:44:45 UTC
Testing notes
~~~~~~~~~~~~~

Before  applying the patch I couldn't figure out the default order that suggestions were sorting in, it wasn't by date and it wasn't by title.

After applying the patch it now sorts by date by default, with the latest suggestions at the top of the list (that is, sorting by date with the latest/newest suggestions first).

SQL statements (on koha-testing-docker - koha-mysql kohadev to get into the database):
- select * from suggestions;
- update suggestions set suggesteddate="YYYY-MM-DD" where suggestionid="#"; 
- where YYYY-MM-DD is the new date, and # is the suggestionid in the database
Comment 7 Martin Renvoize 2021-03-08 16:09:27 UTC
Created attachment 117934 [details] [review]
Bug 27813: Restore default order on suggestion list view

Prior to 20.05, suggestions on /cgi-bin/koha/suggestion/suggestion.pl sorted by
suggesteddate by default. On 20.05 and later, they're sorting by title instead.
We should go back to the previous behavior.

Test plan:
Create some suggestions
Edit the suggestions.suggesteddate in the DB
List the suggestions and confirm that there are sorted by new suggested
date first

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 8 Martin Renvoize 2021-03-08 16:10:22 UTC
Works as intended now, I think newest or oldest is the 'best' order in this case as opposed to the opposite.

No regressions and passes QA scripts.

Passing QA
Comment 9 Jonathan Druart 2021-03-09 08:48:41 UTC
Andrew, can you confirm you agree with the order?
Comment 10 Andrew Fuerste-Henry 2021-03-09 14:08:32 UTC
I do not agree with the change in order. We should return to what it did previously (oldest to newest). That's the behavior librarians have come to expect and the behavior folks have specifically asked to return to. An option to change that could be added in a subsequent enhancement if desired.
Comment 11 David Nind 2021-03-09 17:35:29 UTC
Is it possible to use DataTables functionality like many of our other tables? Then if a different sort order is wanted then this lets staff decide what they want. I'm not sure how difficult this is to setup though...

I'm assuming the workflow would be to review the oldest suggestions first, so having them first makes sense to me.
Comment 12 Jonathan Druart 2021-03-10 08:50:45 UTC
Created attachment 118018 [details] [review]
Bug 27813: Restore default order on suggestion list view

Prior to 20.05, suggestions on /cgi-bin/koha/suggestion/suggestion.pl sorted by
suggesteddate by default. On 20.05 and later, they're sorting by title instead.
We should go back to the previous behavior.

Test plan:
Create some suggestions
Edit the suggestions.suggesteddate in the DB
List the suggestions and confirm that there are sorted by oldest first
Comment 13 Jonathan Druart 2021-03-10 08:52:52 UTC
Patch modified.

(In reply to David Nind from comment #11)
> Is it possible to use DataTables functionality like many of our other
> tables? Then if a different sort order is wanted then this lets staff decide
> what they want. I'm not sure how difficult this is to setup though...

You can set a "default sort" column, but it will be "asc" (see Acquisition > basket on admin/columns_settings.pl). There is no way to modify the order (asc/desc).
Comment 14 Jonathan Druart 2021-03-10 09:08:16 UTC
Created attachment 118019 [details] [review]
Bug 27813: Restore default order on suggestion list view

Prior to 20.05, suggestions on /cgi-bin/koha/suggestion/suggestion.pl sorted by
suggesteddate by default. On 20.05 and later, they're sorting by title instead.
We should go back to the previous behavior.

Test plan:
Create some suggestions
Edit the suggestions.suggesteddate in the DB
List the suggestions and confirm that there are sorted by oldest first
Comment 15 Andrew Fuerste-Henry 2021-03-10 13:38:52 UTC
Created attachment 118023 [details] [review]
Bug 27813: Restore default order on suggestion list view

Prior to 20.05, suggestions on /cgi-bin/koha/suggestion/suggestion.pl sorted by
suggesteddate by default. On 20.05 and later, they're sorting by title instead.
We should go back to the previous behavior.

Test plan:
Create some suggestions
Edit the suggestions.suggesteddate in the DB
List the suggestions and confirm that there are sorted by oldest first

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Comment 16 Jonathan Druart 2021-03-11 10:05:42 UTC
Created attachment 118107 [details] [review]
Bug 27813: Restore default order on suggestion list view

Prior to 20.05, suggestions on /cgi-bin/koha/suggestion/suggestion.pl sorted by
suggesteddate by default. On 20.05 and later, they're sorting by title instead.
We should go back to the previous behavior.

Test plan:
Create some suggestions
Edit the suggestions.suggesteddate in the DB
List the suggestions and confirm that there are sorted by oldest first

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 17 Jonathan Druart 2021-03-11 15:37:49 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 18 Fridolin Somers 2021-03-19 14:17:34 UTC
Pushed to 20.11.x for 20.11.04
Comment 19 Andrew Fuerste-Henry 2021-03-23 12:27:50 UTC
Pushed to 20.05.x for 20.05.10
Comment 20 Victor Grousset/tuxayo 2021-03-23 13:24:51 UTC
Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.