[open-ils-commits] r12649 - in trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD: . test (djfiander)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Mar 23 22:26:58 EDT 2009
Author: djfiander
Date: 2009-03-23 22:26:56 -0400 (Mon, 23 Mar 2009)
New Revision: 12649
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Holding.pm
trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/test/mfhd.t
Log:
Properly parse holdings fields when the chronology is stored in the enumeration subfields
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Holding.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Holding.pm 2009-03-23 19:00:29 UTC (rev 12648)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Holding.pm 2009-03-24 02:26:56 UTC (rev 12649)
@@ -27,16 +27,16 @@
foreach my $subfield ($self->subfields) {
my ($key, $val) = @$subfield;
- if ($key =~ /[a-h]/) {
+
+ if (($caption->enumeration_is_chronology && $key =~ /[a-h]/) || $key =~ /[i-m]/) {
+ # Chronology
+ $self->{_mfhdh_SUBFIELDS}->{$key} = $val;
+ } elsif ($key =~ /[a-h]/) {
# Enumeration details of holdings
$self->{_mfhdh_SUBFIELDS}->{$key} = {HOLDINGS => $val,
UNIT => undef,};
$last_enum = $key;
} elsif ($key =~ /[i-m]/) {
- $self->{_mfhdh_SUBFIELDS}->{$key} = $val;
- if (!$caption->capstr($key)) {
- warn "Holding '$seqno' specified enumeration level '$key' not included in caption $caption->{LINK}";
- }
} elsif ($key eq 'o') {
warn '$o specified prior to first enumeration'
unless defined($last_enum);
@@ -358,7 +358,7 @@
# I am cheating: This code assumes that only the smallest
# time increment is combined. So, no "Apr 15/May 1" allowed.
- @new[-1] = @new[-1] . '/' . @second_date[-1];
+ $new[-1] = $new[-1] . '/' . $second_date[-1];
}
}
@@ -478,6 +478,17 @@
# Initialize $next with current enumeration & chronology, then
# we can just operate on $next, based on the contents of the caption
+
+ if ($caption->enumeration_is_chronology) {
+ foreach my $key ('a' .. 'h') {
+ $next->{$key} = $self->{_mfhdh_SUBFIELDS}->{$key}
+ if exists $self->{_mfhdh_SUBFIELDS}->{$key};
+ }
+ $self->next_date($next, ('a' .. 'h'));
+
+ return $next;
+ }
+
foreach my $key ('a' .. 'h') {
$next->{$key} = $self->{_mfhdh_SUBFIELDS}->{$key}->{HOLDINGS}
if exists $self->{_mfhdh_SUBFIELDS}->{$key};
@@ -488,16 +499,12 @@
if exists $self->{_mfhdh_SUBFIELDS}->{$key};
}
- if ($caption->enumeration_is_chronology) {
- $self->next_date($next, ('a'..'h'));
- } else {
- if (exists $next->{'h'}) {
- $self->next_alt_enum($next);
- }
-
- $self->next_enum($next);
+ if (exists $next->{'h'}) {
+ $self->next_alt_enum($next);
}
+ $self->next_enum($next);
+
return($next);
}
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/test/mfhd.t
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/test/mfhd.t 2009-03-23 19:00:29 UTC (rev 12648)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/test/mfhd.t 2009-03-24 02:26:56 UTC (rev 12649)
@@ -182,3 +182,7 @@
245 00 $aMonthly, iss no. restarts, Cal change: Jan, July issue omitted
853 20 $815$av.$bno.$u11$vr$i(year)$j(month)$wm$x01$yom07
+
+245 00 $aQuarterly, chronology in enumeration fields
+853 20 $816$a(year)$b(season)$wq$x21$yps21,22,23,24
+863 41 $816.1$a2007$b21$x|a2007|b22$zSimple case: quarterly in mid-volume
More information about the open-ils-commits
mailing list