Bug 14629 - [QA Followup] Pass invalid ISSN through GetVariationsOfISSN
This is an optional follow up depending on community opinion. While copying over the code form the ISBN portion I noticed that with aggressive matching enabled invalid ISBNs (and hence ISSNs) were being stripped from the record. I think in the case of a library exporting records, making changes, and reimporting they would expect to get a match on ISSN or ISBN whether or not the number is valid. This patch changes the subroutine to return the original ISSN in the case of it being invalid. To test: With first patch only export a record with an invalid ISSN and reimport with AggressiveMatchOnISSN enabled and match on ISSN - you should not get a match Apply this patch reimport the file and you should find a match. Signed-off-by: Chad Roseburg <croseburg@ncrl.org> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
68ced964fd
commit
0963dc4da6
2 changed files with 8 additions and 4 deletions
|
@ -1396,8 +1396,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;
|
||||
|
|
5
t/Koha.t
5
t/Koha.t
|
@ -25,7 +25,7 @@ use Module::Load::Conditional qw/check_install/;
|
|||
|
||||
BEGIN {
|
||||
if ( check_install( module => 'Test::DBIx::Class' ) ) {
|
||||
plan tests => 37;
|
||||
plan tests => 38;
|
||||
} else {
|
||||
plan skip_all => "Need Test::DBIx::Class"
|
||||
}
|
||||
|
@ -152,6 +152,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;
|
||||
|
|
Loading…
Reference in a new issue