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

(-)a/t/db_dependent/Utils/Datatables_Members.t (-2 / +30 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 49;
20
use Test::More tests => 50;
21
21
22
use C4::Context;
22
use C4::Context;
23
use C4::Members;
23
use C4::Members;
Lines 280-285 C4::Members::Attributes::SetBorrowerAttributes( Link Here
280
C4::Members::Attributes::SetBorrowerAttributes(
280
C4::Members::Attributes::SetBorrowerAttributes(
281
    $jane_doe->{borrowernumber}, [ { code => $attribute_type->{code}, value => 'the default value for another common user' } ]
281
    $jane_doe->{borrowernumber}, [ { code => $attribute_type->{code}, value => 'the default value for another common user' } ]
282
);
282
);
283
C4::Members::Attributes::SetBorrowerAttributes(
284
    $john_smith->{borrowernumber}, [ { code => $attribute_type->{code}, value => 'Attribute which not appears even if contains "Dupont"' } ]
285
);
283
286
284
t::lib::Mocks::mock_preference('ExtendedPatronAttributes', 1);
287
t::lib::Mocks::mock_preference('ExtendedPatronAttributes', 1);
285
$search_results = C4::Utils::DataTables::Members::search({
288
$search_results = C4::Utils::DataTables::Members::search({
Lines 429-434 $search_results = C4::Utils::DataTables::Members::search({ Link Here
429
is( $search_results->{ iTotalDisplayRecords }, 2,
432
is( $search_results->{ iTotalDisplayRecords }, 2,
430
    "Sarching by date of birth should handle date formatted in iso");
433
    "Sarching by date of birth should handle date formatted in iso");
431
434
435
subtest 'ExtendedPatronAttributes' => sub {
436
    plan tests => 2;
437
    t::lib::Mocks::mock_preference('ExtendedPatronAttributes', 1);
438
    $search_results = C4::Utils::DataTables::Members::search({
439
        searchmember     => "Dupont",
440
        searchfieldstype => 'standard',
441
        searchtype       => 'contain',
442
        branchcode       => $branchcode,
443
        dt_params        => \%dt_params
444
    });
445
446
    is( $search_results->{ iTotalDisplayRecords }, 3,
447
        "'Dupont' is contained in 2 surnames and a patron attribute. Patron attribute one should be displayed if searching in all fields (Bug 18094)");
448
449
    $search_results = C4::Utils::DataTables::Members::search({
450
        searchmember     => "Dupont",
451
        searchfieldstype => 'surname',
452
        searchtype       => 'contain',
453
        branchcode       => $branchcode,
454
        dt_params        => \%dt_params
455
    });
456
457
    is( $search_results->{ iTotalDisplayRecords }, 1,
458
        "'Dupont' is contained in 2 surnames and a patron attribute. Patron attribute one should not be displayed if searching in specific fields (Bug 18094)");
459
};
460
432
# End
461
# End
433
$schema->storage->txn_rollback;
462
$schema->storage->txn_rollback;
434
463
435
- 

Return to bug 18094