View | Details | Raw Unified | Return to bug 40424
Collapse All | Expand All

(-)a/Koha/REST/Plugin/Objects.pm (-18 / +9 lines)
Lines 214-220 controller, and thus shouldn't be called twice in it. Link Here
214
            );
214
            );
215
215
216
            my $query_params;
216
            my $query_params;
217
            if (   defined $reserved_params->{q}
217
218
            my $q_param = $reserved_params->{q};
219
220
            if ( $q_param
218
                || defined $reserved_params->{query} )
221
                || defined $reserved_params->{query} )
219
            {
222
            {
220
223
Lines 231-253 controller, and thus shouldn't be called twice in it. Link Here
231
                    push @query_params_array, $json->decode($query);
234
                    push @query_params_array, $json->decode($query);
232
                }
235
                }
233
236
234
                if ( ref( $reserved_params->{q} ) eq 'ARRAY' ) {
237
                # The q parameter can be an array if multiple passed
235
238
                $q_param = [$q_param]
236
                    # q is defined as multi => JSON::Validator generates an array
239
                    unless ref($q_param) eq 'ARRAY';
237
                    foreach my $q ( @{ $reserved_params->{q} } ) {
238
                        if ($q) {    # skip if exists but is empty
239
                            foreach my $qf ( @{$query_fixers} ) {
240
                                $q = $qf->($q);
241
                            }
242
                            push @query_params_array, $json->decode($q);
243
                        }
244
                    }
245
                } else {
246
240
247
                    # objects.search called outside OpenAPI context
241
                foreach my $q ( @{$q_param} ) {
248
                    # might be a hashref
242
                    if ($q) {    # skip if exists but is empty
249
                    if ( $reserved_params->{q} ) {
250
                        my $q = $reserved_params->{q};
251
                        foreach my $qf ( @{$query_fixers} ) {
243
                        foreach my $qf ( @{$query_fixers} ) {
252
                            $q = $qf->($q);
244
                            $q = $qf->($q);
253
                        }
245
                        }
254
- 

Return to bug 40424