From a7058da8df97a01ee9667fa1ace50d962f7658ee Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 3 May 2023 11:16:14 +0200 Subject: [PATCH] Bug 32412: Do not reload COCE image for biblio We do not want to fetch again the new image for the biblio record. We only want to fetch those for the shelf browser. Note that the third parameter 'covernewwindow' was not used. Signed-off-by: Lucas Gass Signed-off-by: Jonathan Druart Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 13dccaaf055b49473c1cc4a6ac34c0a23eb182a0) Signed-off-by: Martin Renvoize (cherry picked from commit 3da06bdd73fa576b735303205c8124d8580b6ec4) Signed-off-by: Lucas Gass --- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt | 4 ++-- koha-tmpl/opac-tmpl/bootstrap/js/coce.js | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) 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 b8cf0c4c8f..f978f662ef 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -1826,7 +1826,7 @@ KOHA.Google.GetCoverFromIsbn([% covernewwindow | html %]); [% END %] [% IF ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) %] - KOHA.coce.getURL('[% Koha.Preference('CoceHost') | html %]', '[% Koha.Preference('CoceProviders') | html %]',[% covernewwindow | html %]); + KOHA.coce.getURL('[% Koha.Preference('CoceHost') | html %]', '[% Koha.Preference('CoceProviders') | html %]', $("#bibliodescriptions")); [% END %] [% IF OpenLibraryCovers %] KOHA.OpenLibrary.GetCoverFromIsbn(); @@ -1852,7 +1852,7 @@ KOHA.Google.GetCoverFromIsbn([% covernewwindow | html %]); [% END %] [% IF ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) %] - KOHA.coce.getURL('[% Koha.Preference('CoceHost') | html %]', '[% Koha.Preference('CoceProviders') | html %]',[% covernewwindow | html %]); + KOHA.coce.getURL('[% Koha.Preference('CoceHost') | html %]', '[% Koha.Preference('CoceProviders') | html %]', $("#bibliodescriptions")); [% END %] [% IF OpenLibraryCovers %] KOHA.OpenLibrary.GetCoverFromIsbn(); diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/coce.js b/koha-tmpl/opac-tmpl/bootstrap/js/coce.js index 65772380dd..8508d3a82b 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/js/coce.js +++ b/koha-tmpl/opac-tmpl/bootstrap/js/coce.js @@ -14,9 +14,11 @@ KOHA.coce = { * and run a search with all collected isbns to coce cover service. * The result is asynchronously returned, and used to append . */ - getURL: function(host, provider) { + getURL: function(host, provider, parent=null) { var ids = []; - $("[id^=coce-thumbnail]").each(function() { + const thumbnail_selector = "[id^=coce-thumbnail]"; + let thumbnail_nodes = parent ? parent.find(thumbnail_selector) : $(thumbnail_selector); + thumbnail_nodes.each(function() { var id = $(this).attr("class"); // id=isbn if (id !== '') { ids.push(id); } }); @@ -40,7 +42,7 @@ KOHA.coce = { } }; $(this).attr('href', url); - $(this).empty().append(img); + $(this).append(img); }); } }, -- 2.39.5