This bug has been found during testing bug 19289.
In some conditions C4::Biblio::TransformHtmlToXml will generate a malformed XML structure. The last </datafield> can be duplicated.
For instance, if a call like:
my $xml = TransformHtmlToXml( \@tags, \@subfields, \@field_values );
with the last value of @field_values is empty, it will return:
<?xml version="1.0" encoding="UTF-8"?>
<collection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.loc.gov/MARC21/slimhttp://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd"
xmlns="http://www.loc.gov/MARC21/slim">
<record>
<datafield2 tag="020" ind1=" " ind2=" ">
<subfield code="a">l</subfield>
</datafield>
<datafield1 tag="100" ind1=" " ind2=" ">
<subfield code="a">k</subfield>
</datafield>
<datafield1 tag="245" ind1=" " ind2=" ">
<subfield code="a">k</subfield>
</datafield>
<datafield1 tag="250" ind1=" " ind2=" ">
<subfield code="a">k</subfield>
</datafield>
<datafield1 tag="260" ind1=" " ind2=" ">
<subfield code="b">k</subfield>
<subfield code="c">k</subfield>
</datafield>
</datafield>
</record>
</collection>
Which will result later in the following error:
:23: parser error : Opening and ending tag mismatch: record line 6 and datafield
</datafield>
^
:24: parser error : Opening and ending tag mismatch: collection line 2 and record
</record>
^
:25: parser error : Extra content at the end of the document
</collection>
Test plan:
You can test it along with bug 19289 and confirm that it fixes the problem
raised on bug 19289 comment 30
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
As requested by the RM, this patch adds a separate unit test
for GetMarcNotes. We test MARC21 and UNIMARC. The NotesBlacklist pref
is tested and also handling URLs in 5XX$u for MARC21.
Test plan:
Run t/Biblio/GetMarcNotes.t
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
The test files do not need to return 1
Patch generated with:
perl -p -i -e "s/^1;\n//xsm" t/**/*.t
Test plan:
git grep '^1;$' t/**/*.t
should not return any results
NOTE: does not fix C4/SIP/t, nor xt tests.
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Move Isbd.t and TransformKohaToMarc.t to db_dependent.
Next patch will add a few adjustments too.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
On commit cadf5aea81
Bug 11592: MARCView and ISBD followup
The prototype of C4::Biblio::GetISBDView has been changed to take a
hashref in parameter.
But the tests have not been updated
Test plan:
prove t/Biblio/Isbd.t
should return green
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
https://bugs.koha-community.org/show_bug.cgi?id=17637
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>