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

(-)a/C4/Biblio.pm (+1 lines)
Lines 3524-3529 sub ModBiblioMarc { Link Here
3524
    # FIXME To replace with ->find_or_create?
3524
    # FIXME To replace with ->find_or_create?
3525
    if ( my $m_rs = Koha::Biblio::Metadatas->find($metadata) ) {
3525
    if ( my $m_rs = Koha::Biblio::Metadatas->find($metadata) ) {
3526
        $m_rs->metadata( $record->as_xml_record($encoding) );
3526
        $m_rs->metadata( $record->as_xml_record($encoding) );
3527
        $m_rs->store;
3527
    } else {
3528
    } else {
3528
        my $m_rs = Koha::Biblio::Metadata->new($metadata);
3529
        my $m_rs = Koha::Biblio::Metadata->new($metadata);
3529
        $m_rs->metadata( $record->as_xml_record($encoding) );
3530
        $m_rs->metadata( $record->as_xml_record($encoding) );
(-)a/t/db_dependent/Biblio.t (-6 / +11 lines)
Lines 108-115 sub run_tests { Link Here
108
108
109
    # Generate a record with just the ISBN
109
    # Generate a record with just the ISBN
110
    my $marc_record = MARC::Record->new;
110
    my $marc_record = MARC::Record->new;
111
    my $isbn_field  = create_isbn_field( $isbn, $marcflavour );
111
    $marc_record->append_fields( create_isbn_field( $isbn, $marcflavour ) );
112
    $marc_record->append_fields( $isbn_field );
113
112
114
    # Add the record to the DB
113
    # Add the record to the DB
115
    my( $biblionumber, $biblioitemnumber ) = AddBiblio( $marc_record, '' );
114
    my( $biblionumber, $biblioitemnumber ) = AddBiblio( $marc_record, '' );
Lines 119-124 sub run_tests { Link Here
119
    is( $data->{ title }, undef,
118
    is( $data->{ title }, undef,
120
        '(GetBiblioData) Title field is empty in fresh biblio.');
119
        '(GetBiblioData) Title field is empty in fresh biblio.');
121
120
121
    my ( $isbn_field, $isbn_subfield ) = get_isbn_field();
122
    my $marc = GetMarcBiblio( $biblionumber );
123
    is( $marc->subfield( $isbn_field, $isbn_subfield ), $isbn, );
124
122
    # Add title
125
    # Add title
123
    my $field = create_title_field( $title, $marcflavour );
126
    my $field = create_title_field( $title, $marcflavour );
124
    $marc_record->append_fields( $field );
127
    $marc_record->append_fields( $field );
Lines 127-132 sub run_tests { Link Here
127
    is( $data->{ title }, $title,
130
    is( $data->{ title }, $title,
128
        'ModBiblio correctly added the title field, and GetBiblioData.');
131
        'ModBiblio correctly added the title field, and GetBiblioData.');
129
    is( $data->{ isbn }, $isbn, '(ModBiblio) ISBN is still there after ModBiblio.');
132
    is( $data->{ isbn }, $isbn, '(ModBiblio) ISBN is still there after ModBiblio.');
133
    $marc = GetMarcBiblio( $biblionumber );
134
    my ( $title_field, $title_subfield ) = get_title_field();
135
    is( $marc->subfield( $title_field, $title_subfield ), $title, );
130
136
131
    my $itemdata = GetBiblioItemData( $biblioitemnumber );
137
    my $itemdata = GetBiblioItemData( $biblioitemnumber );
132
    is( $itemdata->{ title }, $title,
138
    is( $itemdata->{ title }, $title,
Lines 320-338 sub create_issn_field { Link Here
320
}
326
}
321
327
322
subtest 'MARC21' => sub {
328
subtest 'MARC21' => sub {
323
    plan tests => 29;
329
    plan tests => 31;
324
    run_tests('MARC21');
330
    run_tests('MARC21');
325
    $dbh->rollback;
331
    $dbh->rollback;
326
};
332
};
327
333
328
subtest 'UNIMARC' => sub {
334
subtest 'UNIMARC' => sub {
329
    plan tests => 29;
335
    plan tests => 31;
330
    run_tests('UNIMARC');
336
    run_tests('UNIMARC');
331
    $dbh->rollback;
337
    $dbh->rollback;
332
};
338
};
333
339
334
subtest 'NORMARC' => sub {
340
subtest 'NORMARC' => sub {
335
    plan tests => 29;
341
    plan tests => 31;
336
    run_tests('NORMARC');
342
    run_tests('NORMARC');
337
    $dbh->rollback;
343
    $dbh->rollback;
338
};
344
};
339
- 

Return to bug 17196