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

(-)a/Koha/REST/Plugin/Objects.pm (-9 / +27 lines)
Lines 138-155 shouldn't be called twice in it. Link Here
138
                $filtered_params = $c->build_query_params( $filtered_params, $reserved_params );
138
                $filtered_params = $c->build_query_params( $filtered_params, $reserved_params );
139
            }
139
            }
140
140
141
            if( defined $reserved_params->{q} || defined $reserved_params->{query} || defined $reserved_params->{'x-koha-query'}) {
141
            if (   defined $reserved_params->{q}
142
                $filtered_params //={};
142
                || defined $reserved_params->{query}
143
                || defined $reserved_params->{'x-koha-query'} )
144
            {
145
                $filtered_params //= {};
146
143
                my @query_params_array;
147
                my @query_params_array;
144
                my $query_params;
148
145
                push @query_params_array, $reserved_params->{query} if defined $reserved_params->{query};
149
                # query in request body, JSON::Validator already decoded it
150
                push @query_params_array, $reserved_params->{query}
151
                  if defined $reserved_params->{query};
152
146
                my $json = JSON->new;
153
                my $json = JSON->new;
147
                push @query_params_array, $json->decode($reserved_params->{q}) if defined $reserved_params->{q};
148
                push @query_params_array, $json->decode($reserved_params->{'x-koha-query'}) if defined $reserved_params->{'x-koha-query'};
149
154
150
                if(scalar(@query_params_array) > 1) {
155
                # q is defined as multi => JSON::Validator generates an array
151
                    $query_params = {'-and' => \@query_params_array};
156
                foreach my $q ( @{ $reserved_params->{q} } ) {
152
                } else {
157
                    push @query_params_array, $json->decode($q)
158
                    if $q; # skip if exists but is empty
159
                }
160
161
                push @query_params_array,
162
                  $json->decode( $reserved_params->{'x-koha-query'} )
163
                  if defined $reserved_params->{'x-koha-query'};
164
165
                my $query_params;
166
167
                if ( scalar(@query_params_array) > 1 ) {
168
                    $query_params = { '-and' => \@query_params_array };
169
                }
170
                else {
153
                    $query_params = $query_params_array[0];
171
                    $query_params = $query_params_array[0];
154
                }
172
                }
155
173
(-)a/api/v1/swagger/parameters.yaml (-2 / +4 lines)
Lines 75-81 q_param: Link Here
75
  in: query
75
  in: query
76
  required: false
76
  required: false
77
  description: Query filter sent as a request parameter
77
  description: Query filter sent as a request parameter
78
  type: string
78
  type: array
79
  items:
80
    type: string
81
  collectionFormat: multi
79
q_header:
82
q_header:
80
  name: x-koha-query
83
  name: x-koha-query
81
  in: header
84
  in: header
82
- 

Return to bug 30165