[open-ils-commits] r11325 - trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Nov 24 21:44:02 EST 2008
Author: djfiander
Date: 2008-11-24 21:44:00 -0500 (Mon, 24 Nov 2008)
New Revision: 11325
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Caption.pm
trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Holding.pm
Log:
Test for chronology stored in enumeration subfields of holdings data.
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Caption.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Caption.pm 2008-11-24 22:19:33 UTC (rev 11324)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Caption.pm 2008-11-25 02:44:00 UTC (rev 11325)
@@ -109,4 +109,30 @@
}
}
+# If items are identified by chronology only, with no separate
+# enumeration (eg, a newspaper issue), then the chronology is
+# recorded in the enumeration subfields $a - $f. We can tell
+# that this is the case if there are $a - $f subfields and no
+# chronology subfields ($i-$k), and none of the $a-$f subfields
+# have associated $u or $v subfields, but there are $w and $y
+# subfields.
+
+sub enumeration_is_chronology {
+ my $self = shift;
+
+ # There is always a '$a' subfield in well-formed fields.
+ return 0 if exists $self->{CHRONS}->{i};
+
+ foreach my $key ('a' .. 'f') {
+ my $enum;
+
+ last if !exists $self->{ENUMS}->{$key};
+
+ $enum = $self->{ENUMS}->{$key};
+ return 0 if defined $enum->{COUNT} || defined $enum->{RESTART};
+ }
+
+ return (exists $self->{PATTERN}->{w} && exists $self->{PATTERN}->{y});
+}
+
1;
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Holding.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Holding.pm 2008-11-24 22:19:33 UTC (rev 11324)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Holding.pm 2008-11-25 02:44:00 UTC (rev 11325)
@@ -74,10 +74,18 @@
# Enumerations
foreach my $key ('a'..'f') {
+ my $capstr;
+
last if !defined $caption->caption($key);
+
# printf("fmt %s: '%s'\n", $key, $caption->caption($key));
- $str .= ($key eq 'a' ? "" : ':') . $caption->caption($key) . $self->{ENUMS}->{$key}->{HOLDINGS};
+ $capstr = $caption->caption($key);
+ if (substr($capstr, 0, 1) eq '(') {
+ # a caption enclosed in parentheses is not displayed
+ $capstr = '';
+ }
+ $str .= ($key eq 'a' ? "" : ':') . $capstr . $self->{ENUMS}->{$key}->{HOLDINGS};
}
# Chronology
@@ -175,6 +183,9 @@
}
}
+ if ($caption->enumeration_is_chronology) {
+ # do something
+ }
# $carry keeps track of whether we need to carry into the next
# higher level of enumeration. It's not actually necessary except
More information about the open-ils-commits
mailing list