Lines 1125-1157
sub BuildUnimarcHierarchies{
Link Here
|
1125 |
my $data = GetHeaderAuthority($authid); |
1125 |
my $data = GetHeaderAuthority($authid); |
1126 |
if ($data->{'authtrees'} and not $force){ |
1126 |
if ($data->{'authtrees'} and not $force){ |
1127 |
return $data->{'authtrees'}; |
1127 |
return $data->{'authtrees'}; |
1128 |
} elsif ($data->{'authtrees'}){ |
1128 |
# } elsif ($data->{'authtrees'}){ |
1129 |
$hierarchies=$data->{'authtrees'}; |
1129 |
# $hierarchies=$data->{'authtrees'}; |
1130 |
} else { |
1130 |
} else { |
1131 |
my $record = GetAuthority($authid); |
1131 |
my $record = GetAuthority($authid); |
1132 |
my $found; |
1132 |
my $found; |
1133 |
if ($record){ |
1133 |
return unless $record; |
1134 |
foreach my $field ($record->field('550')){ |
1134 |
foreach my $field ($record->field('5..')){ |
1135 |
if ($field->subfield('5') && $field->subfield('5') eq 'g'){ |
1135 |
if ($field->subfield('5') && $field->subfield('5') eq 'g'){ |
1136 |
my $parentrecord = GetAuthority($field->subfield('3')); |
1136 |
my $subfauthid=_get_authid_subfield($field); |
1137 |
my $localresult=$hierarchies; |
1137 |
next if ($subfauthid eq $authid); |
1138 |
my $trees; |
1138 |
my $parentrecord = GetAuthority($subfauthid); |
1139 |
$trees = BuildUnimarcHierarchies($field->subfield('3')); |
1139 |
my $localresult=$hierarchies; |
1140 |
my @trees; |
1140 |
my $trees; |
1141 |
if ($trees=~/;/){ |
1141 |
$trees = BuildUnimarcHierarchies($subfauthid); |
1142 |
@trees = split(/;/,$trees); |
1142 |
my @trees; |
1143 |
} else { |
1143 |
if ($trees=~/;/){ |
1144 |
push @trees, $trees; |
1144 |
@trees = split(/;/,$trees); |
1145 |
} |
1145 |
} else { |
1146 |
foreach (@trees){ |
1146 |
push @trees, $trees; |
1147 |
$_.= ",$authid"; |
1147 |
} |
1148 |
} |
1148 |
foreach (@trees){ |
1149 |
@globalresult = (@globalresult,@trees); |
1149 |
$_.= ",$authid"; |
1150 |
$found=1; |
1150 |
} |
1151 |
} |
1151 |
@globalresult = (@globalresult,@trees); |
1152 |
$hierarchies=join(";",@globalresult); |
1152 |
$found=1; |
1153 |
} |
1153 |
} |
1154 |
} |
1154 |
$hierarchies=join(";",@globalresult); |
|
|
1155 |
} |
1155 |
#Unless there is no ancestor, I am alone. |
1156 |
#Unless there is no ancestor, I am alone. |
1156 |
$hierarchies="$authid" unless ($hierarchies); |
1157 |
$hierarchies="$authid" unless ($hierarchies); |
1157 |
} |
1158 |
} |
Lines 1188-1202
sub BuildUnimarcHierarchy{
Link Here
|
1188 |
my $parents=""; my $children=""; |
1189 |
my $parents=""; my $children=""; |
1189 |
my (@loopparents,@loopchildren); |
1190 |
my (@loopparents,@loopchildren); |
1190 |
foreach my $field ($record->field('5..')){ |
1191 |
foreach my $field ($record->field('5..')){ |
1191 |
my $subfauthid=_get_authid_subfield($field); |
1192 |
my $subfauthid=_get_authid_subfield($field); |
1192 |
if ($field->subfield('5') && $field->subfield('a')){ |
1193 |
if ($subfauthid && $field->subfield('5') && $field->subfield('a')){ |
1193 |
if ($field->subfield('5') eq 'h'){ |
1194 |
if ($field->subfield('5') eq 'h'){ |
1194 |
push @loopchildren, { "childauthid"=>$subfauthid,"childvalue"=>$field->subfield('a')}; |
1195 |
push @loopchildren, { "childauthid"=>$field->subfield('3'),"childvalue"=>$field->subfield('a')}; |
1195 |
}elsif ($field->subfield('5') eq 'g'){ |
1196 |
} |
1196 |
push @loopparents, { "parentauthid"=>$subfauthid,"parentvalue"=>$field->subfield('a')}; |
1197 |
elsif ($field->subfield('5') eq 'g'){ |
1197 |
} |
1198 |
push @loopparents, { "parentauthid"=>$field->subfield('3'),"parentvalue"=>$field->subfield('a')}; |
|
|
1199 |
} |
1198 |
# brothers could get in there with an else |
1200 |
# brothers could get in there with an else |
1199 |
} |
1201 |
} |
1200 |
} |
1202 |
} |
1201 |
$cell{"ifparents"}=1 if (scalar(@loopparents)>0); |
1203 |
$cell{"ifparents"}=1 if (scalar(@loopparents)>0); |
1202 |
$cell{"ifchildren"}=1 if (scalar(@loopchildren)>0); |
1204 |
$cell{"ifchildren"}=1 if (scalar(@loopchildren)>0); |
1203 |
- |
|
|