changing the way subjects are build in detail.pl

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>
This commit is contained in:
Paul POULAIN 2007-11-16 18:49:27 -06:00 committed by Joshua Ferraro
parent 5f371710c2
commit 3253372339
2 changed files with 8 additions and 2 deletions

View 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 );

View 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>