]> git.koha-community.org Git - koha.git/commit
Bug 26921: Don't generate an invalid custom cover image if the url cannot be generated
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 5 Nov 2020 15:02:14 +0000 (16:02 +0100)
committerFridolin Somers <fridolin.somers@biblibre.com>
Mon, 28 Dec 2020 13:46:25 +0000 (14:46 +0100)
commit6f64a3366a5fdb9c91c5479aa546c402cfabd22d
tree7717bb1f0728262bef0be41a67a8572d5c2de431
parent6b24d072f9fc91e39e7f482467d93571b0c0e474
Bug 26921: Don't generate an invalid custom cover image if the url cannot be generated

In case a custom cover image url is used to generate the cover image of
bibliographic records, we should not build one if the record does not
have the necessary data.

For instance if you have
CustomCoverImagesURL set to https://covers.openlibrary.org/b/isbn/{isbn}-M.jpb
and a biblio does not have the isbn defined, we should not generate and
empty image (empty or invalid src)

Test plan:
0.
Set CustomCoverImagesURL to https://covers.openlibrary.org/b/isbn/{isbn}-M.jpb
Enable CustomCoverImages and OPACCustomCoverImages
To highlight the issue you should disable LocalCoverImages and OPACLocalCoverImages.
1. Make sure you have some of your bibliographic records with a valid
isbn
2. Make sure you have at least 1 bibliographic record without an isbn
set
3. Visit the search result and detail views (OPAC and staff interfaces)
=> Without this patch you should see a "Cover image" link, and an empty
block/div on the detail page
=> With this patch applied you should only see images when the url can
be generated

Note that the problem will persist if the isbn is not valid (ie. no
image is generated)

Sponsored-by: Orex Digital
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 1ea55acd0c997b96039a2a1a4a9f9941d2558bda)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
12 files changed:
Koha/Biblio.pm
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt
koha-tmpl/opac-tmpl/bootstrap/en/includes/shelfbrowser.inc
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-opensearch.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-showreviews-rss.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-showreviews.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt
t/db_dependent/Koha/Biblios.t