@@ -, +, @@ --- Koha/REST/Plugin/Query.pm | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) --- a/Koha/REST/Plugin/Query.pm +++ a/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 }); + } } } --