Bug 42004

Summary: Checkout history becomes weird after 1000 checkouts on an item
Product: Koha Reporter: Baptiste Wojtkowski (bwoj) <baptiste.wojtkowski>
Component: CirculationAssignee: Baptiste Wojtkowski (bwoj) <baptiste.wojtkowski>
Status: RESOLVED INVALID QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: gmcharlt, kyle
Version: Main   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:

Description Baptiste Wojtkowski (bwoj) 2026-03-05 17:16:18 UTC
This code from issuehistory.pl looks very weird to me, in particular when you have a timestamp ordered ascendently. A temporary fix waiting for an update of the array would be to order by timestamps descending.

 51 my @old_checkouts = Koha::Old::Checkouts->search(
 52     { biblionumber => $biblionumber },
 53     {
 54         join       => 'item',
 55         order_by   => 'timestamp',
 56         rows       => 1000,
 57     }
 58 )->as_list;

Steps to reproduce :
1 - Add 1000+ checkouts
2 - visit issuehistory.pl -> the last issues are not on top.