https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43020

Adolfo Rodríguez Taboada <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #7 from Adolfo Rodríguez Taboada <[email protected]> ---
Hi David, I think I found why you couldn't see a difference: it depends on
whether the OAI server has an XSLT configured.

Without an XSLT, HTTP::OAI returns the metadata as a DocumentFragment rooted at
<metadata>. MARC::File::XML only reads fields that are direct children of the
root, so it keeps the leader and nothing else. Every record gets imported as an
empty shell (leader + 999), and nothing can fail to decode. That's the "3
records get imported but they're junk" you saw. The unit test passes the
metadata as a string, so it doesn't hit this path. The empty records look like
a separate problem.

With an XSLT that extracts the MARC record, the bad record does reach
MARC::Record->new_from_xml, and the patch makes a difference. I used this one:


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:marc="http://www.loc.gov/MARC21/slim";>
    <xsl:output method="xml" encoding="UTF-8" indent="yes"/>
    <xsl:template match="/">
        <marc:collection><xsl:copy-of
select="//marc:record"/></marc:collection>
    </xsl:template>
</xsl:stylesheet>
Test plan:

Serve three records from a fake OAI-PMH endpoint, where the second one has an
empty datafield (e.g. <datafield tag="100" ind1="1" ind2=" "/>).
Add an OAI server for it with record type biblio, format marcxml, and the XSLT
above.
Run misc/cronjobs/harvest_oai.pl -v -r <id>.
Before the patch, record 1 is added, then the script dies with "Field 100 must
have at least one subfield". Record 3 is never processed and there's no harvest
report.

After the patch:

the harvest completes with "2 added, 1 in_error";
the log shows "Record <identifier> could not be decoded: Field 100 must have at
least one subfield";
the script exits normally;
records 1 and 3 are imported in full, with their title;
running it again with -f gives "2 updated, 1 in_error".
QA tools and t/db_dependent/Koha/OAIHarvester.t pass.

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to