- if ($tag eq '100') {
- push @authorized, $field->as_string('abcdefghjklmnopqrstvxyz68');
- } elsif ($tag eq '110') {
- push @authorized, $field->as_string('abcdefghklmnoprstvxyz68');
- } elsif ($tag eq '111') {
- push @authorized, $field->as_string('acdefghklnpqstvxyz68');
- } elsif ($tag eq '130') {
- push @authorized, $field->as_string('adfghklmnoprstvxyz68');
- } elsif ($tag eq '148') {
- push @authorized, $field->as_string('abvxyz68');
- } elsif ($tag eq '150') {
- push @authorized, $field->as_string('abvxyz68');
- } elsif ($tag eq '151') {
- push @authorized, $field->as_string('avxyz68');
- } elsif ($tag eq '155') {
- push @authorized, $field->as_string('abvxyz68');
- } elsif ($tag eq '180') {
- push @authorized, $field->as_string('vxyz68');
- } elsif ($tag eq '181') {
- push @authorized, $field->as_string('vxyz68');
- } elsif ($tag eq '182') {
- push @authorized, $field->as_string('vxyz68');
- } elsif ($tag eq '185') {
- push @authorized, $field->as_string('vxyz68');
- } else {
- push @authorized, $field->as_string();
- }
- } #See From
- foreach my $field ($record->field('4..')) {
- my $type = 'seefrom';
- $type = $marc21controlrefs{substr $field->subfield('w'), '0'} if ($field->subfield('w'));
- if ($type eq 'subfi') {
- push @seefrom, { heading => $field->as_string($marc21subfields), type => $field->subfield('i') };
- } else {
- push @seefrom, { heading => $field->as_string($marc21subfields), type => $type };
- }
- } #See Also
- foreach my $field ($record->field('5..')) {
- my $type = 'seealso';
- $type = $marc21controlrefs{substr $field->subfield('w'), '0'} if ($field->subfield('w'));
- if ($type eq 'subfi') {
- push @seealso, { heading => $field->as_string($marc21subfields), type => $field->subfield('i') };
- } else {
- push @seealso, { heading => $field->as_string($marc21subfields), type => $type };
- }
+ if ($tag eq '100') {
+ $subfields_to_report = 'abcdefghjklmnopqrstvxyz';
+ } elsif ($tag eq '110') {
+ $subfields_to_report = 'abcdefghklmnoprstvxyz';
+ } elsif ($tag eq '111') {
+ $subfields_to_report = 'acdefghklnpqstvxyz';
+ } elsif ($tag eq '130') {
+ $subfields_to_report = 'adfghklmnoprstvxyz';
+ } elsif ($tag eq '148') {
+ $subfields_to_report = 'abvxyz';
+ } elsif ($tag eq '150') {
+ $subfields_to_report = 'abvxyz';
+ } elsif ($tag eq '151') {
+ $subfields_to_report = 'avxyz';
+ } elsif ($tag eq '155') {
+ $subfields_to_report = 'abvxyz';
+ } elsif ($tag eq '180') {
+ $subfields_to_report = 'vxyz';
+ } elsif ($tag eq '181') {
+ $subfields_to_report = 'vxyz';
+ } elsif ($tag eq '182') {
+ $subfields_to_report = 'vxyz';
+ } elsif ($tag eq '185') {
+ $subfields_to_report = 'vxyz';
+ }
+ if ($subfields_to_report) {
+ push @authorized, {
+ heading => $field->as_string($subfields_to_report),
+ hemain => $field->subfield( substr($subfields_to_report, 0, 1) ),
+ field => $tag,
+ };
+ } else {
+ push @authorized, {
+ heading => $field->as_string(),
+ hemain => $field->subfield('a'),
+ field => $tag,
+ };
+ }
+ }
+ foreach my $field ($record->field('4..')) { #See From
+ my $type = 'seefrom';
+ $type = ($marc21controlrefs{substr $field->subfield('w'), 0, 1} || '') if ($field->subfield('w'));
+ if ($type eq 'notapplicable') {
+ $type = substr $field->subfield('w'), 2, 1;
+ $type = 'earlier' if $type && $type ne 'n';
+ }
+ if ($type eq 'subfi') {
+ push @seefrom, {
+ heading => $field->as_string($marc21subfields),
+ hemain => $field->subfield( substr($marc21subfields, 0, 1) ),
+ type => ($field->subfield('i') || ''),
+ field => $field->tag(),
+ };
+ } else {
+ push @seefrom, {
+ heading => $field->as_string($marc21subfields),
+ hemain => $field->subfield( substr($marc21subfields, 0, 1) ),
+ type => $type,
+ field => $field->tag(),
+ };
+ }
+ }
+ foreach my $field ($record->field('5..')) { #See Also
+ my $type = 'seealso';
+ $type = ($marc21controlrefs{substr $field->subfield('w'), 0, 1} || '') if ($field->subfield('w'));
+ if ($type eq 'notapplicable') {
+ $type = substr $field->subfield('w'), 2, 1;
+ $type = 'earlier' if $type && $type ne 'n';
+ }
+ if ($type eq 'subfi') {
+ push @seealso, {
+ heading => $field->as_string($marc21subfields),
+ hemain => $field->subfield( substr($marc21subfields, 0, 1) ),
+ type => $field->subfield('i'),
+ field => $field->tag(),
+ search => $field->as_string($marc21subfields) || '',
+ authid => $field->subfield('9') || ''
+ };
+ } else {
+ push @seealso, {
+ heading => $field->as_string($marc21subfields),
+ hemain => $field->subfield( substr($marc21subfields, 0, 1) ),
+ type => $type,
+ field => $field->tag(),
+ search => $field->as_string($marc21subfields) || '',
+ authid => $field->subfield('9') || ''
+ };
+ }
+ }
+ foreach my $field ($record->field('6..')) {
+ push @notes, { note => $field->as_string(), field => $field->tag() };
+ }
+ foreach my $field ($record->field('880')) {
+ my $linkage = $field->subfield('6');
+ my $category = substr $linkage, 0, 1;
+ if ($category eq '1') {
+ $category = 'preferred';
+ } elsif ($category eq '4') {
+ $category = 'seefrom';
+ } elsif ($category eq '5') {
+ $category = 'seealso';