--- trunk/lib/WebPAC/Normalize.pm 2006/06/29 21:18:50 541 +++ trunk/lib/WebPAC/Normalize.pm 2006/06/29 21:18:59 542 @@ -152,10 +152,33 @@ $marc->add_fields( WebPAC::Normalize:_get_marc21_fields() ); +B: implement exceptions to magic which unrolls repeated subfields +as new field with that subfield. + =cut sub _get_marc21_fields { - return @{$marc21}; + my @m; + my $last; + foreach my $row (@{ $marc21 }) { + if ($last && ( + $last->[0] eq $row->[0] || # check if field is same + $last->[1] eq $row->[1] || # check for i1 + $last->[2] eq $row->[2] # and for i2 + ) ) { + $last->[3]->{ $row->[3] } = $row->[4]; + warn "## ++ added $row->[0] ^$row->[3]\n"; + next; + } elsif ($last) { + push @m, $last; + } + + push @m, $row; + } + + push @m, $last if ($last); + + return @m; } =head1 Functions to create C