]> 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)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 21 Dec 2020 09:07:48 +0000 (10:07 +0100)
commit1ea55acd0c997b96039a2a1a4a9f9941d2558bda
treebb10376b02f75f4f2fe2662685bddf321d50e030
parent85c25260853aa1c8003b0a041dba2772cd2f316b
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>
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