Bug 23846: Display degraded view when MARCXML is invalid (staff detail)
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 12 Nov 2019 10:04:42 +0000 (11:04 +0100)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Wed, 13 Nov 2019 08:04:15 +0000 (08:04 +0000)
commit068943f18d60edc231b59b6232fecabaf1c799ab
treef7791f7d0c7a3daf83d69b654050b788b4e56695
parent150361c0e58e9a049b03693ce4859b9035d5c558
Bug 23846: Display degraded view when MARCXML is invalid (staff detail)

When an invalid bibliographic record is imported into the catalogue
there is not warning or error. However the bibliographic record detail
page will explode (Koha::Biblio::Metadata->record will raise an
exception).

This patch proposes to catch the exception on this view and display a
warning about the situation.
Note that editing/saving the record will fix the MARCXML data and so
removes the warning (some black magic we should get rid of I suspect).

Test plan:
- Import a bibliographic record with invalid XML, you can add non
printable characters, like 0x1F (CTRL-V 1F with vim)
- Go to the detail page
=> Without this patch you get a 500
=> With this patch applied you get a "degraded view" with a warning
message, telling you what the error is.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
catalogue/detail.pl
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt