Bug 23427: Simplify sort logic
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 7 Nov 2019 12:34:31 +0000 (13:34 +0100)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Thu, 7 Nov 2019 13:25:10 +0000 (13:25 +0000)
This is the usual syntax.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

svc/checkouts

index dc559a2..f8fd541 100755 (executable)
@@ -270,7 +270,7 @@ while ( my $c = $sth->fetchrow_hashref() ) {
   unless ( C4::Context->preference('todaysIssuesDefaultSortOrder') eq 'desc' );      # earliest to latest
 
 @checkouts_previous =
-  sort { $a->{date_due} eq $b->{date_due} ? $a->{timestamp} cmp $b->{timestamp} : $a->{date_due} cmp $b->{date_due} }
+  sort { $a->{date_due} cmp $b->{date_due} || $a->{timestamp} cmp $b->{timestamp} }
   @checkouts_previous;                                                               # latest to earliest
 @checkouts_previous = reverse(@checkouts_previous)
   unless ( C4::Context->preference('previousIssuesDefaultSortOrder') eq 'desc' );    # earliest to latest