From c190e951fe9d97715d244fcb007daa9b627b97ed Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 18 Jun 2018 14:53:21 +0100 Subject: [PATCH] Bug 11897: (follow-up) Ensure rota's always come back ordered --- catalogue/stockrotation.pl | 3 ++- misc/cronjobs/stockrotation.pl | 2 +- tools/stockrotation.pl | 7 ++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/catalogue/stockrotation.pl b/catalogue/stockrotation.pl index 30660d79ce..8b6a32451f 100755 --- a/catalogue/stockrotation.pl +++ b/catalogue/stockrotation.pl @@ -78,7 +78,8 @@ if (!defined $op) { }, { join => 'stockrotationstages', - collapse => 1 + collapse => 1, + order_by => 'title' } ); diff --git a/misc/cronjobs/stockrotation.pl b/misc/cronjobs/stockrotation.pl index 2986100ef5..c4f276720c 100755 --- a/misc/cronjobs/stockrotation.pl +++ b/misc/cronjobs/stockrotation.pl @@ -500,7 +500,7 @@ sub emit { #### Main Code # Compile Stockrotation Report data -my $rotas = Koha::StockRotationRotas->search; +my $rotas = Koha::StockRotationRotas->search(undef,{ order_by => { '-asc' => 'title' }}); my $data = $rotas->investigate; # Perform db updates if requested diff --git a/tools/stockrotation.pl b/tools/stockrotation.pl index cf46c090cb..9ba983a675 100755 --- a/tools/stockrotation.pl +++ b/tools/stockrotation.pl @@ -69,7 +69,12 @@ my $op = $params{op}; if (!defined $op) { # No operation is supplied, we're just displaying the list of rotas - my $rotas = Koha::StockRotationRotas->search->as_list; + my $rotas = Koha::StockRotationRotas->search( + undef, + { + order_by => { -asc => 'title' } + } + )->as_list; $template->param( existing_rotas => $rotas, -- 2.17.1