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

(-)a/C4/Search.pm (+1 lines)
Lines 96-101 sub FindDuplicate { Link Here
96
    if ( $result->{isbn} ) {
96
    if ( $result->{isbn} ) {
97
        $result->{isbn} =~ s/\(.*$//;
97
        $result->{isbn} =~ s/\(.*$//;
98
        $result->{isbn} =~ s/\s+$//;
98
        $result->{isbn} =~ s/\s+$//;
99
        $result->{isbn} =~ s/\|/OR/;
99
        $query = "isbn:$result->{isbn}";
100
        $query = "isbn:$result->{isbn}";
100
    }
101
    }
101
    else {
102
    else {
(-)a/t/db_dependent/Search.t (-3 / +21 lines)
Lines 292-297 sub run_marc21_search_tests { Link Here
292
    ($biblionumber,undef,$title) = FindDuplicate($record);
292
    ($biblionumber,undef,$title) = FindDuplicate($record);
293
    is($biblionumber, 51, 'Found duplicate with ISBN');
293
    is($biblionumber, 51, 'Found duplicate with ISBN');
294
294
295
    $record = MARC::Record->new;
296
    $record->add_fields(
297
            [ '020', ' ', ' ', a => '0465039146' ],
298
            [ '020', ' ', ' ', a => '9780465039142' ],
299
            [ '245', '0', '0', a => 'Doesnt matter, searching isbn /' ]
300
            );
301
    ($biblionumber,undef,$title) = FindDuplicate($record);
302
    is($biblionumber, 48, 'Found duplicate with ISBN when two ISBNs in record');
303
295
    $record = MARC::Record->new;
304
    $record = MARC::Record->new;
296
305
297
    $record->add_fields(
306
    $record->add_fields(
Lines 930-936 sub run_unimarc_search_tests { Link Here
930
}
939
}
931
940
932
subtest 'MARC21 + DOM' => sub {
941
subtest 'MARC21 + DOM' => sub {
933
    plan tests => 93;
942
    plan tests => 94;
934
    run_marc21_search_tests();
943
    run_marc21_search_tests();
935
};
944
};
936
945
Lines 941-947 subtest 'UNIMARC + DOM' => sub { Link Here
941
950
942
951
943
subtest 'FindDuplicate' => sub {
952
subtest 'FindDuplicate' => sub {
944
    plan tests => 6;
953
    plan tests => 8;
945
    Koha::Caches->get_instance('config')->flush_all;
954
    Koha::Caches->get_instance('config')->flush_all;
946
    t::lib::Mocks::mock_preference('marcflavour', 'MARC21' );
955
    t::lib::Mocks::mock_preference('marcflavour', 'MARC21' );
947
    mock_GetMarcSubfieldStructure('MARC21');
956
    mock_GetMarcSubfieldStructure('MARC21');
Lines 970-975 subtest 'FindDuplicate' => sub { Link Here
970
    $record_3->add_fields(
979
    $record_3->add_fields(
971
            [ '245', '0', '0', a => 'Frog and toad all year /' ]
980
            [ '245', '0', '0', a => 'Frog and toad all year /' ]
972
    );
981
    );
982
    my $record_4 = MARC::Record->new;
983
    $record_4 ->add_fields(
984
            [ '020', ' ', ' ', a => '9780307744432' ],
985
            [ '020', ' ', ' ', a => '0307744434' ],
986
            [ '100', '0', '0', a => 'Morgenstern, Erin' ],
987
            [ '245', '0', '0', a => 'The night circus /' ]
988
    );
973
989
974
    foreach my $engine ('Zebra','Elasticsearch'){
990
    foreach my $engine ('Zebra','Elasticsearch'){
975
        t::lib::Mocks::mock_preference('searchEngine', $engine );
991
        t::lib::Mocks::mock_preference('searchEngine', $engine );
Lines 982-987 subtest 'FindDuplicate' => sub { Link Here
982
998
983
        warning_is { C4::Search::FindDuplicate($record_3);}
999
        warning_is { C4::Search::FindDuplicate($record_3);}
984
            q/ti,ext:"Frog and toad all year \/"/,"Term correctly formed and passed to $engine";
1000
            q/ti,ext:"Frog and toad all year \/"/,"Term correctly formed and passed to $engine";
1001
1002
        warning_is { C4::Search::FindDuplicate($record_4);}
1003
            q/isbn:9780307744432 OR 0307744434/,"Term correctly formed and passed to $engine";
985
    }
1004
    }
986
1005
987
};
1006
};
988
- 

Return to bug 31471