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: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]
                CC: [email protected]

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.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to