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

(-)a/C4/Biblio.pm (+4 lines)
Lines 2383-2388 sub TransformMarcToKohaOneField { Link Here
2383
        $retval = _adjust_pubyear( $retval );
2383
        $retval = _adjust_pubyear( $retval );
2384
    }
2384
    }
2385
2385
2386
    if( $kohafield =~ /ean/ ) {
2387
        $retval =~ s/-//g;
2388
    }
2389
2386
    return $retval;
2390
    return $retval;
2387
}
2391
}
2388
2392
(-)a/t/db_dependent/Biblio/TransformMarcToKoha.t (-4 / +5 lines)
Lines 42-61 Koha::MarcSubfieldStructure->new({ frameworkcode => '', tagfield => '500', tagsu Link Here
42
Koha::Caches->get_instance->clear_from_cache( "MarcSubfieldStructure-" );
42
Koha::Caches->get_instance->clear_from_cache( "MarcSubfieldStructure-" );
43
43
44
subtest 'Test a few mappings' => sub {
44
subtest 'Test a few mappings' => sub {
45
    plan tests => 7;
45
    plan tests => 8;
46
46
47
    my $marc = MARC::Record->new;
47
    my $marc = MARC::Record->new;
48
    $marc->append_fields(
48
    $marc->append_fields(
49
        MARC::Field->new( '300', '', '', a => 'a1', b => 'b1' ),
49
        MARC::Field->new( '300', '', '', a => 'a1', b => 'b1' ),
50
        MARC::Field->new( '300', '', '', a => 'a2', b => 'b2' ),
50
        MARC::Field->new( '300', '', '', a => 'a2', b => 'b2' ),
51
        MARC::Field->new( '500', '', '', a => 'note1', a => 'note2' ),
51
        MARC::Field->new( '500', '', '', a => 'note1', a => 'note2' ),
52
        MARC::Field->new( '024', '', '', a => '9678-56789', a => '8657-6547-89' ),
52
    );
53
    );
53
    my $result = C4::Biblio::TransformMarcToKoha( $marc );
54
    my $result = C4::Biblio::TransformMarcToKoha( $marc );
54
        # Note: TransformMarcToKoha stripped the table prefix biblio.
55
        # Note: TransformMarcToKoha stripped the table prefix biblio.
55
    is( keys %{$result}, 3, 'Found all three mappings' );
56
    is( keys %{$result}, 4, 'Found all four mappings' );
56
    is( $result->{field1}, 'a1 | a2', 'Check field1 results' );
57
    is( $result->{field1}, 'a1 | a2', 'Check field1 results' );
57
    is( $result->{field2}, 'b1 | b2', 'Check field2 results' );
58
    is( $result->{field2}, 'b1 | b2', 'Check field2 results' );
58
    is( $result->{field3}, 'note1 | note2', 'Check field3 results' );
59
    is( $result->{field3}, 'note1 | note2', 'Check field3 results' );
60
    is( $result->{ean}, '967856789 | 8657654789', 'Hyphens are removed from EAN field(s)' );
59
61
60
    is( C4::Biblio::TransformMarcToKohaOneField( 'biblio.field1', $marc ),
62
    is( C4::Biblio::TransformMarcToKohaOneField( 'biblio.field1', $marc ),
61
        $result->{field1}, 'TransformMarcToKohaOneField returns biblio.field1');
63
        $result->{field1}, 'TransformMarcToKohaOneField returns biblio.field1');
Lines 67-73 subtest 'Test a few mappings' => sub { Link Here
67
    # CAUTION: This parameter of TransformMarcToKoha will be removed later
69
    # CAUTION: This parameter of TransformMarcToKoha will be removed later
68
    my $new_fw = t::lib::TestBuilder->new->build({source => 'BiblioFramework'});
70
    my $new_fw = t::lib::TestBuilder->new->build({source => 'BiblioFramework'});
69
    $result = C4::Biblio::TransformMarcToKoha($marc, $new_fw->{frameworkcode});
71
    $result = C4::Biblio::TransformMarcToKoha($marc, $new_fw->{frameworkcode});
70
    is( keys %{$result}, 3, 'Still found all three mappings' );
72
    is( keys %{$result}, 4, 'Still found all four mappings' );
71
};
73
};
72
74
73
subtest 'Multiple mappings for one kohafield' => sub {
75
subtest 'Multiple mappings for one kohafield' => sub {
74
- 

Return to bug 28584