|
Lines 175-227
my $authid = $query->param('authid');
Link Here
|
| 175 |
|
175 |
|
| 176 |
|
176 |
|
| 177 |
my $authtypecode = &GetAuthTypeCode($authid); |
177 |
my $authtypecode = &GetAuthTypeCode($authid); |
| 178 |
$tagslib = &GetTagsLabels(1,$authtypecode); |
|
|
| 179 |
|
| 180 |
my $record; |
| 181 |
if (C4::Context->preference("AuthDisplayHierarchy")){ |
| 182 |
my $trees=BuildUnimarcHierarchies($authid); |
| 183 |
my @trees = split /;/,$trees ; |
| 184 |
push @trees,$trees unless (@trees); |
| 185 |
my @loophierarchies; |
| 186 |
foreach my $tree (@trees){ |
| 187 |
my @tree=split /,/,$tree; |
| 188 |
push @tree,$tree unless (@tree); |
| 189 |
my $cnt=0; |
| 190 |
my @loophierarchy; |
| 191 |
foreach my $element (@tree){ |
| 192 |
my $elementdata = GetAuthority($element); |
| 193 |
$record= $elementdata if ($authid==$element); |
| 194 |
push @loophierarchy, BuildUnimarcHierarchy($elementdata,"child".$cnt, $authid); |
| 195 |
$cnt++; |
| 196 |
} |
| 197 |
push @loophierarchies, { 'loopelement' =>\@loophierarchy}; |
| 198 |
} |
| 199 |
$template->param( |
| 200 |
'displayhierarchy' =>C4::Context->preference("AuthDisplayHierarchy"), |
| 201 |
'loophierarchies' =>\@loophierarchies, |
| 202 |
); |
| 203 |
} else { |
| 204 |
$record=GetAuthority($authid); |
| 205 |
} |
| 206 |
my $count = CountUsage($authid); |
| 207 |
|
| 208 |
# find the marc field/subfield used in biblio by this authority |
| 209 |
my $sth = $dbh->prepare("select distinct tagfield from marc_subfield_structure where authtypecode=?"); |
| 210 |
$sth->execute($authtypecode); |
| 211 |
my $biblio_fields; |
| 212 |
while (my ($tagfield) = $sth->fetchrow) { |
| 213 |
$biblio_fields.= $tagfield."9,"; |
| 214 |
} |
| 215 |
chop $biblio_fields; |
| 216 |
|
178 |
|
|
|
179 |
if ( defined $authtypecode ) { |
| 180 |
# authid is valid |
| 181 |
$tagslib = &GetTagsLabels(1,$authtypecode); |
| 182 |
|
| 183 |
my $record; |
| 184 |
if (C4::Context->preference("AuthDisplayHierarchy")){ |
| 185 |
my $trees=BuildUnimarcHierarchies($authid); |
| 186 |
my @trees = split /;/,$trees ; |
| 187 |
push @trees,$trees unless (@trees); |
| 188 |
my @loophierarchies; |
| 189 |
foreach my $tree (@trees){ |
| 190 |
my @tree=split /,/,$tree; |
| 191 |
push @tree,$tree unless (@tree); |
| 192 |
my $cnt=0; |
| 193 |
my @loophierarchy; |
| 194 |
foreach my $element (@tree){ |
| 195 |
my $elementdata = GetAuthority($element); |
| 196 |
$record= $elementdata if ($authid==$element); |
| 197 |
push @loophierarchy, BuildUnimarcHierarchy($elementdata,"child".$cnt, $authid); |
| 198 |
$cnt++; |
| 199 |
} |
| 200 |
push @loophierarchies, { 'loopelement' =>\@loophierarchy}; |
| 201 |
} |
| 202 |
$template->param( |
| 203 |
'displayhierarchy' =>C4::Context->preference("AuthDisplayHierarchy"), |
| 204 |
'loophierarchies' =>\@loophierarchies, |
| 205 |
); |
| 206 |
} else { |
| 207 |
$record=GetAuthority($authid); |
| 208 |
} |
| 209 |
|
| 210 |
my $count = CountUsage($authid); |
| 211 |
|
| 212 |
# find the marc field/subfield used in biblio by this authority |
| 213 |
my $sth = $dbh->prepare("select distinct tagfield from marc_subfield_structure where authtypecode=?"); |
| 214 |
$sth->execute($authtypecode); |
| 215 |
my $biblio_fields; |
| 216 |
while (my ($tagfield) = $sth->fetchrow) { |
| 217 |
$biblio_fields.= $tagfield."9,"; |
| 218 |
} |
| 219 |
chop $biblio_fields; |
| 220 |
|
| 221 |
# loop through each tab 0 through 9 |
| 222 |
# for (my $tabloop = 0; $tabloop<=10;$tabloop++) { |
| 223 |
# loop through each tag |
| 224 |
build_tabs ($template, $record, $dbh,"",$query); |
| 225 |
|
| 226 |
$template->param(authid => $authid, |
| 227 |
count => $count, |
| 228 |
biblio_fields => $biblio_fields, |
| 229 |
); |
| 217 |
|
230 |
|
| 218 |
# fill arrays |
231 |
} else { |
| 219 |
my @loop_data =(); |
232 |
# authid invalid |
| 220 |
my $tag; |
233 |
# set default $authtypecode |
| 221 |
# loop through each tab 0 through 9 |
234 |
$authtypecode = ''; |
| 222 |
# for (my $tabloop = 0; $tabloop<=10;$tabloop++) { |
235 |
$template->param ( errauthid => $authid,unknownauthid => 1 ); |
| 223 |
# loop through each tag |
236 |
} |
| 224 |
build_tabs ($template, $record, $dbh,"",$query); |
|
|
| 225 |
|
237 |
|
| 226 |
my $authtypes = getauthtypes; |
238 |
my $authtypes = getauthtypes; |
| 227 |
my @authtypesloop; |
239 |
my @authtypesloop; |
|
Lines 233-243
foreach my $thisauthtype (sort { $authtypes->{$b} cmp $authtypes->{$a} } keys %$
Link Here
|
| 233 |
push @authtypesloop, \%row; |
245 |
push @authtypesloop, \%row; |
| 234 |
} |
246 |
} |
| 235 |
|
247 |
|
| 236 |
$template->param(authid => $authid, |
248 |
$template->param ( |
| 237 |
count => $count, |
|
|
| 238 |
biblio_fields => $biblio_fields, |
| 239 |
authtypetext => $authtypes->{$authtypecode}{'authtypetext'}, |
249 |
authtypetext => $authtypes->{$authtypecode}{'authtypetext'}, |
| 240 |
authtypesloop => \@authtypesloop, |
250 |
authtypesloop => \@authtypesloop, |
| 241 |
); |
251 |
); |
| 242 |
output_html_with_http_headers $query, $cookie, $template->output; |
|
|
| 243 |
|
252 |
|
|
|
253 |
output_html_with_http_headers $query, $cookie, $template->output; |