[Koha-bugs] [Bug 30308] New: bulkmarcimport.pl broken by OAI-PMH:AutoUpdateSets(EmbedItemData)
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Thu Mar 17 11:46:17 CET 2022
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30308
Bug ID: 30308
Summary: bulkmarcimport.pl broken by
OAI-PMH:AutoUpdateSets(EmbedItemData)
Change sponsored?: ---
Product: Koha
Version: master
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P5 - low
Component: Command-line Utilities
Assignee: koha-bugs at lists.koha-community.org
Reporter: magnus at libriotech.no
QA Contact: testopia at bugs.koha-community.org
CC: robin at catalyst.net.nz
I was trying to import records and items with bulkmarcimport.pl. The records
were added, but no items were saved to the DB. Turning off
OAI-PMH:AutoUpdateSets and OAI-PMH:AutoUpdateSetsEmbedItemData fixed the
problem. I think this is what happens:
1. bulkmarcimport.pl calls C4::Biblio::AddBiblio on line 461:
eval { ( $biblionumber, $biblioitemnumber ) = AddBiblio( $record, '', {
defer_marc_save => 1 } ) };
https://git.koha-community.org/Koha-community/Koha/src/branch/master/misc/migration_tools/bulkmarcimport.pl#L461
2. C4::Biblio::AddBiblio has this code:
# update OAI-PMH sets
if(C4::Context->preference("OAI-PMH:AutoUpdateSets")) {
C4::OAI::Sets::UpdateOAISetsBiblio($biblionumber, $record);
}
https://git.koha-community.org/Koha-community/Koha/src/branch/master/C4/Biblio.pm#L296
3. C4::OAI::Sets::UpdateOAISetsBiblio does this:
if (C4::Context->preference('OAI-PMH:AutoUpdateSetsEmbedItemData')) {
C4::Biblio::EmbedItemsInMarcBiblio({
marc_record => $record,
biblionumber => $biblionumber
});
}
https://git.koha-community.org/Koha-community/Koha/src/branch/master/C4/OAI/Sets.pm#L612
4. C4::Biblio::EmbedItemsInMarcBiblio does:
my ($params) = @_;
$marc = $params->{marc_record};
...
_strip_item_fields($marc, $frameworkcode);
# ... and embed the current items
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare("SELECT itemnumber FROM items WHERE biblionumber =
?");
https://git.koha-community.org/Koha-community/Koha/src/branch/master/C4/Biblio.pm#L2501
The end result is that item data is stripped from the record that is about to
be imported, and no item data is added from the DB, since they are not there
yet. Not sure how to fix this.
--
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
More information about the Koha-bugs
mailing list