X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=blobdiff_plain;f=extract_holdings;h=fb44929c87ae94432f84cccdfef632048eac6280;hp=d39aac9bddb1d0e033e65d33a8fdbe302d7e82dc;hb=f066013ab0a65299aaddf1466c438585e95ee2bf;hpb=5a0ffda818989fddf5c3315d00c87fdf348cae92 diff --git a/extract_holdings b/extract_holdings index d39aac9..fb44929 100755 --- a/extract_holdings +++ b/extract_holdings @@ -91,19 +91,19 @@ sub extract_holdings { $limit = $#{ $rec->{tmap}{$othertag} }; } foreach my $idx (0..$limit) { - for my $sub ( sort keys %{$rec->{tags}[$idx]{uni}} ) { - if ($m->first_only($rec->{tags}[$idx]{tag}, $sub)) { - push @out, ($k == 1) ? $rec->{tags}[$idx]{uni}{$sub} : ''; + my $tag_idx = $rec->{tmap}{$othertag}[$idx]; + for my $sub ( sort keys %{$rec->{tags}[$tag_idx]{uni}} ) { + if ($m->first_only($rec->{tags}[$tag_idx]{tag}, $sub)) { + push @out, ($k == 1) ? $rec->{tags}[$tag_idx]{uni}{$sub} : ''; } else { - push @out, $rec->{tags}[$idx]{uni}{$sub}; + push @out, $rec->{tags}[$tag_idx]{uni}{$sub}; } - print HOLDINGS "l_", $m->name($rec->{tags}[$idx]{tag}, $sub), ", " - unless $j; + print HOLDINGS "l_", $m->name($rec->{tags}[$tag_idx]{tag}, $sub), ", " unless $j; } next unless exists($multis->{$othertag}); for my $sub ( sort keys %{$multis->{$othertag}} ) { - next if $m->first_only($rec->{tags}[$idx]{tag}, $sub) and ($k > 1); - for my $value ( @{$rec->{tags}[$idx]{multi}{$sub}} ) { + next if $m->first_only($rec->{tags}[$tag_idx]{tag}, $sub) and ($k > 1); + for my $value ( @{$rec->{tags}[$tag_idx]{multi}{$sub}} ) { my $fh = $MULTIFILE{"$othertag$sub"}; print $fh join("\t", $rec->{egid}, $j, $value), "\n"; }