Bug 12732 - Allow sorting by basket creation date to the late orders table
Summary: Allow sorting by basket creation date to the late orders table
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Owen Leonard
QA Contact: Emily Lamancusa (emlam)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-07 18:11 UTC by simith.doliveira
Modified: 2024-04-12 08:09 UTC (History)
12 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: Small patch
Documentation contact: Caroline Cyr La Rose
Documentation submission: https://gitlab.com/koha-community/koha-manual/-/merge_requests/858
Text to go in the release notes:
This enhancement allows end users to sort the late orders table by basket creation date.
Version(s) released in:
23.11.00
Circulation function:


Attachments
Bug 12732 - Sort late orders by basket creation or closing date (7.32 KB, patch)
2014-08-07 18:23 UTC, simith.doliveira
Details | Diff | Splinter Review
Bug 12732 - Sort late orders by basket creation or closing date (7.51 KB, patch)
2014-08-14 16:29 UTC, Paola Rossi
Details | Diff | Splinter Review
Bug 12732 - Sort late orders by basket creation or closing date - (3.43 KB, patch)
2014-08-21 17:31 UTC, simith.doliveira
Details | Diff | Splinter Review
updatedatabase.pl updated (1.19 KB, text/plain)
2014-10-14 12:54 UTC, simith.doliveira
Details
Bug 12732 - Sort late orders by basket creation or closing date (3.07 KB, text/plain)
2014-10-14 13:16 UTC, simith.doliveira
Details
Bug 12732 - Sort late orders by basket creation or closing date - (3.41 KB, patch)
2014-10-14 13:31 UTC, simith.doliveira
Details | Diff | Splinter Review
Bug 12732 - Sort late orders by basket creation or closing date (7.25 KB, patch)
2016-12-15 21:52 UTC, Charles Farmer
Details | Diff | Splinter Review
Bug 12732 - Sort late orders by basket creation or closing date - (3.55 KB, patch)
2016-12-15 21:52 UTC, Charles Farmer
Details | Diff | Splinter Review
Bug 12732: Add basket creation date to late orders table for sorting (2.51 KB, patch)
2023-07-18 17:35 UTC, Owen Leonard
Details | Diff | Splinter Review
SQL update to add late orders (21.30 KB, text/plain)
2023-07-18 17:37 UTC, Owen Leonard
Details
Bug 12732: Add basket creation date to late orders table for sorting (2.57 KB, patch)
2023-08-18 10:25 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 12732: (follow-up) Use data-order instead of data-sort (1.19 KB, patch)
2023-09-27 10:50 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 12732: Add basket creation date to late orders table for sorting (2.64 KB, patch)
2023-09-27 13:44 UTC, Emily Lamancusa (emlam)
Details | Diff | Splinter Review
Bug 12732: (follow-up) Use data-order instead of data-sort (1.26 KB, patch)
2023-09-27 13:44 UTC, Emily Lamancusa (emlam)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description simith.doliveira 2014-08-07 18:11:06 UTC

    
Comment 1 simith.doliveira 2014-08-07 18:23:11 UTC Comment hidden (obsolete)
Comment 2 Paola Rossi 2014-08-14 16:27:49 UTC
I've applied the patch against master 3.17.00.013

I pass the patch to "Signed Off" status.
Comment 3 Paola Rossi 2014-08-14 16:29:00 UTC Comment hidden (obsolete)
Comment 4 Katrin Fischer 2014-08-16 20:23:28 UTC Comment hidden (obsolete)
Comment 5 simith.doliveira 2014-08-21 17:26:13 UTC
Hi Katrin,

Concerning your comments:

0) Added in the new patch.

1) Ok for t/db_dependent/Acquisition.t and t/db_dependent/Acquisition.

2) I didn't know why, but using a placeholder in this code "DATEDIFF(CAST(now() AS date),${aqbasketSortField})" I got a different result, so I did not change it. 

3) and 4) Changed in the new patch.
Comment 6 simith.doliveira 2014-08-21 17:31:02 UTC Comment hidden (obsolete)
Comment 7 Katrin Fischer 2014-08-23 18:09:51 UTC
(In reply to simith.doliveira from comment #5)

> 2) I didn't know why, but using a placeholder in this code
> "DATEDIFF(CAST(now() AS date),${aqbasketSortField})" I got a different
> result, so I did not change it. 

I was not sure either so asked Jared to take a look - it won't work because it's a column name. So it's probably ok. I am switching back to 'signed off' treating the second patch as a QA follow-up.
Comment 8 Jonathan Druart 2014-09-19 08:48:24 UTC
Why don't you add the 2 infos in the table and let datatable does the sort job?
Comment 9 Jonathan Druart 2014-09-26 08:00:47 UTC
The change in the subroutine needs unit tests.
Switch to Failed QA.
Comment 10 simith.doliveira 2014-10-14 12:54:25 UTC Comment hidden (obsolete)
Comment 11 simith.doliveira 2014-10-14 13:16:56 UTC Comment hidden (obsolete)
Comment 12 simith.doliveira 2014-10-14 13:31:02 UTC Comment hidden (obsolete)
Comment 13 simith.doliveira 2014-10-14 13:45:10 UTC
Sorry for the last 3 comments, I got some problems to fix merge conflict in installer/data/mysql/updatedatabase.pl 

- Regarding your question: Why don't you add the 2 infos in the table and let datatable does the sort job?

