From e5907aaf68761eff1bdbfec2b8d43b9dff417884 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 1 Mar 2019 08:00:53 -0300 Subject: [PATCH] Bug 22445: Add new method Koha::Biblio->custom_cover_image_url Sponsored-by: Orex Digital --- Koha/Biblio.pm | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index fae91cef33..35d508b203 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -656,6 +656,29 @@ sub get_openurl { return $OpenURLResolverURL; } +=head3 custom_cover_image_url + +my $image_url = $biblio->custom_cover_image_url + +Return the specific url of the cover image for this bibliographic record. +It is built regaring the value of the system preference CustomCoverImagesURL + +=cut + +sub custom_cover_image_url { + my ( $self ) = @_; + my $url = C4::Context->preference('CustomCoverImagesURL'); + if ( $url =~ m|%isbn%| ) { + my $isbn = $self->biblioitem->isbn; + $url =~ s|%isbn%|$isbn|g; + } + if ( $url =~ m|%issn%| ) { + my $issn = $self->biblioitem->issn; + $url =~ s|%issn%|$issn|g; + } + return $url; +} + =head3 type =cut -- 2.11.0