@@ -, +, @@ $ ktd --shell k$ prove t/db_dependent/Koha/REST/Plugin/Objects.t --- Koha/REST/Plugin/Objects.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- a/Koha/REST/Plugin/Objects.pm +++ a/Koha/REST/Plugin/Objects.pm @@ -161,10 +161,15 @@ controller, and thus shouldn't be called twice in it. $c->extract_reserved_params($args); if ( exists $reserved_params->{_order_by} ) { + + # convert to arrayref if it is a single param, to keep code simple + $reserved_params->{_order_by} = [ $reserved_params->{_order_by} ] + unless ref( $reserved_params->{_order_by} ) eq 'ARRAY'; + # _order_by passed, fix if required - for my $p ( @{$reserved_params->{_order_by}} ) { + for my $p ( @{ $reserved_params->{_order_by} } ) { foreach my $qf ( @{$query_fixers} ) { - $p = $qf->($p, 1); # 1 => no quotes on matching + $p = $qf->( $p, 1 ); # 1 => no quotes on matching } } } --