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@lists.koha-community.org Reporter: magnus@libriotech.no QA Contact: testopia@bugs.koha-community.org CC: robin@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/mi... 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/Bibl... 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/... 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/Bibl... 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.