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)
committerFridolin Somers <fridolin.somers@biblibre.com>
Fri, 15 Nov 2019 10:27:07 +0000 (11:27 +0100)
commita25bd1daa5213ebdd9487e056b6cb5eb66055739
tree544e77072221dfe7ea4d867f497ab7ecea45a42a
parent5eb36ad98e95147a937422f5e15f72c352b6edaa
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>
(cherry picked from commit 068943f18d60edc231b59b6232fecabaf1c799ab)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
catalogue/detail.pl
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt