Bug 18635: Koha::Patron->guarantees() should return results alphabetically
authorNick Clemens <nick@bywatersolutions.com>
Fri, 19 May 2017 01:08:22 +0000 (21:08 -0400)
committerNick Clemens <nick@bywatersolutions.com>
Thu, 9 Aug 2018 11:36:58 +0000 (11:36 +0000)
To test:
1 - Add the same guarantor to a number of patrons, ensuring random order
alphabetically
2 - View the guarantors record, note unordered list of guarantees
3 - Apply patch
4 - Guarantees are alphabetical

Signed-off-by: Marc VĂ©ron <veron@veron.ch>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Koha/Patron.pm

index 9e8b3cf..660a447 100644 (file)
@@ -441,7 +441,7 @@ Returns the guarantees (list of Koha::Patron) of this patron
 sub guarantees {
     my ( $self ) = @_;
 
-    return Koha::Patrons->search( { guarantorid => $self->borrowernumber } );
+    return Koha::Patrons->search( { guarantorid => $self->borrowernumber }, { order_by => { -asc => ['surname','firstname'] } } );
 }
 
 =head3 housebound_profile