@@ -, +, @@ timestamp --- C4/Members.pm | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) --- a/C4/Members.pm +++ a/C4/Members.pm @@ -532,6 +532,11 @@ sub IssueSlip { lastreneweddate => { '>=' => $today_start, '<=' => $today_end, } } + }, { + order_by => [ + { -asc => 'date_due' }, + { -asc => 'issuedate' }, + ] } ); my @checkouts; @@ -555,7 +560,12 @@ sub IssueSlip { else { my $today = Koha::Database->new->schema->storage->datetime_parser->format_datetime( dt_from_string ); # Checkouts due in the future - my $checkouts = $pending_checkouts->search({ date_due => { '>' => $today } }); + my $checkouts = $pending_checkouts->search({ date_due => { '>' => $today } }, { + order_by => [ + { -asc => 'date_due' }, + { -asc => 'issuedate' }, + ] + }); my @checkouts; my @overdues; while ( my $c = $checkouts->next ) { my $all = $c->unblessed_all_relateds; @@ -568,7 +578,12 @@ sub IssueSlip { } # Checkouts due in the past are overdues - my $overdues = $pending_checkouts->search({ date_due => { '<=' => $today } }); + my $overdues = $pending_checkouts->search({ date_due => { '<=' => $today } }, { + order_by => [ + { -asc => 'date_due' }, + { -asc => 'issuedate' }, + ] + }); while ( my $o = $overdues->next ) { my $all = $o->unblessed_all_relateds; push @overdues, { --