View | Details | Raw Unified | Return to bug 14287
Collapse All | Expand All

(-)a/C4/Koha.pm (-2 / +2 lines)
Lines 1720-1731 sub NormalizeISBN { Link Here
1720
    if ( $isbn && $isbn->is_valid() ) {
1720
    if ( $isbn && $isbn->is_valid() ) {
1721
1721
1722
        if ( $format eq 'ISBN-10' ) {
1722
        if ( $format eq 'ISBN-10' ) {
1723
            $isbn = $isbn->as_isbn10();
1723
            my $isbn10 = $isbn->as_isbn10();
1724
            $isbn = $isbn10 if $isbn10;
1724
        }
1725
        }
1725
        elsif ( $format eq 'ISBN-13' ) {
1726
        elsif ( $format eq 'ISBN-13' ) {
1726
            $isbn = $isbn->as_isbn13();
1727
            $isbn = $isbn->as_isbn13();
1727
        }
1728
        }
1728
        return unless $isbn;
1729
1729
1730
        if ($strip_hyphens) {
1730
        if ($strip_hyphens) {
1731
            $string = $isbn->as_string( [] );
1731
            $string = $isbn->as_string( [] );
(-)a/t/Koha.t (-2 / +1 lines)
Lines 93-99 eval { Link Here
93
    $isbn = C4::Koha::NormalizeISBN({ isbn => '979-10-90085-00-8', format => 'ISBN-10', strip_hyphens => 1 });
93
    $isbn = C4::Koha::NormalizeISBN({ isbn => '979-10-90085-00-8', format => 'ISBN-10', strip_hyphens => 1 });
94
};
94
};
95
ok($@ eq '', 'NormalizeISBN does not throw exception when converting to ISBN10 an ISBN starting with 979 (bug 13167)');
95
ok($@ eq '', 'NormalizeISBN does not throw exception when converting to ISBN10 an ISBN starting with 979 (bug 13167)');
96
ok(!defined $isbn, 'NormalizeISBN returns undef when converting to ISBN10 an ISBN starting with 979 (bug 13167)');
96
ok($isbn eq '9791090085008', 'NormalizeISBN returns ISBN13 when converting to ISBN10 an ISBN starting with 979 (bug 14287)');
97
97
98
@isbns = GetVariationsOfISBNs('abc');
98
@isbns = GetVariationsOfISBNs('abc');
99
is(scalar(@isbns), 0, 'zero variations returned of invalid ISBN');
99
is(scalar(@isbns), 0, 'zero variations returned of invalid ISBN');
100
- 

Return to bug 14287