The sponsor wanted just one column and the possibility to change the sort

- The change in the subroutine needs unit tests.

t/db_dependent/Acquisition.t alread has the tests for the subroutine that I changed
Comment 14 Kyle M Hall (khall) 2014-10-31 14:50:25 UTC
(In reply to Jonathan Druart from comment #8)
> Why don't you add the 2 infos in the table and let datatable does the sort
> job?

I agree with this suggestion. Can you please address this? I feel like this is case of YASP when we could probably allow this default sorting to be changed via some javascript in intranetuserjs by splitting the data into separate table columns.
Comment 15 simith.doliveira 2014-12-12 20:02:56 UTC
Kyle,

This enhancement is sponsored by CCSR and that is the way they use. If the code is not suitable, so it must be followed up by someone else.
Comment 16 Charles Farmer 2016-12-15 21:52:18 UTC Comment hidden (obsolete)
Comment 17 Charles Farmer 2016-12-15 21:52:24 UTC Comment hidden (obsolete)
Comment 18 Katrin Fischer 2017-05-02 22:18:37 UTC
The patches apply right now, but 3 things:

1) there are still no unit tests for the changes to the core routine
2) if we decide to have a system preference for this kind of behaviour, I'd suggest to rename it from AcqLateOrderUseCreationDate to AcqLaterOderDefaultSort which be more descriptive.
3) The SQL in sysprefs.sql is wrong:

 FAIL	installer/data/mysql/sysprefs.sql
   OK	  git manipulation
   FAIL	  semicolon
		simicolon found instead of comma at line 6
   OK	  sysprefs_order


I agree with previous commenters that it doesn't seem quite right to switch the dates in the column like this. I'd like it if both were shown and the sorting handled by JavaScript. I think it would add valuable information and allow for more flexibility.
Comment 19 Katrin Fischer 2023-07-15 20:46:13 UTC
We can now configure the default sort in administration > table configuration.
I think all we need now is to add the entry date of the baskets as a new column.
Comment 20 Owen Leonard 2023-07-18 17:35:56 UTC
Created attachment 153617 [details] [review]
Bug 12732: Add basket creation date to late orders table for sorting

This patch modifies the late orders page so that the table of
information contains a column for basket creation date. This will allow
administrators to configure the table to sort by default on basket
creation date if they wish.

To test, apply the patch and restart services.

- Go to Acquisitions -> Late orders.
- The table of late orders should include a column labeled "Basket date"
  showing the basket creation date.
- The dates should be formatted correctly and the column should sort
  correctly.
- Go to Administration -> Table settings and navigate to the settings
  for the lateorders page.
- Try changing various settings for the table to confirm that everything
  works correctly, including setting the default sort to use the basket
  date column.
Comment 21 Owen Leonard 2023-07-18 17:37:59 UTC
Created attachment 153618 [details]
SQL update to add late orders

Since the sample data doesn't contain late orders by default I made up this update
Comment 22 Emmi Takkinen 2023-08-18 10:25:19 UTC
Created attachment 154633 [details] [review]
Bug 12732: Add basket creation date to late orders table for sorting

This patch modifies the late orders page so that the table of
information contains a column for basket creation date. This will allow
administrators to configure the table to sort by default on basket
creation date if they wish.

To test, apply the patch and restart services.

- Go to Acquisitions -> Late orders.
- The table of late orders should include a column labeled "Basket date"
  showing the basket creation date.
- The dates should be formatted correctly and the column should sort
  correctly.
- Go to Administration -> Table settings and navigate to the settings
  for the lateorders page.
- Try changing various settings for the table to confirm that everything
  works correctly, including setting the default sort to use the basket
  date column.

Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Comment 23 Emily Lamancusa (emlam) 2023-09-26 18:25:44 UTC
Thanks for the patch on this long-outstanding bug! Just one thing: this patch uses the data-sort attribute in the td tag, but the same table has other rows that use data-order instead. Can this one be adjusted to use data-order for consistency?
Comment 24 Owen Leonard 2023-09-27 10:50:04 UTC
Created attachment 156280 [details] [review]
Bug 12732: (follow-up) Use data-order instead of data-sort
Comment 25 Emily Lamancusa (emlam) 2023-09-27 13:44:48 UTC
Created attachment 156291 [details] [review]
Bug 12732: Add basket creation date to late orders table for sorting

This patch modifies the late orders page so that the table of
information contains a column for basket creation date. This will allow
administrators to configure the table to sort by default on basket
creation date if they wish.

To test, apply the patch and restart services.

- Go to Acquisitions -> Late orders.
- The table of late orders should include a column labeled "Basket date"
  showing the basket creation date.
- The dates should be formatted correctly and the column should sort
  correctly.
- Go to Administration -> Table settings and navigate to the settings
  for the lateorders page.
- Try changing various settings for the table to confirm that everything
  works correctly, including setting the default sort to use the basket
  date column.

Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Comment 26 Emily Lamancusa (emlam) 2023-09-27 13:44:51 UTC
Created attachment 156292 [details] [review]
Bug 12732: (follow-up) Use data-order instead of data-sort

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Comment 27 Tomás Cohen Arazi (tcohen) 2023-10-20 14:03:38 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 28 Fridolin Somers 2023-10-25 22:16:39 UTC
Enhancement not pushed to 23.05.x