From 903406932fe1c955d12a9202a4f0d0d25be4b316 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 26 Feb 2021 15:08:46 -0300 Subject: [PATCH] Bug 27680: (QA follow-up) Minor perlcritic issue Signed-off-by: Tomas Cohen Arazi --- Koha/REST/Plugin/Query.pm | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Koha/REST/Plugin/Query.pm b/Koha/REST/Plugin/Query.pm index 25e66fc4725..ef70c9b55ab 100644 --- a/Koha/REST/Plugin/Query.pm +++ b/Koha/REST/Plugin/Query.pm @@ -109,13 +109,18 @@ Generates the DBIC order_by attributes based on I<$params>, and merges into I<$a my @THE_order_by; foreach my $order_by_param ( @order_by_params ) { - my $order_by = [ split(/,/, $order_by_param) ] if ( !reftype($order_by_param) && index(',',$order_by_param) == -1); - if ( reftype($order_by) and reftype($order_by) eq 'ARRAY' ) { - my @order_by = map { _build_order_atom({ string => $_, result_set => $result_set }) } @{ $order_by }; - push( @THE_order_by, @order_by); - } - else { - push @THE_order_by, _build_order_atom({ string => $order_by, result_set => $result_set }); + my $order_by; + $order_by = [ split(/,/, $order_by_param) ] + if ( !reftype($order_by_param) && index(',',$order_by_param) == -1); + + if ($order_by) { + if ( reftype($order_by) and reftype($order_by) eq 'ARRAY' ) { + my @order_by = map { _build_order_atom({ string => $_, result_set => $result_set }) } @{ $order_by }; + push( @THE_order_by, @order_by); + } + else { + push @THE_order_by, _build_order_atom({ string => $order_by, result_set => $result_set }); + } } } -- 2.30.1