From 33a093a6cde5a138ce5ab262032860e3c5d904bc Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 21 Aug 2020 18:14:50 +0200 Subject: [PATCH] Bug 26145: Correctly preserve itemnumber value In order to know we are dealing with the cover images of a specific item we need to pass it though the different forms. --- catalogue/imageviewer.pl | 6 ++++- .../prog/en/modules/catalogue/imageviewer.tt | 25 ++++++++++++++++--- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/catalogue/imageviewer.pl b/catalogue/imageviewer.pl index 8b6f06fe24..544b703748 100755 --- a/catalogue/imageviewer.pl +++ b/catalogue/imageviewer.pl @@ -92,11 +92,15 @@ if ( C4::Context->preference("LocalCoverImages") ) { ); } $template->{VARS}->{'count'} = $itemcount; -$template->{VARS}->{'biblionumber'} = $biblionumber; $template->{VARS}->{'norequests'} = $norequests; $template->param(C4::Search::enabled_staff_search_views); $template->{VARS}->{'biblio'} = $biblio; +$template->param( + biblionumber => $biblionumber, + itemnumber => $itemnumber, +); + my @allorders_using_biblio = GetOrdersByBiblionumber ($biblionumber); my @deletedorders_using_biblio; my @orders_using_biblio; 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 9fbd9e88e4..a45fe345af 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt @@ -56,7 +56,7 @@
[% ELSE %] -
There are no images for this record.
+ [% IF itemnumber %] +
There are no images for this item.
+ [% ELSE %] +
There are no images for this record.
+ [% END %] [% IF ( CAN_user_tools_upload_local_cover_images ) %]
-

Upload an image file: Upload +

+ Upload an image file: + [% IF itemnumber %] + + [% ELSE %] + + [% END %] + Upload

[% END %] [% END %] @@ -126,6 +137,8 @@ function removeLocalImage(imagenumber) { var thumbnail = $("#imagenumber-" + imagenumber ); + var itemnumber = $(thumbnail).data("itemnumber"); + var biblionumber = $(thumbnail).data("biblionumber"); var copy = thumbnail.html(); thumbnail.find("img").css("opacity", ".2"); thumbnail.find("a.remove").html(""); @@ -135,7 +148,11 @@ success: function(data) { $(data).each( function() { if ( this.deleted == 1 ) { - location.href="/cgi-bin/koha/catalogue/imageviewer.pl?biblionumber=" + biblionumber; + if( itemnumber ) { + location.href="/cgi-bin/koha/catalogue/imageviewer.pl?itemnumber=" + itemnumber; + } else { + location.href="/cgi-bin/koha/catalogue/imageviewer.pl?biblionumber=" + biblionumber; + } } else { thumbnail.html( copy ); alert(_("An error occurred on deleting this image")); -- 2.20.1