[Koha-patches] [PATCH] bug 2505: enable warnings in C4::ImportBatch and C4::Matcher

Chris Cormack chrisc at catalyst.net.nz
Mon Jun 8 00:02:46 CEST 2009


From: Galen Charlton <galen.charlton at liblime.com>

Also fix issues with normalizing ISBNs and the default
normalizer in C4::Matcher.

Signed-off-by: Chris Cormack <chrisc at catalyst.net.nz>
---
 C4/ImportBatch.pm |    7 +++----
 C4/Matcher.pm     |    4 +++-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/C4/ImportBatch.pm b/C4/ImportBatch.pm
index 9ceb15a..a8bd2cb 100644
--- a/C4/ImportBatch.pm
+++ b/C4/ImportBatch.pm
@@ -18,6 +18,8 @@ package C4::ImportBatch;
 # Suite 330, Boston, MA  02111-1307 USA
 
 use strict;
+use warnings;
+
 use C4::Context;
 use C4::Koha;
 use C4::Biblio;
@@ -1252,10 +1254,7 @@ sub _add_biblio_fields {
     my ($title, $author, $isbn, $issn) = _parse_biblio_fields($marc_record);
     my $dbh = C4::Context->dbh;
     # FIXME no controlnumber, originalsource
-    # FIXME 2 - should regularize normalization of ISBN wherever it is done
-    $isbn =~ s/\(.*$//;
-    $isbn =~ tr/ -_//;  
-    $isbn = uc $isbn;
+    $isbn = C4::Koha::_isbn_cleanup($isbn); # FIXME C4::Koha::_isbn_cleanup should be made public
     my $sth = $dbh->prepare("INSERT INTO import_biblios (import_record_id, title, author, isbn, issn) VALUES (?, ?, ?, ?, ?)");
     $sth->execute($import_record_id, $title, $author, $isbn, $issn);
     $sth->finish();
diff --git a/C4/Matcher.pm b/C4/Matcher.pm
index 512562c..c9a1e46 100644
--- a/C4/Matcher.pm
+++ b/C4/Matcher.pm
@@ -18,6 +18,8 @@ package C4::Matcher;
 # Suite 330, Boston, MA  02111-1307 USA
 
 use strict;
+use warnings;
+
 use C4::Context;
 use MARC::Record;
 use C4::Search;
@@ -820,7 +822,7 @@ sub _parse_match_component {
 # FIXME - default normalizer
 sub _normalize {
     my $value = uc shift;
-    $value =~ s/.;:,\]\[\)\(\/'"//g;
+    $value =~ s/[.;:,\]\[\)\(\/'"]//g;
     $value =~ s/^\s+//;
     #$value =~ s/^\s+$//;
     $value =~ s/\s+$//;
-- 
1.5.6.3



More information about the Koha-patches mailing list