From eeb0d7c0d3f81a016429961d52c6126a7bab563b Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Tue, 22 Mar 2011 15:34:53 +0100 Subject: [PATCH] Bug 5926 : Fixing Hierarchies : taking any heading subfield Conflicts solved: C4/AuthoritiesMarc.pm Signed-off-by: Julian Maurice Signed-off-by: Chris Cormack --- C4/AuthoritiesMarc.pm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index 3c3f6bcbad..1eeb96454e 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -1182,16 +1182,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 } @@ -1207,6 +1208,10 @@ sub BuildUnimarcHierarchy{ return \%cell; } +sub _get_authid_subfield{ + my ($field)=@_; + return $field->subfield('9')||$field->subfield('3'); +} =head2 GetHeaderAuthority $ref= &GetHeaderAuthority( $authid) -- 2.39.5