https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44122
--- Comment #1 from Martin Renvoize (ashimema) <[email protected]> --- Created attachment 211732 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211732&action=edit Bug 44122: Handle unreadable record metadata in the catalogue and OPAC scripts When the MARCXML of a record is damaged beyond repair, Koha::Biblio::Metadata->record throws Koha::Exceptions::Metadata::Invalid. Most of the scripts that read it did not catch the exception, so the librarian got a 500 error page. This adds C4::Output::output_and_exit_if_invalid_metadata. It logs the exception and then, in the staff interface, shows a blocking message (new 'invalid_metadata' case in blocking_errors.inc) or, in the OPAC, redirects to the 404 page. Other exceptions are rethrown. It is used by the staff scripts ISBDdetail, MARCdetail, labeledMARCdetail, moredetail, showmarc and additem and by the OPAC scripts opac-detail, opac-MARCdetail, opac-ISBDdetail, opac-showmarc and opac-export. opac-basket skips the unreadable record. addbiblio now stops after showing its existing notice for records that cannot be repaired instead of failing further down. The detail.pl script is handled by bug 44070. To test: 1. Damage the metadata of a record that has an item: UPDATE biblio_metadata SET metadata=SUBSTRING(metadata,1,60) WHERE biblionumber=X; 2. In the staff interface open for this record: MARC preview, ISBD preview, labeled MARC preview, Items (moredetail), Edit items and Edit record, and the MARC popup from the search results. => A message is shown, no 500 error 3. In the OPAC open the details, MARC view and ISBD view of the record => You are sent to the page not found page 4. Add the record to the basket and open the basket => The page loads, without the record 5. Check a healthy record still works everywhere 6. prove t/Output.t 7. yarn cypress run --spec t/cypress/integration/InvalidMetadata_spec.ts -- 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] 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/
