X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=blobdiff_plain;f=extract_holdings;h=2cce0009068162dc70c3711aa869e8872d24cbac;hp=e75b4b3658b7495552920c6c5a59532f1beed64b;hb=a7680f193c045502b0c0b034891a2ae8e47860ca;hpb=7af21df77fb31c255c21c4a37addf7c645d42731 diff --git a/extract_holdings b/extract_holdings index e75b4b3..2cce000 100755 --- a/extract_holdings +++ b/extract_holdings @@ -62,6 +62,8 @@ sub extract_holdings { { open my $fh, ">", ($c->{prefix} . "-HOLDINGS-MULT-$t$s.pg"); $MULTIFILE{"$t$s"} = $fh } } + my $parallel_fields = $m->get_parallel_fields; + my $i = 0; # record counter my $j = 0; # holdings counter @@ -102,6 +104,22 @@ sub extract_holdings { push @out, ''; next; } + + # handle parallel fields + if (exists($parallel_fields->{$othertag})) { + my $num_fields = $#{ $rec->{tmap}{$othertag} }; + my $tag_idx; + if ($holdidx > $num_fields) { + $tag_idx = -1; + } else { + $tag_idx = $rec->{tmap}{$othertag}[$holdidx]; + } + for my $sub ( sort keys %{ $parallel_fields->{$othertag } } ) { + push @out, $tag_idx > -1 ? $rec->{tags}[$tag_idx]{parallel}{$sub}->[0] : ''; + print HOLDINGS "l_", $m->name($rec->{tags}[$tag_idx]{tag}, $sub), ", " unless $j; + } + } + # handle only first other tag unless it is known to be multi my $limit = 0; if (exists($multis->{$othertag})) {