Bug 23785: Fix call get_coins on undef value in opac-search.pl

If the search engine index returns a record that is no longer in the DB,
an OPAC search will explode with:
  Can't call method "get_coins" on an undefined value at
  /usr/share/koha/opac/cgi-bin/opac/opac-search.pl line 692.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2019-11-11 10:14:14 +01:00 committed by Martin Renvoize
parent 916bb2a2b8
commit 773f7ca461
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
1 changed files with 1 additions and 1 deletions

View File

@ -691,7 +691,7 @@ for (my $i=0;$i<@servers;$i++) {
if (C4::Context->preference('COinSinOPACResults')) {
my $biblio = Koha::Biblios->find( $res->{'biblionumber'} );
$res->{coins} = $biblio->get_coins;
$res->{coins} = $biblio ? $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} ) ) {