[Koha-patches] [PATCH] Adding management for multiple $9 in MARCSubjects

Henri-Damien LAURENT henridamien.laurent at biblibre.com
Mon Aug 24 22:10:23 CEST 2009


---
 C4/Biblio.pm |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/C4/Biblio.pm b/C4/Biblio.pm
index 569e09e..9254276 100644
--- a/C4/Biblio.pm
+++ b/C4/Biblio.pm
@@ -1272,10 +1272,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];
@@ -1283,11 +1283,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;
-- 
1.6.0.4




More information about the Koha-patches mailing list