Bug 37636 - Checkout slip prints out of order
Summary: Checkout slip prints out of order
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Nick Clemens (kidclamp)
QA Contact: Martin Renvoize
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-08-13 19:38 UTC by Nick Clemens (kidclamp)
Modified: 2024-09-13 14:11 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.11.00
Circulation function:


Attachments
Bug 37636: Remove sort of pending_checkouts by timestamp (1.34 KB, patch)
2024-08-20 13:30 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 37636: Remove sort of pending_checkouts by timestamp (1.38 KB, patch)
2024-08-21 10:44 UTC, David Nind
Details | Diff | Splinter Review
Bug 37636: Remove sort of pending_checkouts by timestamp (1.45 KB, patch)
2024-08-21 11:11 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 37636: Unit test (3.73 KB, patch)
2024-08-22 12:31 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 37636: Remove sort of pending_checkouts by timestamp (1.45 KB, patch)
2024-08-22 12:31 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 37636: Unit test (3.79 KB, patch)
2024-09-13 12:17 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 37636: Remove sort of pending_checkouts by timestamp (1.45 KB, patch)
2024-09-13 12:17 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens (kidclamp) 2024-08-13 19:38:11 UTC
From bug 19935 - the ordering for checkouts is:
ORDER BY `me`.`timestamp` DESC, `issuedate` DESC, `issue_id` DESC

When the automatic_renewals cron updates checkouts it can change the timestamp even if not renewing.

We should have an order on the due date, or make this customizable.
Comment 1 Nick Clemens (kidclamp) 2024-08-20 13:30:15 UTC
Created attachment 170496 [details] [review]
Bug 37636: Remove sort of pending_checkouts by timestamp

Renewals or automatic renewal attempts can change the timestamp of an issue and cause a sort
on this field to functionally randomize the order of checkouts returned.

Prior to bug 19935 the GetPendingCheckouts routine returned items in issuedate order.

Removing the sort on timestamp will return the previous behaviour and provide a more predictable sorting

To test:
1 - Checkout some items to a patron
2 - Print a checkout slip - items are in the order they were checked out
3 - Renew an item,print the slip again it is now at the top of the list
4 - Apply patch, restart_all
5 - Print slip again - the items are now ordered in the order they were checked out.
Comment 2 David Nind 2024-08-21 10:44:46 UTC
Created attachment 170556 [details] [review]
Bug 37636: Remove sort of pending_checkouts by timestamp

Renewals or automatic renewal attempts can change the timestamp of an issue and cause a sort
on this field to functionally randomize the order of checkouts returned.

Prior to bug 19935 the GetPendingCheckouts routine returned items in issuedate order.

Removing the sort on timestamp will return the previous behaviour and provide a more predictable sorting

To test:
1 - Checkout some items to a patron
2 - Print a checkout slip - items are in the order they were checked out
3 - Renew an item,print the slip again it is now at the top of the list
4 - Apply patch, restart_all
5 - Print slip again - the items are now ordered in the order they were checked out.

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 Martin Renvoize 2024-08-21 11:11:45 UTC
Created attachment 170558 [details] [review]
Bug 37636: Remove sort of pending_checkouts by timestamp

Renewals or automatic renewal attempts can change the timestamp of an issue and cause a sort
on this field to functionally randomize the order of checkouts returned.

Prior to bug 19935 the GetPendingCheckouts routine returned items in issuedate order.

Removing the sort on timestamp will return the previous behaviour and provide a more predictable sorting

To test:
1 - Checkout some items to a patron
2 - Print a checkout slip - items are in the order they were checked out
3 - Renew an item,print the slip again it is now at the top of the list
4 - Apply patch, restart_all
5 - Print slip again - the items are now ordered in the order they were checked out.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 4 Martin Renvoize 2024-08-21 11:16:54 UTC
I'm happy with the change.. but could we get a unit test for the ordering so we prevent future regression pretty please?
Comment 5 Nick Clemens (kidclamp) 2024-08-22 12:31:13 UTC
Created attachment 170604 [details] [review]
Bug 37636: Unit test
Comment 6 Nick Clemens (kidclamp) 2024-08-22 12:31:15 UTC
Created attachment 170605 [details] [review]
Bug 37636: Remove sort of pending_checkouts by timestamp

Renewals or automatic renewal attempts can change the timestamp of an issue and cause a sort
on this field to functionally randomize the order of checkouts returned.

Prior to bug 19935 the GetPendingCheckouts routine returned items in issuedate order.

Removing the sort on timestamp will return the previous behaviour and provide a more predictable sorting

To test:
1 - Checkout some items to a patron
2 - Print a checkout slip - items are in the order they were checked out
3 - Renew an item,print the slip again it is now at the top of the list
4 - Apply patch, restart_all
5 - Print slip again - the items are now ordered in the order they were checked out.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 7 Martin Renvoize 2024-09-13 12:17:47 UTC
Created attachment 171453 [details] [review]
Bug 37636: Unit test

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 8 Martin Renvoize 2024-09-13 12:17:50 UTC
Created attachment 171454 [details] [review]
Bug 37636: Remove sort of pending_checkouts by timestamp

Renewals or automatic renewal attempts can change the timestamp of an issue and cause a sort
on this field to functionally randomize the order of checkouts returned.

Prior to bug 19935 the GetPendingCheckouts routine returned items in issuedate order.

Removing the sort on timestamp will return the previous behaviour and provide a more predictable sorting

To test:
1 - Checkout some items to a patron
2 - Print a checkout slip - items are in the order they were checked out
3 - Renew an item,print the slip again it is now at the top of the list
4 - Apply patch, restart_all
5 - Print slip again - the items are now ordered in the order they were checked out.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 9 Martin Renvoize 2024-09-13 12:18:19 UTC
Nice one Nick, thanks for the unit tests

Passing QA
Comment 10 Katrin Fischer 2024-09-13 14:11:56 UTC
Pushed for 24.11!

Well done everyone, thank you!