From 0370e44a18257fcd8a41d0f79a01a4e7d12f19e2 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Tue, 18 May 2010 14:35:04 +0200 Subject: [PATCH] Bug 5926 : Fixing Hierarchies : taking any heading subfield Conflicts solved: C4/AuthoritiesMarc.pm --- C4/AuthoritiesMarc.pm | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index f3cc948..e3bf50e 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -1181,16 +1181,17 @@ sub BuildUnimarcHierarchy{ my $class = shift @_; my $authid_constructed = shift @_; return undef unless ($record); - my $authid=$record->subfield('2..','3'); + my $authid=$record->field('001')->data(); my %cell; my $parents=""; my $children=""; my (@loopparents,@loopchildren); - foreach my $field ($record->field('550')){ + foreach my $field ($record->field('5..')){ + my $subfauthid=_get_authid_subfield($field); if ($field->subfield('5') && $field->subfield('a')){ if ($field->subfield('5') eq 'h'){ - push @loopchildren, { "childauthid"=>$field->subfield('3'),"childvalue"=>$field->subfield('a')}; + push @loopchildren, { "childauthid"=>$subfauthid,"childvalue"=>$field->subfield('a')}; }elsif ($field->subfield('5') eq 'g'){ - push @loopparents, { "parentauthid"=>$field->subfield('3'),"parentvalue"=>$field->subfield('a')}; + push @loopparents, { "parentauthid"=>$subfauthid,"parentvalue"=>$field->subfield('a')}; } # brothers could get in there with an else } @@ -1206,6 +1207,10 @@ sub BuildUnimarcHierarchy{ return \%cell; } +sub _get_authid_subfield{ + my ($field)=@_; + return $field->subfield('9')||$field->subfield('3'); +} =head2 GetHeaderAuthority $ref= &GetHeaderAuthority( $authid) -- 1.7.1