Lines 24-29
use C4::Context;
Link Here
|
24 |
use C4::Output; |
24 |
use C4::Output; |
25 |
use URI::Split qw(uri_split); |
25 |
use URI::Split qw(uri_split); |
26 |
use Memoize; |
26 |
use Memoize; |
|
|
27 |
use Business::ISBN; |
27 |
|
28 |
|
28 |
use vars qw($VERSION @ISA @EXPORT $DEBUG); |
29 |
use vars qw($VERSION @ISA @EXPORT $DEBUG); |
29 |
|
30 |
|
Lines 1235-1240
sub GetNormalizedUPC {
Link Here
|
1235 |
} |
1236 |
} |
1236 |
|
1237 |
|
1237 |
# Normalizes and returns the first valid ISBN found in the record |
1238 |
# Normalizes and returns the first valid ISBN found in the record |
|
|
1239 |
# ISBN13 are converted into ISBN10. This is required to get Amazon cover book. |
1238 |
sub GetNormalizedISBN { |
1240 |
sub GetNormalizedISBN { |
1239 |
my ($isbn,$record,$marcflavour) = @_; |
1241 |
my ($isbn,$record,$marcflavour) = @_; |
1240 |
my @fields; |
1242 |
my @fields; |
Lines 1321-1339
sub _normalize_match_point {
Link Here
|
1321 |
} |
1323 |
} |
1322 |
|
1324 |
|
1323 |
sub _isbn_cleanup ($) { |
1325 |
sub _isbn_cleanup ($) { |
1324 |
my $normalized_isbn = shift; |
1326 |
my $isbn = Business::ISBN->new( shift ); |
1325 |
$normalized_isbn =~ s/-//g; |
1327 |
return undef unless $isbn; |
1326 |
$normalized_isbn =~/([0-9x]{1,})/i; |
1328 |
$isbn = $isbn->as_isbn10 if $isbn->type eq 'ISBN13'; |
1327 |
$normalized_isbn = $1; |
1329 |
$isbn = $isbn->as_string; |
1328 |
if ( |
1330 |
$isbn =~ s/-//g; |
1329 |
$normalized_isbn =~ /\b(\d{13})\b/ or |
1331 |
return $isbn; |
1330 |
$normalized_isbn =~ /\b(\d{12})\b/i or |
|
|
1331 |
$normalized_isbn =~ /\b(\d{10})\b/ or |
1332 |
$normalized_isbn =~ /\b(\d{9}X)\b/i |
1333 |
) { |
1334 |
return $1; |
1335 |
} |
1336 |
return undef; |
1337 |
} |
1332 |
} |
1338 |
|
1333 |
|
1339 |
1; |
1334 |
1; |