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

--- Comment #198 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 201674
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201674&action=edit
Bug 35104: (follow-up) Recover records with an empty datafield, generalize
warning UI

MARC::File::XML refuses to parse a <datafield> with no <subfield>
children at all ("Field NNN must have at least one subfield"), which
happens with legacy data saved before Koha validated MARCXML on
write. Previously this was only caught by the "truly unrecoverable"
branch of Koha::Biblio::Metadata::store, throwing
Koha::Exceptions::Metadata::Invalid.

store() now detects this specific fault the same way it already
detects non-XML characters, and recovers by removing the empty
datafield (its data cannot be reconstructed, so a
'empty_datafield_stripped' error row is written to
biblio_metadata_errors for a cataloguer to review, exactly like the
existing 'nonxml_stripped' rows). Both faults are detected
independently, so a record with both is repaired in one pass and both
error types are recorded.

The nonxml_stripped-specific plumbing that surfaces these rows to
staff (detail/MARCdetail warning banners, the addbiblio.pl edit-form
banner with quick-links and "Mark resolved", merge.pl, and
bulkmarcimport.pl's log output) is generalized to show any recorded
metadata error rather than hardcoding one error_type, so future
recoverable-fault types need no further UI plumbing. The "go to
field" quick-link is only offered for faults that leave the field in
place to link to (nonxml_stripped); empty_datafield_stripped removes
the whole field, so there's nothing left to link to.

C4::Biblio::ModBiblioMarc's warnings-array forwarding is likewise
generalized: Koha::Biblio::Metadata::store now puts an
already-formatted message string in the object_message payload
(instead of a raw occurrence array plus type-specific formatting
logic living in C4::Biblio.pm), so ModBiblioMarc can forward any
warning-type message without knowing its shape. The final message
text sent to callers is unchanged, verified by the existing
nonxml_stripped tests in t/db_dependent/Biblio.t passing unmodified.

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
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