If going by the book, every caption/pattern field would have a
subfield 'a', since the data from subfield 'i' would be moved to
'a' if 'a' was empty. Since that is arcane, and our own wizards
used to bend this rule, let's make some minor adjustments to our
expectations:
1) When calculating date progression, don't expect there to be an 'a'
subfield which needs to be "carried" into.
2) When determining whether a field is 'open-ended', check the first
availabile enum/chron subfield rather than hard-coding the check to
'a'.
These changes do not affect the display formatters, so strings
generated from 'a'-less caption/pattern combos are not exactly right,
but they suffice.
Signed-off-by: Dan Wells <dbw2@calvin.edu>
Signed-off-by: Ben Shum <bshum@biblio.org>
}
}
}
- } elsif ($carry) {
+ } elsif ($carry and exists $next->{a}) {
+ # If we have only chron fields ('i' through 'm'), don't vivicate an 'a'.
+ # It would be more standard for the chron fields to have been moved to
+ # the enum fields, but imperfect patterns exist, and that's an odd
+ # rule anyway.
$next->{a} += $carry;
}
}
# TODO: full support for second indicators 2, 3, and 4
$self->{_mfhdh_OPEN_ENDED} = 0;
+ my $first_enum_or_chron_code = '';
foreach my $subfield ($self->subfields) {
my ($key, $val) = @$subfield;
if ($key =~ /[a-m]/) {
+ $first_enum_or_chron_code = $key unless $first_enum_or_chron_code;
if (exists($self->{_mfhdh_FIELDS}->{$key})) {
carp("Duplicate, non-repeatable subfield '$key' found, ignoring");
next;
}
if ( $self->{_mfhdh_COMPRESSED}
- && $self->{_mfhdh_FIELDS}{'a'}{HOLDINGS}[1] eq '') {
+ && $self->{_mfhdh_FIELDS}{$first_enum_or_chron_code}{HOLDINGS}[1] eq '') {
$self->{_mfhdh_OPEN_ENDED} = 1;
}
bless($self, $class);