Bug 35558: Do not retrieve the local image if none exists - OPAC

Test plan:
 1 - Enable system preferences:
     LocalCoverImages
     OPACLocalCoverImages
 2 - open browser tools network page
 3 - Perform an intranet search
 4 - Note a request for each bib like:
    http://localhost:8081/cgi-bin/koha/catalogue/image.pl?thumbnail=1&biblionumber=35
 5 - Repeat on opac, same requests
 6 - Apply patches
 7 - Restart all
 8 - Repeat searches, note no fetches
 9 - Add local cover images to several biblios in the results
10 - Repeat searches
11 - Note the fetches are only for those records with images
12 - Confirm images still load correctly

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 747c9b573b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Jonathan Druart 2024-03-14 15:01:39 +01:00 committed by Fridolin Somers
parent 1ac5466bc2
commit 7e834c095a
2 changed files with 5 additions and 1 deletions

View file

@ -340,7 +340,7 @@
<div class="coverimages cover-slides itemtype_[% SEARCH_RESULT.itemtype | html %]" data-isbn="[% To.json(SEARCH_RESULT.normalized_isbn) | $raw %]" data-imgtitle="[% img_title | html %]">
<a class="p1" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | uri %]">
[% IF ( OPACLocalCoverImages ) %]
[% IF ( OPACLocalCoverImages && SEARCH_RESULT.has_local_cover_image ) %]
<span title="[% img_title | html %]" class="[% SEARCH_RESULT.biblionumber | html %]" id="local-thumbnail[% loop.count | html %]"></span>
[% END %]

View file

@ -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"}){