From e5719e1ca72718139311de2415330778d4ac1684 Mon Sep 17 00:00:00 2001 From: Dan Wells Date: Tue, 17 Sep 2013 16:21:56 -0400 Subject: [PATCH] Display 'title of unit' $o in serial holdings If a holding has a subfield 'o' value, tack it onto the display string for that enumeration. Signed-off-by: Dan Wells --- .../src/perlmods/lib/OpenILS/Utils/MFHD/Holding.pm | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD/Holding.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD/Holding.pm index 37f985a38a..c9dc00b1c9 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD/Holding.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD/Holding.pm @@ -56,13 +56,13 @@ sub new { } if ($key =~ /[a-h]/) { # Enumeration specific details of holdings - $self->{_mfhdh_FIELDS}->{$key}{UNIT} = undef; + $self->{_mfhdh_FIELDS}->{$key}{UNIT_TITLE} = undef; $last_enum = $key; } } elsif ($key eq 'o') { warn '$o specified prior to first enumeration' unless defined($last_enum); - $self->{_mfhdh_FIELDS}->{$last_enum}->{UNIT} = $val; + $self->{_mfhdh_FIELDS}->{$last_enum}->{UNIT_TITLE} = $val; $last_enum = undef; } elsif ($key =~ /[npq]/) { $self->{_mfhdh_DESCR}->{$key} = $val; @@ -131,6 +131,20 @@ sub field_values { } } +# +# Given a field key, returns a unit title (if there is one), or undef +# if there isn't +# +sub unit_title { + my ($self, $key) = @_; + + if (exists $self->fields->{$key}) { + return $self->fields->{$key}{UNIT_TITLE}; + } else { + return; + } +} + sub seqno { my $self = shift; @@ -361,7 +375,8 @@ sub format_single_enum { $skip_sep ||= ($key eq 'a'); - return ($skip_sep ? '' : $sep) . $capstr . $holding_values->{$key}; + return ($skip_sep ? '' : $sep) . $capstr . $holding_values->{$key} . + ($self->unit_title($key) ? ' ' . $self->unit_title($key) : ''); } # -- 2.11.0