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

(-)a/Koha/REST/Plugin/Objects.pm (-18 / +15 lines)
Lines 209-228 controller, and thus shouldn't be called twice in it. Link Here
209
                }
209
                }
210
            );
210
            );
211
211
212
            # Call the to_model function by reference, if defined
212
            my $query_params;
213
            if ( defined $filtered_params ) {
214
215
                # Apply the mapping function to the passed params
216
                $filtered_params =
217
                  $result_set->attributes_from_api($filtered_params);
218
                $filtered_params =
219
                  $c->build_query_params( $filtered_params, $reserved_params );
220
            }
221
222
            if (   defined $reserved_params->{q}
213
            if (   defined $reserved_params->{q}
223
                || defined $reserved_params->{query} )
214
                || defined $reserved_params->{query} )
224
            {
215
            {
225
                $filtered_params //= {};
226
216
227
                my @query_params_array;
217
                my @query_params_array;
228
218
Lines 261-278 controller, and thus shouldn't be called twice in it. Link Here
261
                    }
251
                    }
262
                }
252
                }
263
253
264
                my $query_params;
265
266
                if ( scalar(@query_params_array) > 1 ) {
254
                if ( scalar(@query_params_array) > 1 ) {
267
                    $query_params = { '-and' => \@query_params_array };
255
                    $query_params = { '-and' => \@query_params_array };
268
                }
256
                }
269
                else {
257
                else {
270
                    $query_params = $query_params_array[0];
258
                    $query_params = $query_params_array[0];
271
                }
259
                }
272
273
                $filtered_params =
274
                  $c->merge_q_params( $filtered_params, $query_params,
275
                    $result_set );
276
            }
260
            }
277
261
278
            # request sequence id (i.e. 'draw' Datatables parameter)
262
            # request sequence id (i.e. 'draw' Datatables parameter)
Lines 287-292 controller, and thus shouldn't be called twice in it. Link Here
287
            $c->stash('koha.pagination.base_total'   => $result_set->count);
271
            $c->stash('koha.pagination.base_total'   => $result_set->count);
288
            $c->stash('koha.pagination.query_params' => $args);
272
            $c->stash('koha.pagination.query_params' => $args);
289
273
274
275
            # Apply the mapping function to the passed params
276
            if ( defined $filtered_params ) {
277
                $filtered_params =
278
                  $c->build_query_params( $filtered_params, $reserved_params );
279
              }
280
281
            $filtered_params =
282
              $c->merge_q_params( $filtered_params, $query_params,
283
                $result_set );
284
285
            $filtered_params =
286
                  $result_set->attributes_from_api($filtered_params);
287
290
            $c->dbic_validate_operators( { filtered_params => $filtered_params } );
288
            $c->dbic_validate_operators( { filtered_params => $filtered_params } );
291
289
292
            # Generate the resultset
290
            # Generate the resultset
293
- 

Return to bug 37902