[open-ils-commits] r15034 - trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD (djfiander)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Nov 25 20:35:05 EST 2009
Author: djfiander
Date: 2009-11-25 20:35:03 -0500 (Wed, 25 Nov 2009)
New Revision: 15034
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Caption.pm
Log:
Add some simple error checking to deal with common types of bad
data that I'm seeing in MFHD dumps from real ILSs.
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Caption.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Caption.pm 2009-11-25 22:44:34 UTC (rev 15033)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Caption.pm 2009-11-26 01:35:03 UTC (rev 15034)
@@ -44,10 +44,21 @@
$self->{_mfhdc_CHRONS}->{$key} = $val;
} elsif ($key eq 'u') {
# Bib units per next higher enumeration level
+
+ # Some files seem to have "empty" $u subfields,
+ # especially for top level of enumeration. Just drop them
+ next if (!defined($val) || !$val);
+
carp('$u specified for top-level enumeration')
unless defined($last_enum);
$self->{_mfhdc_ENUMS}->{$last_enum}->{COUNT} = $val;
} elsif ($key eq 'v') {
+ # Is this level of enumeration continuous, or does it restart?
+
+ # Some files seem to have "empty" $v subfields,
+ # especially for top level of enumeration. Just drop them
+ next if (!defined($val) || !$val);
+
carp '$v specified for top-level enumeration'
unless defined($last_enum);
$self->{_mfhdc_ENUMS}->{$last_enum}->{RESTART} = ($val eq 'r');
@@ -666,7 +677,7 @@
# 2) Increment the highest level of enumeration (either by date
# or because $carry is set because of the above loop
- if (!$self->subfield('i')) {
+ if (!$self->subfield('i') || !$next->{i}) {
# The simple case: if there is no chronology specified
# then just check $carry and return
$next->{'a'} += $carry;
More information about the open-ils-commits
mailing list