From 826e66c6da535d343b407e141cfd995a0916aeeb Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 14 Mar 2024 15:01:39 +0100 Subject: [PATCH] Bug 35558: Do not retrieve the local image if none exists - OPAC --- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt | 2 +- opac/opac-search.pl | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt index 043b1bbc69c..dbfdc6c3a0a 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt @@ -350,7 +350,7 @@
- [% IF ( OPACLocalCoverImages ) %] + [% IF ( OPACLocalCoverImages && SEARCH_RESULT.has_local_cover_image ) %] [% END %] diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 16b69332ff3..540b693ace0 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -702,6 +702,10 @@ for (my $i=0;$i<@servers;$i++) { # BZ17530: 'Intelligent' guess if result can be article requested $res->{artreqpossible} = ( $art_req_itypes->{ $res->{itemtype} // q{} } || $art_req_itypes->{ '*' } ) ? 1 : q{}; + + if ( C4::Context->preference('OPACLocalCoverImages') ) { + $res->{has_local_cover_image} = $res->{biblio_object}->cover_images->count; + } } if ($results_hashref->{$server}->{"hits"}){ -- 2.34.1