From 9a64fc7926741ac3b3093795c97c9730ae07e779 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 8 Jun 2023 10:55:36 +0200 Subject: [PATCH] Bug 33952: Koha::Biblio->normalized_isbn This is needed for bug 33947 where we need to call ->normalized_isbn on a Koha::Biblio object. Signed-off-by: Martin Renvoize Signed-off-by: Nick Clemens --- Koha/Biblio.pm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index 43b53e17b0..1e468c57e7 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -979,7 +979,7 @@ sub custom_cover_image_url { $url =~ s|{isbn}|$isbn|g; } if ( $url =~ m|{normalized_isbn}| ) { - my $normalized_isbn = C4::Koha::GetNormalizedISBN($self->biblioitem->isbn); + my $normalized_isbn = $self->normalized_isbn; return unless $normalized_isbn; $url =~ s|{normalized_isbn}|$normalized_isbn|g; } @@ -1249,6 +1249,19 @@ sub get_marc_authors { return [@first_authors, @other_authors]; } +=head3 normalized_isbn + + my $normalized_isbn = $biblio->normalized_isbn + +Normalizes and returns the first valid ISBN found in the record. +ISBN13 are converted into ISBN10. This is required to get some book cover images. + +=cut + +sub normalized_isbn { + my ( $self) = @_; + return C4::Koha::GetNormalizedISBN($self->biblioitem->isbn); +} =head3 to_api -- 2.30.2