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

(-)a/C4/Biblio.pm (+2 lines)
Lines 2472-2477 sub _adjust_pubyear { Link Here
2472
    /xms ) { # the form 198-? occurred in Dutch ISBD rules
2472
    /xms ) { # the form 198-? occurred in Dutch ISBD rules
2473
        my $digits = $+{year};
2473
        my $digits = $+{year};
2474
        $retval = $digits * ( 10 ** ( 4 - length($digits) ));
2474
        $retval = $digits * ( 10 ** ( 4 - length($digits) ));
2475
    } else {
2476
        $retval = undef;
2475
    }
2477
    }
2476
    return $retval;
2478
    return $retval;
2477
}
2479
}
(-)a/t/db_dependent/Biblio/TransformMarcToKoha.t (-4 / +5 lines)
Lines 94-100 subtest 'Multiple mappings for one kohafield' => sub { Link Here
94
};
94
};
95
95
96
subtest 'Testing _adjust_pubyear' => sub {
96
subtest 'Testing _adjust_pubyear' => sub {
97
    plan tests => 10;
97
    plan tests => 12;
98
98
99
    is( C4::Biblio::_adjust_pubyear('2004 c2000 2007'), 2000, 'First cYEAR' );
99
    is( C4::Biblio::_adjust_pubyear('2004 c2000 2007'), 2000, 'First cYEAR' );
100
    is( C4::Biblio::_adjust_pubyear('2004 2000 2007'), 2004, 'First year' );
100
    is( C4::Biblio::_adjust_pubyear('2004 2000 2007'), 2004, 'First year' );
Lines 103-111 subtest 'Testing _adjust_pubyear' => sub { Link Here
103
    is( C4::Biblio::_adjust_pubyear('197X'), 1970, '197X on its own' );
103
    is( C4::Biblio::_adjust_pubyear('197X'), 1970, '197X on its own' );
104
    is( C4::Biblio::_adjust_pubyear('1...'), 1000, '1... on its own' );
104
    is( C4::Biblio::_adjust_pubyear('1...'), 1000, '1... on its own' );
105
    is( C4::Biblio::_adjust_pubyear('12?? 13xx'), 1200, '12?? first' );
105
    is( C4::Biblio::_adjust_pubyear('12?? 13xx'), 1200, '12?? first' );
106
    is( C4::Biblio::_adjust_pubyear('12? 1x'), '12? 1x', 'Too short' );
106
    is( C4::Biblio::_adjust_pubyear('12? 1x'), undef, 'Too short return nothing as data must be int' );
107
    is( C4::Biblio::_adjust_pubyear('198-'), '198-', 'Missing question mark' );
107
    is( C4::Biblio::_adjust_pubyear('198-'), undef, 'Missing question mark, nothing is returned as data must be int' );
108
    is( C4::Biblio::_adjust_pubyear('198-?'), '1980', '198-?' );
108
    is( C4::Biblio::_adjust_pubyear('198-?'), '1980', '198-?' );
109
    is( C4::Biblio::_adjust_pubyear('1981-'), '1981', 'Date range returns first date' );
110
    is( C4::Biblio::_adjust_pubyear('broken'), undef, 'Non-matchign data returns nothing as the field must be int' );
109
};
111
};
110
112
111
subtest 'Test repeatable subfields' => sub {
113
subtest 'Test repeatable subfields' => sub {
112
- 

Return to bug 26516