From 0a50277f804b09aa6f187ec6d2bb1c7c69b80a09 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Mon, 24 Aug 2009 22:10:23 +0200 Subject: [PATCH] Adding management for multiple $9 in MARCSubjects Signed-off-by: Galen Charlton --- C4/Biblio.pm | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index cf48c91686..a076e2882a 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -1285,10 +1285,10 @@ sub GetMarcSubjects { my $counter = 0; my @link_loop; # if there is an authority link, build the link with an= subfield9 - my $subfield9 = $field->subfield('9'); + my $found9=0; for my $subject_subfield (@subfields ) { # don't load unimarc subfields 3,4,5 - next if (($marcflavour eq "UNIMARC") and ($subject_subfield->[0] =~ /3|4|5/ ) ); + next if (($marcflavour eq "UNIMARC") and ($subject_subfield->[0] =~ /2|3|4|5/ ) ); # don't load MARC21 subfields 2 (FIXME: any more subfields??) next if (($marcflavour eq "MARC21") and ($subject_subfield->[0] =~ /2/ ) ); my $code = $subject_subfield->[0]; @@ -1296,11 +1296,13 @@ sub GetMarcSubjects { my $linkvalue = $value; $linkvalue =~ s/(\(|\))//g; my $operator = " and " unless $counter==0; - if ($subfield9) { - @link_loop = ({'limit' => 'an' ,link => "$subfield9" }); - } else { - push @link_loop, {'limit' => 'su', link => $linkvalue, operator => $operator }; - } + if ($code eq 9) { + $found9 = 1; + @link_loop = ({'limit' => 'an' ,link => "$linkvalue" }); + } + if (not $found9) { + push @link_loop, {'limit' => 'su', link => $linkvalue, operator => $operator }; + } my $separator = C4::Context->preference("authoritysep") unless $counter==0; # ignore $9 my @this_link_loop = @link_loop; -- 2.39.5