The way Koha get book cover from Amazon doesn't work from biblio records
having ISBN13 because Amazon expect an ISBN10. This patch transforms
ISBN13 into ISBN10 before sending it to Amazon.
Warning! On some devel installations, you will have to install by hand a
new CPAN depency:
Business::ISBN
Signed-off-by: Ian Walls <ian.walls@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
'required' => '0',
'min_ver' => '0.97',
},
'required' => '0',
'min_ver' => '0.97',
},
+ 'Business::ISBN' => {
+ 'usage' => 'Core',
+ 'required' => '0',
+ 'min_ver' => '2.05',
+ },
use C4::Output;
use URI::Split qw(uri_split);
use Memoize;
use C4::Output;
use URI::Split qw(uri_split);
use Memoize;
use vars qw($VERSION @ISA @EXPORT $DEBUG);
use vars qw($VERSION @ISA @EXPORT $DEBUG);
}
# Normalizes and returns the first valid ISBN found in the record
}
# Normalizes and returns the first valid ISBN found in the record
+# ISBN13 are converted into ISBN10. This is required to get Amazon cover book.
sub GetNormalizedISBN {
my ($isbn,$record,$marcflavour) = @_;
my @fields;
sub GetNormalizedISBN {
my ($isbn,$record,$marcflavour) = @_;
my @fields;
}
sub _isbn_cleanup ($) {
}
sub _isbn_cleanup ($) {
- my $normalized_isbn = shift;
- $normalized_isbn =~ s/-//g;
- $normalized_isbn =~/([0-9x]{1,})/i;
- $normalized_isbn = $1;
- if (
- $normalized_isbn =~ /\b(\d{13})\b/ or
- $normalized_isbn =~ /\b(\d{12})\b/i or
- $normalized_isbn =~ /\b(\d{10})\b/ or
- $normalized_isbn =~ /\b(\d{9}X)\b/i
- ) {
- return $1;
- }
- return undef;
+ my $isbn = Business::ISBN->new( shift );
+ return undef unless $isbn;
+ $isbn = $isbn->as_isbn10 if $isbn->type eq 'ISBN13';
+ $isbn = $isbn->as_string;
+ $isbn =~ s/-//g;
+ return $isbn;
idzebra-2.0-utils \
libalgorithm-checkdigits-perl \
libbiblio-endnotestyle-perl \
idzebra-2.0-utils \
libalgorithm-checkdigits-perl \
libbiblio-endnotestyle-perl \
libcgi-session-perl \
libcgi-session-serialize-yaml-perl \
libclass-accessor-perl \
libcgi-session-perl \
libcgi-session-serialize-yaml-perl \
libclass-accessor-perl \