bug 2505: enable warnings in C4::ImportBatch and C4::Matcher
authorGalen Charlton <galen.charlton@liblime.com>
Sun, 7 Jun 2009 22:02:46 +0000 (10:02 +1200)
committerGalen Charlton <galen.charlton@liblime.com>
Mon, 8 Jun 2009 01:09:19 +0000 (20:09 -0500)
Also fix issues with normalizing ISBNs and the default
normalizer in C4::Matcher.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
C4/ImportBatch.pm
C4/Matcher.pm

index 9ceb15a..a8bd2cb 100644 (file)
@@ -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();
index 512562c..c9a1e46 100644 (file)
@@ -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+$//;