Bug 10961: Error in GetMarcBiblio can cause severe data loss
A bug in GetMarcBiblio can cause severe data loss if your database has records where the biblionumber and biblioitemnumber do not match and the script misc/batchRebuildBiblioTables.pl is run. The Biblio::GetMarcBiblio makes a kall to C4::Biblio::_koha_marc_update_bib_ids which passes the biblionumber as both the biblionumber *and the biblioitemnumber*. Thus, if your biblio and biblioitem numbers are not always equal, you will end up with a record where the biblioitemnumber is incorrect in the record! This is usually not a severe issue, but since batchRebuildBiblioTables uses that record to update the database tables, it ends up updating the wrong biblioitem row! NOTE: What a horrible, horrible typo that was. Tested this with the second patch. Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
This commit is contained in:
parent
beef853472
commit
298c4c76a5
1 changed files with 3 additions and 3 deletions
|
@ -1268,7 +1268,7 @@ sub GetMarcBiblio {
|
||||||
}
|
}
|
||||||
|
|
||||||
my $dbh = C4::Context->dbh;
|
my $dbh = C4::Context->dbh;
|
||||||
my $sth = $dbh->prepare("SELECT marcxml FROM biblioitems WHERE biblionumber=? ");
|
my $sth = $dbh->prepare("SELECT * FROM biblioitems WHERE biblionumber=? ");
|
||||||
$sth->execute($biblionumber);
|
$sth->execute($biblionumber);
|
||||||
my $row = $sth->fetchrow_hashref;
|
my $row = $sth->fetchrow_hashref;
|
||||||
my $marcxml = StripNonXmlChars( $row->{'marcxml'} );
|
my $marcxml = StripNonXmlChars( $row->{'marcxml'} );
|
||||||
|
@ -1280,8 +1280,8 @@ sub GetMarcBiblio {
|
||||||
if ($@) { warn " problem with :$biblionumber : $@ \n$marcxml"; }
|
if ($@) { warn " problem with :$biblionumber : $@ \n$marcxml"; }
|
||||||
return unless $record;
|
return unless $record;
|
||||||
|
|
||||||
C4::Biblio::_koha_marc_update_bib_ids($record, '', $biblionumber, $biblionumber);
|
C4::Biblio::_koha_marc_update_bib_ids($record, '', $biblionumber, $row->{biblioitemnumber});
|
||||||
C4::Biblio::EmbedItemsInMarcBiblio($record, $biblionumber) if ($embeditems);
|
C4::Biblio::EmbedItemsInMarcBiblio($record, $biblionumber) if ($embeditems);
|
||||||
|
|
||||||
return $record;
|
return $record;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue