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

(-)a/C4/Biblio.pm (-2 / +4 lines)
Lines 1268-1277 sub GetMarcBiblio { Link Here
1268
    }
1268
    }
1269
1269
1270
    my $dbh          = C4::Context->dbh;
1270
    my $dbh          = C4::Context->dbh;
1271
    my $sth          = $dbh->prepare("SELECT * FROM biblioitems WHERE biblionumber=? ");
1271
    my $sth          = $dbh->prepare("SELECT biblioitemnumber, marcxml FROM biblioitems WHERE biblionumber=? ");
1272
    $sth->execute($biblionumber);
1272
    $sth->execute($biblionumber);
1273
    my $row     = $sth->fetchrow_hashref;
1273
    my $row     = $sth->fetchrow_hashref;
1274
    my $biblioitemnumber = $row->{'biblioitemnumber'};
1274
    my $marcxml = StripNonXmlChars( $row->{'marcxml'} );
1275
    my $marcxml = StripNonXmlChars( $row->{'marcxml'} );
1276
    my $frameworkcode = GetFrameworkCode($biblionumber);
1275
    MARC::File::XML->default_record_format( C4::Context->preference('marcflavour') );
1277
    MARC::File::XML->default_record_format( C4::Context->preference('marcflavour') );
1276
    my $record = MARC::Record->new();
1278
    my $record = MARC::Record->new();
1277
1279
Lines 1280-1286 sub GetMarcBiblio { Link Here
1280
        if ($@) { warn " problem with :$biblionumber : $@ \n$marcxml"; }
1282
        if ($@) { warn " problem with :$biblionumber : $@ \n$marcxml"; }
1281
        return unless $record;
1283
        return unless $record;
1282
1284
1283
        C4::Biblio::_koha_marc_update_bib_ids($record, '', $biblionumber, $row->{biblioitemnumber});
1285
        C4::Biblio::_koha_marc_update_bib_ids($record, $frameworkcode, $biblionumber, $biblioitemnumber);
1284
        C4::Biblio::EmbedItemsInMarcBiblio($record, $biblionumber) if ($embeditems);
1286
        C4::Biblio::EmbedItemsInMarcBiblio($record, $biblionumber) if ($embeditems);
1285
1287
1286
        return $record;
1288
        return $record;
(-)a/t/db_dependent/Biblio.t (-4 / +16 lines)
Lines 194-199 sub run_tests { Link Here
194
194
195
    is( GetMarcPrice( $record_for_isbn, $marcflavour ), 100,
195
    is( GetMarcPrice( $record_for_isbn, $marcflavour ), 100,
196
        "GetMarcPrice returns the correct value");
196
        "GetMarcPrice returns the correct value");
197
    my $newincbiblioitemnumber=$biblioitemnumber+1;
198
    $dbh->do("UPDATE biblioitems SET biblioitemnumber = ? WHERE biblionumber = ?;", undef, $newincbiblioitemnumber, $biblionumber );
199
    my $updatedrecord = GetMarcBiblio($biblionumber, 0);
200
    my $frameworkcode = GetFrameworkCode($biblionumber);
201
    my ( $biblioitem_tag, $biblioitem_subfield ) = GetMarcFromKohaField( "biblioitems.biblioitemnumber", $frameworkcode );
202
    die qq{No biblioitemnumber tag for framework "$frameworkcode"} unless $biblioitem_tag;
203
    my $biblioitemnumbertotest;
204
    if ( $biblioitem_tag < 10 ) {
205
        $biblioitemnumbertotest = $updatedrecord->field($biblioitem_tag)->data();
206
    } else {
207
        $biblioitemnumbertotest = $updatedrecord->field($biblioitem_tag)->subfield($biblioitem_subfield);
208
    }
209
    is ($newincbiblioitemnumber, $biblioitemnumbertotest);
197
}
210
}
198
211
199
sub mock_marcfromkohafield {
212
sub mock_marcfromkohafield {
Lines 260-278 sub create_issn_field { Link Here
260
}
273
}
261
274
262
subtest 'MARC21' => sub {
275
subtest 'MARC21' => sub {
263
    plan tests => 27;
276
    plan tests => 28;
264
    run_tests('MARC21');
277
    run_tests('MARC21');
265
    $dbh->rollback;
278
    $dbh->rollback;
266
};
279
};
267
280
268
subtest 'UNIMARC' => sub {
281
subtest 'UNIMARC' => sub {
269
    plan tests => 27;
282
    plan tests => 28;
270
    run_tests('UNIMARC');
283
    run_tests('UNIMARC');
271
    $dbh->rollback;
284
    $dbh->rollback;
272
};
285
};
273
286
274
subtest 'NORMARC' => sub {
287
subtest 'NORMARC' => sub {
275
    plan tests => 27;
288
    plan tests => 28;
276
    run_tests('NORMARC');
289
    run_tests('NORMARC');
277
    $dbh->rollback;
290
    $dbh->rollback;
278
};
291
};
279
- 

Return to bug 10961