From 18069f4b62314537564976daf6a0d5a806e5e240 Mon Sep 17 00:00:00 2001 From: Andreas Roussos Date: Mon, 30 Jan 2023 08:35:33 +0100 Subject: [PATCH] Bug 31207: Fix the display of local cover images in the OPAC Shelf browser This patch adds back Template Toolkit and JavaScript code that was removed in commit fad97080e97da5bc77724c68b9394aba15518847 (Bug 28180), thus fixing the problem of Shelf browser images not being loaded in the OPAC Details page for a biblio. This feature stopped working in v21.11.00, and these conditions must be met to be able to reproduce the problem: a) Exclusive use of local cover images, and b) Covers uploaded at the biblio level only. Test plan: 0) Configure the following System Preferences: - OPACShelfBrowser => 'Show' - LocalCoverImages => 'Show' - OPACLocalCoverImages => 'Show' (ensure no other cover image provider is enabled) - OpacSeparateHoldings => 'Don't separate' - OpacSeparateHoldingsBranch => 'home library' 1) Create a bibliographic record that has: - a local cover image at the biblio level (use the 'Images' tab in the Details page of the record to upload a test image) - a single item with a Call number (the Call number value can be anything, it's only needed to trigger the Shelf browser) 2) In the OPAC, visit the Details page of the record you just added, and click on the 'Browse shelf' link found in the 'Call number' column of the 'Holdings' tab. When the Shelf browser expands, there will be no cover image displayed. 3) Apply the patch and refresh the page with CTRL-F5. The Shelf browser will now display the local cover image associated with your test record. 4) Make sure the relevant unit test passes: prove -v t/db_dependent/ShelfBrowser.t --- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt index e97198aed4..3df59c5eaf 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -1810,6 +1810,13 @@ KOHA.OpenLibrary.GetCoverFromIsbn(); [% END %] + [% IF OPACLocalCoverImages %] + KOHA.LocalCover.GetCoverFromBibnumber(true); + [% IF itemloop_has_images OR otheritemloop_has_images %] + KOHA.LocalCover.GetCoverFromItemnumber(true); + [% END %] + [% END %] + [% IF ( NovelistSelectProfile && ( normalized_isbn || normalized_upc ) ) %] novSelect.loadContentForQuery( { -- 2.20.1