|
Lines 318-327
get '/dbic_extended_attributes_join' => sub {
Link Here
|
| 318 |
]; |
318 |
]; |
| 319 |
my $attributes = { 'prefetch' => ['extended_attributes'] }; |
319 |
my $attributes = { 'prefetch' => ['extended_attributes'] }; |
| 320 |
|
320 |
|
|
|
321 |
my $result_set = Koha::Patrons->new; |
| 322 |
|
| 321 |
$c->dbic_extended_attributes_join( |
323 |
$c->dbic_extended_attributes_join( |
| 322 |
{ |
324 |
{ |
| 323 |
'filtered_params' => $filtered_params, |
325 |
'filtered_params' => $filtered_params, |
| 324 |
'attributes' => $attributes |
326 |
'attributes' => $attributes, |
|
|
327 |
'result_set' => $result_set |
| 328 |
} |
| 329 |
); |
| 330 |
|
| 331 |
$c->render( json => { 'attributes' => $attributes, 'filtered_params' => $filtered_params }, status => 200 ); |
| 332 |
}; |
| 333 |
|
| 334 |
get '/dbic_extended_attributes_join_additional_fields' => sub { |
| 335 |
my ( $c, $args ) = @_; |
| 336 |
|
| 337 |
my $filtered_params = [ |
| 338 |
{ |
| 339 |
'-and' => [ |
| 340 |
[ |
| 341 |
{ |
| 342 |
'extended_attributes.attribute' => { 'like' => 'abc%' }, |
| 343 |
'extended_attributes.code' => [ |
| 344 |
[ |
| 345 |
'test1', |
| 346 |
'test2' |
| 347 |
] |
| 348 |
] |
| 349 |
} |
| 350 |
], |
| 351 |
[ |
| 352 |
{ |
| 353 |
'extended_attributes.code' => [ |
| 354 |
[ |
| 355 |
'test1', |
| 356 |
'test2' |
| 357 |
] |
| 358 |
], |
| 359 |
'extended_attributes.attribute' => { 'like' => '123%' } |
| 360 |
} |
| 361 |
] |
| 362 |
] |
| 363 |
} |
| 364 |
]; |
| 365 |
my $attributes = { 'prefetch' => ['extended_attributes'] }; |
| 366 |
|
| 367 |
my $result_set = Koha::Object::Mixin::AdditionalFields->new; |
| 368 |
|
| 369 |
$c->dbic_extended_attributes_join( |
| 370 |
{ |
| 371 |
'filtered_params' => $filtered_params, |
| 372 |
'attributes' => $attributes, |
| 373 |
'result_set' => $result_set |
| 325 |
} |
374 |
} |
| 326 |
); |
375 |
); |
| 327 |
|
376 |
|
|
Lines 634-636
subtest 'dbic_extended_attributes_join() tests' => sub {
Link Here
|
| 634 |
] |
683 |
] |
| 635 |
); |
684 |
); |
| 636 |
}; |
685 |
}; |
| 637 |
- |
686 |
|
|
|
687 |
subtest 'dbic_extended_attributes_join_additional_fields() tests' => sub { |
| 688 |
|
| 689 |
plan tests => 4; |
| 690 |
|
| 691 |
my $t = Test::Mojo->new; |
| 692 |
|
| 693 |
$t->get_ok( '/dbic_extended_attributes_join_additional_fields' => { 'x-koha-embed' => 'extended_attributes' } )->json_has( |
| 694 |
'/attributes' => { |
| 695 |
'join' => [ |
| 696 |
'extended_attributes', |
| 697 |
'extended_attributes' |
| 698 |
], |
| 699 |
'prefetch' => ['extended_attributes'] |
| 700 |
} |
| 701 |
); |
| 702 |
|
| 703 |
$t->get_ok( '/dbic_extended_attributes_join' => { 'x-koha-embed' => 'extended_attributes' } )->json_has( |
| 704 |
'/filtered_params' => [ |
| 705 |
{ |
| 706 |
'-and' => [ |
| 707 |
[ |
| 708 |
{ |
| 709 |
'extended_attributes.code' => [ |
| 710 |
[ |
| 711 |
'test1', |
| 712 |
'test2' |
| 713 |
] |
| 714 |
], |
| 715 |
'extended_attributes.attribute' => { 'like' => 'abc%' } |
| 716 |
} |
| 717 |
], |
| 718 |
[ |
| 719 |
{ |
| 720 |
'extended_attributes_2.attribute' => { 'like' => '123%' }, |
| 721 |
'extended_attributes_2.code' => [ |
| 722 |
[ |
| 723 |
'test1', |
| 724 |
'test2' |
| 725 |
] |
| 726 |
] |
| 727 |
} |
| 728 |
] |
| 729 |
] |
| 730 |
} |
| 731 |
] |
| 732 |
); |
| 733 |
}; |