@@ -, +, @@ GetVariationsOfISSN --- C4/Koha.pm | 7 +++++-- t/Koha.t | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) --- a/C4/Koha.pm +++ a/C4/Koha.pm @@ -1931,8 +1931,11 @@ sub GetVariationsOfISSN { my @issns; - push( @issns, NormalizeISSN({ issn => $issn }) ); - push( @issns, NormalizeISSN({ issn => $issn, strip_hyphen => 1 }) ); + if( NormalizeISSN({issn => $issn}) ){ + push( @issns, NormalizeISSN({ issn => $issn }) ); + push( @issns, NormalizeISSN({ issn => $issn, strip_hyphen => 1 }) ); + } + else { push( @issns, $issn) } # Strip out any "empty" strings from the array @issns = grep { defined($_) && $_ =~ /\S/ } @issns; --- a/t/Koha.t +++ a/t/Koha.t @@ -25,7 +25,7 @@ use Module::Load::Conditional qw/check_install/; BEGIN { if ( check_install( module => 'Test::DBIx::Class' ) ) { - plan tests => 36; + plan tests => 37; } else { plan skip_all => "Need Test::DBIx::Class" } @@ -134,6 +134,7 @@ eval { ok($@ eq '', 'NormalizeISSN does not throw exception when parsing invalid ISSN'); @issns = GetVariationsOfISSNs('abc'); -is(scalar(@issns), 0, 'zero variations returned of invalid ISSN'); +is($issns[0], 'abc', 'Original ISSN passed through even if invalid'); +is(scalar(@issns), 1, 'zero additional variations returned of invalid ISSN'); 1; --