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

(-)a/C4/Breeding.pm (-3 / +5 lines)
Lines 509-518 sub ImportBreedingAuth { Link Here
509
    $searchbreeding->execute( $controlnumber, $heading );
509
    $searchbreeding->execute( $controlnumber, $heading );
510
    my ($breedingid) = $searchbreeding->fetchrow;
510
    my ($breedingid) = $searchbreeding->fetchrow;
511
511
512
    # This clears the cache, to make sure the record is up-to-date with the XSLT transformation
512
    if ($breedingid) {
513
    if ($breedingid) {
513
        my $updbrd = $dbh->prepare("update import_records set marc=?,marcxml=? where import_record_id=?");
514
        my $import_record = Koha::Import::Records->find($breedingid);
514
        $updbrd->execute( $marcrecord->as_usmarc(), $marcrecord->as_xml($marc_type), $breedingid );
515
        $import_record->marc( $marcrecord->as_usmarc() );
515
        $updbrd->finish();
516
        $import_record->marcxml( $marcrecord->as_xml($marc_type) );
517
        $import_record->store();
516
        return $breedingid;
518
        return $breedingid;
517
    }
519
    }
518
    $breedingid = AddAuthToBatch( $batch_id, 0, $marcrecord, $encoding );
520
    $breedingid = AddAuthToBatch( $batch_id, 0, $marcrecord, $encoding );
(-)a/t/db_dependent/Breeding_Auth.t (-7 / +4 lines)
Lines 114-126 subtest ImportBreedingAuth => sub { Link Here
114
    $breedingid_1 = C4::Breeding::ImportBreedingAuth( $record, "kidclamp", "UTF-8", 'Jansson, Tove' );
114
    $breedingid_1 = C4::Breeding::ImportBreedingAuth( $record, "kidclamp", "UTF-8", 'Jansson, Tove' );
115
    is( $breedingid, $breedingid_1, "For the same record, modified, we get the same id" );
115
    is( $breedingid, $breedingid_1, "For the same record, modified, we get the same id" );
116
116
117
    my $sth = $dbh->prepare('SELECT * FROM import_records WHERE import_record_id = ?');
117
    my $imported_record     = Koha::Import::Records->find($breedingid);
118
    $sth->execute($breedingid);
118
    my $imported_marcrecord = $imported_record->get_marc_record();
119
    my $imported_records_record = $sth->fetchrow_hashref();
120
    my $imported_record         = MARC::Record::new_from_xml( $imported_records_record->{marcxml} );
121
    is(
119
    is(
122
        $imported_record->subfield( '999', 'a' ), $record->subfield( '999', 'a' ),
120
        $imported_marcrecord->subfield( '999', 'a' ), $record->subfield( '999', 'a' ),
123
        'We also get the new the version of the record'
121
        'We also get the new version of the record'
124
    );
122
    );
125
123
126
    # End Bug 19220
124
    # End Bug 19220
127
- 

Return to bug 19220