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 => 29;
20
use Test::More tests => 30;
21
21
22
use C4::Context;
22
use C4::Context;
23
use C4::Members;
23
use C4::Members;
Lines 296-301 C4::Members::Attributes::SetBorrowerAttributes( Link Here
296
C4::Members::Attributes::SetBorrowerAttributes(
296
C4::Members::Attributes::SetBorrowerAttributes(
297
    $jane_doe{borrowernumber}, [ { code => $attribute_type->{code}, value => 'the default value for another common user' } ]
297
    $jane_doe{borrowernumber}, [ { code => $attribute_type->{code}, value => 'the default value for another common user' } ]
298
);
298
);
299
C4::Members::Attributes::SetBorrowerAttributes(
300
    $john_smith{borrowernumber}, [ { code => $attribute_type->{code}, value => 'Attribute which not appears even if contains "Dupont"' } ]
301
);
299
302
300
t::lib::Mocks::mock_preference('ExtendedPatronAttributes', 1);
303
t::lib::Mocks::mock_preference('ExtendedPatronAttributes', 1);
301
$search_results = C4::Utils::DataTables::Members::search({
304
$search_results = C4::Utils::DataTables::Members::search({
Lines 379-384 $search_results = C4::Utils::DataTables::Members::search({ Link Here
379
is( $search_results->{ iTotalDisplayRecords }, 1,
382
is( $search_results->{ iTotalDisplayRecords }, 1,
380
    "Sarching by date of birth should handle date formatted in iso");
383
    "Sarching by date of birth should handle date formatted in iso");
381
384
385
subtest 'ExtendedPatronAttributes' => sub {
386
    plan tests => 2;
387
    t::lib::Mocks::mock_preference('ExtendedPatronAttributes', 1);
388
    $search_results = C4::Utils::DataTables::Members::search({
389
        searchmember     => "Dupont",
390
        searchfieldstype => 'standard',
391
        searchtype       => 'contain',
392
        branchcode       => $branchcode,
393
        dt_params        => \%dt_params
394
    });
395
396
    is( $search_results->{ iTotalDisplayRecords }, 3,
397
        "'Dupont' is contained in 2 surnames and a patron attribute. Patron attribute one should be displayed if searching in all fields (Bug 18094)");
398
399
    $search_results = C4::Utils::DataTables::Members::search({
400
        searchmember     => "Dupont",
401
        searchfieldstype => 'surname',
402
        searchtype       => 'contain',
403
        branchcode       => $branchcode,
404
        dt_params        => \%dt_params
405
    });
406
407
    is( $search_results->{ iTotalDisplayRecords }, 1,
408
        "'Dupont' is contained in 2 surnames and a patron attribute. Patron attribute one should not be displayed if searching in specific fields (Bug 18094)");
409
};
410
382
# End
411
# End
383
$dbh->rollback;
412
$dbh->rollback;
384
413
385
- 

Return to bug 18094