Bug 24243: Do not explode if invalid metadata when searching catalogue
If the bibliographic record metadata cannot be decoded, the get_coins call should catch the exception raised by Koha::Biblio::Metadata->record to not explode Error is: "Invalid data, cannot decode objec" Test plan: 0/ Do not apply the patch 1/ Search for record at the OPAC 2/ Note one of the biblionumber from the first page result 3/ Set to empty string the biblio_metadata to make the error appears: update biblio_metadata set metadata="" where biblionumber=42; 4/ Try the same search => You get an internal server error 5/ Apply the patch, restart plack and try again => It now works, ie. it does not explode Signed-off-by: Liz Rea <wizzyrea@gmail.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
3c222cf569
commit
8112e2a636
1 changed files with 2 additions and 1 deletions
|
@ -691,7 +691,8 @@ for (my $i=0;$i<@servers;$i++) {
|
|||
|
||||
if (C4::Context->preference('COinSinOPACResults')) {
|
||||
my $biblio = Koha::Biblios->find( $res->{'biblionumber'} );
|
||||
$res->{coins} = $biblio ? $biblio->get_coins : q{}; # FIXME This should be moved at the beginning of the @newresults loop
|
||||
# Catch the exception as Koha::Biblio::Metadata->record can explode if the MARCXML is invalid
|
||||
$res->{coins} = $biblio ? eval {$biblio->get_coins} : q{}; # FIXME This should be moved at the beginning of the @newresults loop
|
||||
}
|
||||
if ( C4::Context->preference( "Babeltheque" ) and $res->{normalized_isbn} ) {
|
||||
if( my $isbn = Business::ISBN->new( $res->{normalized_isbn} ) ) {
|
||||
|
|
Loading…
Reference in a new issue