changing the way subjects are build in detail.pl
authorPaul POULAIN <paul@koha-fr.org>
Sat, 17 Nov 2007 00:49:27 +0000 (18:49 -0600)
committerJoshua Ferraro <jmf@liblime.com>
Sat, 17 Nov 2007 17:37:25 +0000 (11:37 -0600)
If you have a $9 as authority, then you can directly search on an=<koha-auth-number>

For example, if you have :
600$912045$aEurope$xFrance$xMarseille (Europe--France--Marseille as subject of the biblio)

The link must be "an=12045"

The link is not changed in case there is no $9 (still apply on each term, one by one)

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
C4/Biblio.pm
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl

index 7a59204..73f44dc 100644 (file)
@@ -1821,6 +1821,8 @@ sub GetMarcSubjects {
         my @subfields = $field->subfields();
                my $counter = 0;
                my @link_loop;
+               # if there is an authority link, build the link with an= subfield9
+               my $subfield9 = $field->subfield('9');
                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) ) );
@@ -1829,7 +1831,11 @@ sub GetMarcSubjects {
                        my $linkvalue = $value;
                        $linkvalue =~ s/(\(|\))//g;
                        my $operator = " and " unless $counter==0;
-                       push @link_loop, {link => $linkvalue, operator => $operator };
+                       if ($subfield9) {
+                @link_loop = ({'limit' => 'an' ,link => "$subfield9" });
+            } else {
+                push @link_loop, {'limit' => 'su', link => $linkvalue, operator => $operator };
+            }
                        my $separator = C4::Context->preference("authoritysep") unless $counter==0;
                        # ignore $9
                        push @subfields_loop, {code => $code, value => $value, link_loop => \@link_loop, separator => $separator} unless ($subject_subfield->[0] == 9 );
index c6eea2b..7aafc0b 100644 (file)
@@ -91,7 +91,7 @@
             <li><strong>Subjects:</strong> 
             <ul>
                 <!-- TMPL_LOOP NAME="MARCSUBJCTS" -->
-                               <li><!-- TMPL_LOOP NAME="MARCSUBJECT_SUBFIELDS_LOOP" --><!-- TMPL_VAR NAME="separator" --><a title="‡<!-- TMPL_VAR NAME=code --> <!-- TMPL_VAR NAME=value -->" href="/cgi-bin/koha/catalogue/search.pl?q=<!-- TMPL_LOOP NAME=link_loop --><!-- TMPL_VAR NAME=operator -->su:'<!-- TMPL_VAR NAME=link -->'<!-- /TMPL_LOOP -->"><!-- TMPL_VAR NAME="value" --></a><!-- /TMPL_LOOP --></li>
+                               <li><!-- TMPL_LOOP NAME="MARCSUBJECT_SUBFIELDS_LOOP" --><!-- TMPL_VAR NAME="separator" --><a title="‡<!-- TMPL_VAR NAME=code --> <!-- TMPL_VAR NAME=value -->" href="/cgi-bin/koha/catalogue/search.pl?q=<!-- TMPL_LOOP NAME=link_loop --><!-- TMPL_VAR NAME=operator --><!-- TMPL_VAR name='limit' -->:'<!-- TMPL_VAR NAME=link -->'<!-- /TMPL_LOOP -->"><!-- TMPL_VAR NAME="value" --></a><!-- /TMPL_LOOP --></li>
                 <!-- /TMPL_LOOP -->
                                </ul>
             </li>