[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha/C4 Breeding.pm [dev_week]
From: |
Ryan Higgins |
Subject: |
[Koha-cvs] koha/C4 Breeding.pm [dev_week] |
Date: |
Thu, 29 Mar 2007 09:46:08 +0000 |
CVSROOT: /sources/koha
Module name: koha
Branch: dev_week
Changes by: Ryan Higgins <rych> 07/03/29 09:46:08
Modified files:
C4 : Breeding.pm
Log message:
cleaned up a bit
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Breeding.pm?cvsroot=koha&only_with_tag=dev_week&r1=1.7.2.1.2.5&r2=1.7.2.1.2.6
Patches:
Index: Breeding.pm
===================================================================
RCS file: /sources/koha/koha/C4/Breeding.pm,v
retrieving revision 1.7.2.1.2.5
retrieving revision 1.7.2.1.2.6
diff -u -b -r1.7.2.1.2.5 -r1.7.2.1.2.6
--- Breeding.pm 24 Mar 2007 23:34:36 -0000 1.7.2.1.2.5
+++ Breeding.pm 29 Mar 2007 09:46:08 -0000 1.7.2.1.2.6
@@ -73,16 +73,29 @@
for (my $i=0;$i<=$#marcarray;$i++) {
$breedingid=0;
my $marcrecord =
MARC::File::USMARC::decode($marcarray[$i]."\x1D");
- my @warnings = $marcrecord->warnings();
+
+ # run through a roundtrip, check encoding, and convert to UTF-8
+ my $xmlrecord = $marcrecord->as_xml;
+ my $newmarcrecord;
+ eval {
+ $newmarcrecord =
MARC::Record::new_from_xml($xmlrecord,'UTF-8');
+ };
+ if ($@) {
+ warn "MARC Record has a problem in ImportBreeding:";
+ warn $xmlrecord;
+ #warn $newmarcrecord->as_usmarc();
+ warn $@;
+ next;
+ }
+ my @warnings = $newmarcrecord->warnings();
for my $warning (@warnings) {
warn "WARN".$warning;
}
+ $marcrecord = $newmarcrecord;
if (scalar($marcrecord->fields()) == 0) {
$notmarcrecord++;
} else {
my $oldbiblio = MARCmarc2koha($dbh,$marcrecord,'');
- #$oldbiblio->{title} =
char_decode($oldbiblio->{title},$encoding);
- #$oldbiblio->{author} =
char_decode($oldbiblio->{author},$encoding);
# if isbn found and biblio does not exist, add it. If
isbn found and biblio exists, overwrite or ignore depending on user choice
# drop every "special" char : spaces, - ...
$oldbiblio->{isbn} =~ s/ |-|\.//g,