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

            Bug ID: 44122
           Summary: Pages die with an uncaught
                    Koha::Exceptions::Metadata::Invalid when the metadata
                    of a record cannot be repaired
   Initiative type: ---
        Sponsorship ---
            status:
           Product: Koha
           Version: Main
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P5 - low
         Component: MARC Bibliographic data support
          Assignee: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]
        Depends on: 43777
  Target Milestone: ---

Since bug 43777, Koha::Biblio::Metadata->record repairs recoverable MARCXML
faults on read, and throws Koha::Exceptions::Metadata::Invalid for metadata
that cannot be recovered at all (for example truncated MARCXML). The follow-ups
of bug 43025 handle that exception in some places (merge, batch import,
maintenance scripts, Z39.50 results, svc/bib and, with bug 44070, the staff
detail page), but most pages that read the record do not, and die with an
uncaught exception.

To reproduce:
1. Pick a record that has an item and cut its MARCXML:
   UPDATE biblio_metadata SET metadata = SUBSTRING_INDEX(metadata, '</record>',
1) WHERE biblionumber = 1;
2. Open the pages below (bug 44070 applied, so catalogue/detail.pl works).

Staff interface, all return a 500 with the uncaught
Koha::Exceptions::Metadata::Invalid:
- catalogue/MARCdetail.pl
- catalogue/ISBDdetail.pl
- catalogue/labeledMARCdetail.pl
- catalogue/moredetail.pl
- catalogue/showmarc.pl (html, marc, xml and card)
- cataloguing/additem.pl
- cataloguing/addbiblio.pl?biblionumber=1: "Can't call method "title" on an
undefined value" at line 668 (the editor reads the record in an eval, and then
does not check it)

OPAC, all return a 500 with the exception:
- opac-detail.pl
- opac-MARCdetail.pl
- opac-ISBDdetail.pl
- opac-showmarc.pl
- opac-basket.pl
- opac-export.pl

REST API: GET /api/v1/biblios/1 returns a 500, in JSON and in MARCXML.

These work: catalogue/search.pl and opac-search.pl (they use the search engine
records), catalogue/issuehistory.pl, reserve/request.pl, cataloguing/merge.pl
(bug 43027).

About 100 scripts and modules call ->metadata->record and only a few of them
are guarded. For a patron the OPAC pages are the most visible: a record that
cannot be read gives an error page instead of the usual "not available".

Proposal:
- OPAC: handle the exception like a record that does not exist (the existing
not found page), and log the error for the library.
- Staff interface: show the encoding error notice that catalogue/detail.pl
shows (bug 44070) instead of the error, and render what can be rendered (the
items, for moredetail.pl and additem.pl).
- cataloguing/addbiblio.pl: do not read the title of a record that could not be
read.
- REST API: return an error that says that the metadata of the record cannot be
read.

See also bugs 43777, 43025 and 44070.


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43777
[Bug 43777] Koha::Biblio::Metadata->record should repair recoverable MARCXML
faults on read
-- 
You are receiving this mail because:
You are the assignee for the bug.
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