From 106e9e10e96eb1fca1ed77831b67192a63d68043 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 19 Apr 2021 12:11:36 +0200 Subject: [PATCH] Bug 28178: Display the correct image in the image viewer When there are several images attached to a bibliographic record, one can click an image and see it in the image viewer. But the first image is always displayed. Test plan: 0. Turn on LocalCoverImages and AllowMultipleCovers 1. Attach at least two images to a bibliographic record 2. Go to the detail page, click the "Images" tab and click the second image. => With this patch applied you should see the image you selected Sponsored-by: Gerhard Sondermann Dialog e.K. (presseplus.de, presseshop.at, presseshop.ch) Signed-off-by: Owen Leonard Signed-off-by: Kyle M Hall Signed-off-by: Jonathan Druart (cherry picked from commit 3dc9855b461a598487f2e7395a95f092f1f3e1c9) Signed-off-by: Fridolin Somers --- catalogue/imageviewer.pl | 2 +- .../intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/catalogue/imageviewer.pl b/catalogue/imageviewer.pl index d78024bde9..9cc96c11d6 100755 --- a/catalogue/imageviewer.pl +++ b/catalogue/imageviewer.pl @@ -77,7 +77,7 @@ if ( C4::Context->preference("LocalCoverImages") ) { $template->param( LocalCoverImages => 1, images => $images, - imagenumber => (@$images ? $images->[0]->imagenumber : undef), + imagenumber => ( $imagenumber || ( @$images ? $images->[0]->imagenumber : undef ) ), ); } $template->{VARS}->{'count'} = $itemcount; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt index 47f63a41cb..b0435f3c35 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt @@ -66,7 +66,7 @@ [% FOREACH image IN images %]
  • - [% IF loop.first %] + [% IF image.imagenumber == imagenumber %] Thumbnail [% ELSE %] Thumbnail -- 2.39.5