Bugzilla – Attachment 48510 Details for
Bug 14629
Add aggressive ISSN matching feature equivalent to the aggressive ISBN matcher
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14629 - [QA Followup] Pass invalid ISSN through GetVariationsOfISSN
Bug-14629---QA-Followup-Pass-invalid-ISSN-through-.patch (text/plain), 3.56 KB, created by
Nick Clemens (kidclamp)
on 2016-03-01 13:53:31 UTC
(
hide
)
Description:
Bug 14629 - [QA Followup] Pass invalid ISSN through GetVariationsOfISSN
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2016-03-01 13:53:31 UTC
Size:
3.56 KB
patch
obsolete
>From f02270ee798a48c032f4c10487d4e8edc5d91cc4 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 31 Dec 2015 16:00:10 +0000 >Subject: [PATCH] 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. >--- > C4/Koha.pm | 7 +++++-- > t/Koha.t | 8 +++----- > 2 files changed, 8 insertions(+), 7 deletions(-) > >diff --git a/C4/Koha.pm b/C4/Koha.pm >index 4f805eb..58025d1 100644 >--- a/C4/Koha.pm >+++ b/C4/Koha.pm >@@ -1719,8 +1719,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; >diff --git a/t/Koha.t b/t/Koha.t >index 06a649e..b7e57d2 100755 >--- a/t/Koha.t >+++ b/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" > } >@@ -119,7 +119,6 @@ is( C4::Koha::GetNormalizedISBN('9781250075345 (hardcover) | 1250075343 (hardcov > is( C4::Koha::GetNormalizedISBN('9781250067128 | 125006712X'), '125006712X', 'Test GetNormalizedISBN' ); > is( C4::Koha::GetNormalizedISBN('9780373211463 | 0373211465'), '0373211465', 'Test GetNormalizedISBN' ); > >-<<<<<<< HEAD > is( C4::Koha::GetNormalizedUPC(), undef, 'GetNormalizedUPC should return undef if no record is passed' ); > is( C4::Koha::GetNormalizedISBN(), undef, 'GetNormalizedISBN should return undef if no record and no isbn are passed' ); > is( C4::Koha::GetNormalizedEAN(), undef, 'GetNormalizedEAN should return undef if no record and no isbn are passed' ); >@@ -150,7 +149,6 @@ subtest 'getFacets() tests' => sub { > 'location facet present with singleBranchMode off (bug 10078)' > ); > }; >-======= > > is(C4::Koha::NormalizeISSN({ issn => '0024-9319', strip_hyphen => 1 }), '00249319', 'Test NormalizeISSN with all features enabled' ); > is(C4::Koha::NormalizeISSN({ issn => '0024-9319', strip_hyphen => 0 }), '0024-9319', 'Test NormalizeISSN with all features enabled' ); >@@ -166,7 +164,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'); >->>>>>>> Bug 14629 - Add aggressive ISSN matching feature equivalent to the aggressive ISBN matcher >+is($issns[0], 'abc', 'Original ISSN passed through even if invalid'); >+is(scalar(@issns), 1, 'zero additional variations returned of invalid ISSN'); > > 1; >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14629
:
46102
|
46159
|
46440
|
48509
|
48510
|
48513
|
48514
|
48793
|
48794
|
51028
|
51029
|
54280
|
56954
|
56955
|
56956
|
56957