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

(-)a/Koha/REST/Plugin/Objects.pm (-2 / +3 lines)
Lines 20-25 use Modern::Perl; Link Here
20
use Mojo::Base 'Mojolicious::Plugin';
20
use Mojo::Base 'Mojolicious::Plugin';
21
21
22
use JSON qw(decode_json);
22
use JSON qw(decode_json);
23
use Encode qw(encode_utf8);
23
24
24
=head1 NAME
25
=head1 NAME
25
26
Lines 104-111 sub register { Link Here
104
                my @query_params_array;
105
                my @query_params_array;
105
                my $query_params;
106
                my $query_params;
106
                push @query_params_array, $reserved_params->{query} if defined $reserved_params->{query};
107
                push @query_params_array, $reserved_params->{query} if defined $reserved_params->{query};
107
                push @query_params_array, decode_json($reserved_params->{q}) if defined $reserved_params->{q};
108
                push @query_params_array, decode_json(encode_utf8 $reserved_params->{q}) if defined $reserved_params->{q};
108
                push @query_params_array, decode_json($reserved_params->{'x-koha-query'}) if defined $reserved_params->{'x-koha-query'};
109
                push @query_params_array, decode_json(encode_utf8 $reserved_params->{'x-koha-query'}) if defined $reserved_params->{'x-koha-query'};
109
110
110
                if(scalar(@query_params_array) > 1) {
111
                if(scalar(@query_params_array) > 1) {
111
                    $query_params = {'-and' => \@query_params_array};
112
                    $query_params = {'-and' => \@query_params_array};
(-)a/t/db_dependent/Koha/REST/Plugin/Objects.t (-3 / +22 lines)
Lines 77-83 get '/biblios' => sub { Link Here
77
77
78
78
79
# The tests
79
# The tests
80
use Test::More tests => 9;
80
use Test::More tests => 10;
81
use Test::Mojo;
81
use Test::Mojo;
82
82
83
use t::lib::TestBuilder;
83
use t::lib::TestBuilder;
Lines 206-211 subtest 'objects.search helper, sorting on mapped column' => sub { Link Here
206
    $schema->storage->txn_rollback;
206
    $schema->storage->txn_rollback;
207
};
207
};
208
208
209
subtest 'objects.search helper, encoding' => sub {
210
211
    plan tests => 5;
212
213
    $schema->storage->txn_begin;
214
215
    Koha::Cities->delete;
216
217
    $builder->build_object({ class => 'Koha::Cities', value => { city_name => 'A', city_country => 'Argentina' } });
218
    $builder->build_object({ class => 'Koha::Cities', value => { city_name => 'B', city_country => '❤Argentina❤' } });
219
220
    $t->get_ok('/cities?country=❤')
221
      ->status_is(200)
222
      ->json_has('/0')
223
      ->json_hasnt('/1')
224
      ->json_is('/0/name' => 'B');
225
226
    $schema->storage->txn_rollback;
227
};
228
209
subtest 'objects.search helper, embed' => sub {
229
subtest 'objects.search helper, embed' => sub {
210
230
211
    plan tests => 2;
231
    plan tests => 2;
Lines 363-366 subtest 'object.search helper order by embedded columns' => sub { Link Here
363
      ->json_is('/biblios/1/biblio_id' => $biblio1->biblionumber, 'Biblio 1 should be second');
383
      ->json_is('/biblios/1/biblio_id' => $biblio1->biblionumber, 'Biblio 1 should be second');
364
384
365
    $schema->storage->txn_begin;
385
    $schema->storage->txn_begin;
366
}
386
}
367
- 

Return to bug 25774