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

--- Comment #1 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 211488
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211488&action=edit
Bug 43024: Guard undecodable MARC in item subfields and EndNote export

C4::Items::_parse_unlinked_item_subfields_from_xml decoded the item's
more_subfields_xml with no eval, so one malformed value would abort
Item2Marc. It now logs a warning via Koha::Logger, naming the itemnumber,
and returns undef, so the item is rendered without its unlinked subfields.

C4::Record::marc2endnote decoded its input with no eval. It now accepts a
MARC::Record object as well as an ISO2709 string (the catalogue and OPAC
export scripts pass objects, which the function previously mis-decoded to
empty output), and returns ( $error, $endnote ) like marc2marc and
changeEncoding. On a decode failure it logs and returns a clear error
message. catalogue/export.pl and opac/opac-export.pl are updated to use the
new return values and report the error to the user.

To test:
1. Set more_subfields_xml on an item to '<record><leader>truncated' (for
   example with UPDATE items SET more_subfields_xml=... WHERE itemnumber=N).
2. View the biblio in the staff interface, or edit or view the item: the page
   loads, the item is shown, and a warning appears in the Koha log.
3. Before this patch, Item2Marc dies with an XML parse error.
4. Go to Catalogue > Export records for a biblio and choose EndNote.
   With valid data the .enw file downloads and contains the title.
   Previously, the file was empty.
5. Run: prove t/db_dependent/Items.t t/db_dependent/Record.t
   Both pass.

Sponsored-by: OpenFifth
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

-- 
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