View | Details | Raw Unified | Return to bug 17511
Collapse All | Expand All

(-)a/C4/AuthoritiesMarc.pm (-9 / +12 lines)
Lines 870-875 sub BuildSummary { Link Here
870
    my @seefrom;
870
    my @seefrom;
871
    my @seealso;
871
    my @seealso;
872
    my @otherscript;
872
    my @otherscript;
873
    my $authsubfield = Koha::Authorities->authority_linking_subfield;
873
    if (C4::Context->preference('marcflavour') eq 'UNIMARC') {
874
    if (C4::Context->preference('marcflavour') eq 'UNIMARC') {
874
# construct UNIMARC summary, that is quite different from MARC21 one
875
# construct UNIMARC summary, that is quite different from MARC21 one
875
# accepted form
876
# accepted form
Lines 904-910 sub BuildSummary { Link Here
904
                heading => $heading,
905
                heading => $heading,
905
                hemain  => ( $_->subfield('a') // undef ),
906
                hemain  => ( $_->subfield('a') // undef ),
906
                search  => $heading,
907
                search  => $heading,
907
                authid  => ( $_->subfield('9') // undef ),
908
                authid  => ( $_->subfield($authsubfield) // undef ),
908
            }
909
            }
909
        } $record->field('5..');
910
        } $record->field('5..');
910
911
Lines 1003-1009 sub BuildSummary { Link Here
1003
                    type    => scalar $field->subfield('i'),
1004
                    type    => scalar $field->subfield('i'),
1004
                    field   => $field->tag(),
1005
                    field   => $field->tag(),
1005
                    search  => $field->as_string($marc21subfields) || '',
1006
                    search  => $field->as_string($marc21subfields) || '',
1006
                    authid  => $field->subfield('9') || ''
1007
                    authid  => $field->subfield($authsubfield) || ''
1007
                };
1008
                };
1008
            } else {
1009
            } else {
1009
                push @seealso, {
1010
                push @seealso, {
Lines 1012-1018 sub BuildSummary { Link Here
1012
                    type    => $type,
1013
                    type    => $type,
1013
                    field   => $field->tag(),
1014
                    field   => $field->tag(),
1014
                    search  => $field->as_string($marc21subfields) || '',
1015
                    search  => $field->as_string($marc21subfields) || '',
1015
                    authid  => $field->subfield('9') || ''
1016
                    authid  => $field->subfield($authsubfield) || ''
1016
                };
1017
                };
1017
            }
1018
            }
1018
        }
1019
        }
Lines 1287-1293 sub GenerateHierarchy { Link Here
1287
1288
1288
sub _get_authid_subfield{
1289
sub _get_authid_subfield{
1289
    my ($field)=@_;
1290
    my ($field)=@_;
1290
    return $field->subfield('9')||$field->subfield('3');
1291
    my $authsubfield = Koha::Authorities->authority_linking_subfield;
1292
    return $field->subfield($authsubfield)||$field->subfield('3');
1291
}
1293
}
1292
1294
1293
=head2 GetHeaderAuthority
1295
=head2 GetHeaderAuthority
Lines 1394-1399 sub merge { Link Here
1394
    my $authtypeto   = $authto ? Koha::Authority::Types->find($authto->authtypecode) : undef;
1396
    my $authtypeto   = $authto ? Koha::Authority::Types->find($authto->authtypecode) : undef;
1395
    my $auth_tag_to_report_from = $authtypefrom ? $authtypefrom->auth_tag_to_report : '';
1397
    my $auth_tag_to_report_from = $authtypefrom ? $authtypefrom->auth_tag_to_report : '';
1396
    my $auth_tag_to_report_to   = $authtypeto ? $authtypeto->auth_tag_to_report : '';
1398
    my $auth_tag_to_report_to   = $authtypeto ? $authtypeto->auth_tag_to_report : '';
1399
    my $authsubfield = Koha::Authorities->authority_linking_subfield;
1397
1400
1398
    my @record_to;
1401
    my @record_to;
1399
    @record_to = $MARCto->field($auth_tag_to_report_to)->subfields() if $auth_tag_to_report_to && $MARCto && $MARCto->field($auth_tag_to_report_to);
1402
    @record_to = $MARCto->field($auth_tag_to_report_to)->subfields() if $auth_tag_to_report_to && $MARCto && $MARCto->field($auth_tag_to_report_to);
Lines 1441-1447 sub merge { Link Here
1441
        foreach my $tagfield (@$tags_using_authtype) {
1444
        foreach my $tagfield (@$tags_using_authtype) {
1442
            my $countfrom = 0;    # used in strict mode to remove duplicates
1445
            my $countfrom = 0;    # used in strict mode to remove duplicates
1443
            foreach my $field ( $marcrecord->field($tagfield) ) {
1446
            foreach my $field ( $marcrecord->field($tagfield) ) {
1444
                my $auth_number = $field->subfield("9");    # link to authority
1447
                my $auth_number = $field->subfield($authsubfield);    # link to authority
1445
                my $tag         = $field->tag();
1448
                my $tag         = $field->tag();
1446
                next if !defined($auth_number) || $auth_number ne $mergefrom;
1449
                next if !defined($auth_number) || $auth_number ne $mergefrom;
1447
                $countfrom++;
1450
                $countfrom++;
Lines 1461-1467 sub merge { Link Here
1461
                    $newtag,
1464
                    $newtag,
1462
                    $controlled_ind->{ind1} // $field->indicator(1),
1465
                    $controlled_ind->{ind1} // $field->indicator(1),
1463
                    $controlled_ind->{ind2} // $field->indicator(2),
1466
                    $controlled_ind->{ind2} // $field->indicator(2),
1464
                    9 => $mergeto, # Needed to create field, will be moved
1467
                    $authsubfield => $mergeto, # Needed to create field, will be moved
1465
                );
1468
                );
1466
                my ( @prefix, @postfix );
1469
                my ( @prefix, @postfix );
1467
                if ( !$overwrite ) {
1470
                if ( !$overwrite ) {
Lines 1470-1476 sub merge { Link Here
1470
                    # controlled block, the rest at the end.
1473
                    # controlled block, the rest at the end.
1471
                    my $prefix_flag = 1;
1474
                    my $prefix_flag = 1;
1472
                    foreach my $subfield ( $field->subfields ) {
1475
                    foreach my $subfield ( $field->subfields ) {
1473
                        next if $subfield->[0] eq '9'; # skip but leave flag
1476
                        next if $subfield->[0] eq $authsubfield; # skip but leave flag
1474
                        if ( $skip_subfields->{ $subfield->[0] } ) {
1477
                        if ( $skip_subfields->{ $subfield->[0] } ) {
1475
                            # This marks the beginning of the controlled block
1478
                            # This marks the beginning of the controlled block
1476
                            $prefix_flag = 0;
1479
                            $prefix_flag = 0;
Lines 1496-1503 sub merge { Link Here
1496
                    }
1499
                    }
1497
                }
1500
                }
1498
                # Move $9 to the end
1501
                # Move $9 to the end
1499
                $field_to->delete_subfield( code => '9' );
1502
                $field_to->delete_subfield( code => $authsubfield );
1500
                $field_to->add_subfields( 9 => $mergeto );
1503
                $field_to->add_subfields( $authsubfield => $mergeto );
1501
1504
1502
                if ($tags_new && @$tags_new) {
1505
                if ($tags_new && @$tags_new) {
1503
                    $marcrecord->delete_field($field);
1506
                    $marcrecord->delete_field($field);
(-)a/C4/Biblio.pm (-11 / +17 lines)
Lines 96-101 use C4::OAI::Sets; Link Here
96
use C4::Debug;
96
use C4::Debug;
97
97
98
use Koha::Caches;
98
use Koha::Caches;
99
use Koha::Authorities;
99
use Koha::Authority::Types;
100
use Koha::Authority::Types;
100
use Koha::Acquisition::Currencies;
101
use Koha::Acquisition::Currencies;
101
use Koha::Biblio::Metadatas;
102
use Koha::Biblio::Metadatas;
Lines 347-355 sub ModBiblio { Link Here
347
348
348
    # Cleaning up invalid fields must be done early or SetUTF8Flag is liable to
349
    # Cleaning up invalid fields must be done early or SetUTF8Flag is liable to
349
    # throw an exception which probably won't be handled.
350
    # throw an exception which probably won't be handled.
351
    my $authsubfield = Koha::Authorities->authority_linking_subfield;
350
    foreach my $field ($record->fields()) {
352
    foreach my $field ($record->fields()) {
351
        if (! $field->is_control_field()) {
353
        if (! $field->is_control_field()) {
352
            if (scalar($field->subfields()) == 0 || (scalar($field->subfields()) == 1 && $field->subfield('9'))) {
354
            if (scalar($field->subfields()) == 0 || (scalar($field->subfields()) == 1 && $field->subfield($authsubfield))) {
353
                $record->delete_field($field);
355
                $record->delete_field($field);
354
            }
356
            }
355
        }
357
        }
Lines 557-562 sub LinkBibHeadingsToAuthorities { Link Here
557
559
558
    $allowrelink = 1 unless defined $allowrelink;
560
    $allowrelink = 1 unless defined $allowrelink;
559
    my $num_headings_changed = 0;
561
    my $num_headings_changed = 0;
562
    my $authsubfield = Koha::Authorities->authority_linking_subfield;
560
    foreach my $field ( $bib->fields() ) {
563
    foreach my $field ( $bib->fields() ) {
561
        if ( defined $tagtolink ) {
564
        if ( defined $tagtolink ) {
562
          next unless $field->tag() == $tagtolink ;
565
          next unless $field->tag() == $tagtolink ;
Lines 565-571 sub LinkBibHeadingsToAuthorities { Link Here
565
        next unless defined $heading;
568
        next unless defined $heading;
566
569
567
        # check existing $9
570
        # check existing $9
568
        my $current_link = $field->subfield('9');
571
        my $current_link = $field->subfield($authsubfield);
569
572
570
        if ( defined $current_link && (!$allowrelink || !C4::Context->preference('LinkerRelink')) )
573
        if ( defined $current_link && (!$allowrelink || !C4::Context->preference('LinkerRelink')) )
571
        {
574
        {
Lines 579-586 sub LinkBibHeadingsToAuthorities { Link Here
579
              ->{ $heading->display_form() }++;
582
              ->{ $heading->display_form() }++;
580
            next if defined $current_link and $current_link == $authid;
583
            next if defined $current_link and $current_link == $authid;
581
584
582
            $field->delete_subfield( code => '9' ) if defined $current_link;
585
            $field->delete_subfield( code => $authsubfield ) if defined $current_link;
583
            $field->add_subfields( '9', $authid );
586
            $field->add_subfields( $authsubfield, $authid );
584
            $num_headings_changed++;
587
            $num_headings_changed++;
585
        }
588
        }
586
        else {
589
        else {
Lines 600-606 sub LinkBibHeadingsToAuthorities { Link Here
600
                        $marcrecordauth->leader('     nz  a22     o  4500');
603
                        $marcrecordauth->leader('     nz  a22     o  4500');
601
                        SetMarcUnicodeFlag( $marcrecordauth, 'MARC21' );
604
                        SetMarcUnicodeFlag( $marcrecordauth, 'MARC21' );
602
                    }
605
                    }
603
                    $field->delete_subfield( code => '9' )
606
                    $field->delete_subfield( code => $authsubfield )
604
                      if defined $current_link;
607
                      if defined $current_link;
605
                    my @auth_subfields;
608
                    my @auth_subfields;
606
                    foreach my $subfield ( $field->subfields() ){
609
                    foreach my $subfield ( $field->subfields() ){
Lines 659-665 sub LinkBibHeadingsToAuthorities { Link Here
659
                    $authid =
662
                    $authid =
660
                      C4::AuthoritiesMarc::AddAuthority( $marcrecordauth, '',
663
                      C4::AuthoritiesMarc::AddAuthority( $marcrecordauth, '',
661
                        $heading->auth_type() );
664
                        $heading->auth_type() );
662
                    $field->add_subfields( '9', $authid );
665
                    $field->add_subfields( $authsubfield, $authid );
663
                    $num_headings_changed++;
666
                    $num_headings_changed++;
664
                    $linker->update_cache($heading, $authid);
667
                    $linker->update_cache($heading, $authid);
665
                    $results{'added'}->{ $heading->display_form() }++;
668
                    $results{'added'}->{ $heading->display_form() }++;
Lines 1635-1640 sub GetMarcSubjects { Link Here
1635
1638
1636
    my $subject_limit = C4::Context->preference("TraceCompleteSubfields") ? 'su,complete-subfield' : 'su';
1639
    my $subject_limit = C4::Context->preference("TraceCompleteSubfields") ? 'su,complete-subfield' : 'su';
1637
    my $AuthoritySeparator = C4::Context->preference('AuthoritySeparator');
1640
    my $AuthoritySeparator = C4::Context->preference('AuthoritySeparator');
1641
    my $authsubfield = Koha::Authorities->authority_linking_subfield;
1638
1642
1639
    foreach my $field ( $record->field($fields_filter) ) {
1643
    foreach my $field ( $record->field($fields_filter) ) {
1640
        next unless ($field->tag() >= $mintag && $field->tag() <= $maxtag);
1644
        next unless ($field->tag() >= $mintag && $field->tag() <= $maxtag);
Lines 1643-1649 sub GetMarcSubjects { Link Here
1643
        my @link_loop;
1647
        my @link_loop;
1644
1648
1645
        # if there is an authority link, build the links with an= subfield9
1649
        # if there is an authority link, build the links with an= subfield9
1646
        my $subfield9 = $field->subfield('9');
1650
        my $subfield9 = $field->subfield($authsubfield);
1647
        my $authoritylink;
1651
        my $authoritylink;
1648
        if ($subfield9) {
1652
        if ($subfield9) {
1649
            my $linkvalue = $subfield9;
1653
            my $linkvalue = $subfield9;
Lines 1654-1660 sub GetMarcSubjects { Link Here
1654
1658
1655
        # other subfields
1659
        # other subfields
1656
        for my $subject_subfield (@subfields) {
1660
        for my $subject_subfield (@subfields) {
1657
            next if ( $subject_subfield->[0] eq '9' );
1661
            next if ( $subject_subfield->[0] eq $authsubfield );
1658
1662
1659
            # don't load unimarc subfields 3,4,5
1663
            # don't load unimarc subfields 3,4,5
1660
            next if ( ( $marcflavour eq "UNIMARC" ) and ( $subject_subfield->[0] =~ /2|3|4|5/ ) );
1664
            next if ( ( $marcflavour eq "UNIMARC" ) and ( $subject_subfield->[0] =~ /2|3|4|5/ ) );
Lines 1727-1732 sub GetMarcAuthors { Link Here
1727
1731
1728
    my @marcauthors;
1732
    my @marcauthors;
1729
    my $AuthoritySeparator = C4::Context->preference('AuthoritySeparator');
1733
    my $AuthoritySeparator = C4::Context->preference('AuthoritySeparator');
1734
    my $authsubfield = Koha::Authorities->authority_linking_subfield;
1730
1735
1731
    foreach my $field ( $record->field($fields_filter) ) {
1736
    foreach my $field ( $record->field($fields_filter) ) {
1732
        next unless $field->tag() >= $mintag && $field->tag() <= $maxtag;
1737
        next unless $field->tag() >= $mintag && $field->tag() <= $maxtag;
Lines 1736-1742 sub GetMarcAuthors { Link Here
1736
        my $count_auth = 0;
1741
        my $count_auth = 0;
1737
1742
1738
        # if there is an authority link, build the link with Koha-Auth-Number: subfield9
1743
        # if there is an authority link, build the link with Koha-Auth-Number: subfield9
1739
        my $subfield9 = $field->subfield('9');
1744
        my $subfield9 = $field->subfield($authsubfield);
1740
        if ($subfield9) {
1745
        if ($subfield9) {
1741
            my $linkvalue = $subfield9;
1746
            my $linkvalue = $subfield9;
1742
            $linkvalue =~ s/(\(|\))//g;
1747
            $linkvalue =~ s/(\(|\))//g;
Lines 1746-1752 sub GetMarcAuthors { Link Here
1746
        # other subfields
1751
        # other subfields
1747
        my $unimarc3;
1752
        my $unimarc3;
1748
        for my $authors_subfield (@subfields) {
1753
        for my $authors_subfield (@subfields) {
1749
            next if ( $authors_subfield->[0] eq '9' );
1754
            next if ( $authors_subfield->[0] eq $authsubfield );
1750
1755
1751
            # unimarc3 contains the $3 of the author for UNIMARC.
1756
            # unimarc3 contains the $3 of the author for UNIMARC.
1752
            # For french academic libraries, it's the "ppn", and it's required for idref webservice
1757
            # For french academic libraries, it's the "ppn", and it's required for idref webservice
Lines 1882-1887 sub GetMarcSeries { Link Here
1882
1887
1883
    my @marcseries;
1888
    my @marcseries;
1884
    my $AuthoritySeparator = C4::Context->preference('AuthoritySeparator');
1889
    my $AuthoritySeparator = C4::Context->preference('AuthoritySeparator');
1890
    my $authsubfield = Koha::Authorities->authority_linking_subfield;
1885
1891
1886
    foreach my $field ( $record->field($fields_filter) ) {
1892
    foreach my $field ( $record->field($fields_filter) ) {
1887
        next unless $field->tag() >= $mintag && $field->tag() <= $maxtag;
1893
        next unless $field->tag() >= $mintag && $field->tag() <= $maxtag;
Lines 1892-1898 sub GetMarcSeries { Link Here
1892
        for my $series_subfield (@subfields) {
1898
        for my $series_subfield (@subfields) {
1893
1899
1894
            # ignore $9, used for authority link
1900
            # ignore $9, used for authority link
1895
            next if ( $series_subfield->[0] eq '9' );
1901
            next if ( $series_subfield->[0] eq $authsubfield );
1896
1902
1897
            my $volume_number;
1903
            my $volume_number;
1898
            my $code      = $series_subfield->[0];
1904
            my $code      = $series_subfield->[0];
(-)a/C4/Linker/Default.pm (-2 / +4 lines)
Lines 22-27 use warnings; Link Here
22
use Carp;
22
use Carp;
23
use MARC::Field;
23
use MARC::Field;
24
use C4::Heading;
24
use C4::Heading;
25
use Koha::Authorities;
25
26
26
use base qw(C4::Linker);
27
use base qw(C4::Linker);
27
28
Lines 34-40 sub get_link { Link Here
34
    my $authid;
35
    my $authid;
35
    my $fuzzy = 0;
36
    my $fuzzy = 0;
36
    my $match_count;
37
    my $match_count;
37
38
    my $authsubfield = Koha::Authorities->authority_linking_subfield;
39
    
38
    if ( $self->{'cache'}->{$search_form.$auth_type}->{'cached'} ) {
40
    if ( $self->{'cache'}->{$search_form.$auth_type}->{'cached'} ) {
39
        $authid = $self->{'cache'}->{$search_form.$auth_type}->{'authid'};
41
        $authid = $self->{'cache'}->{$search_form.$auth_type}->{'authid'};
40
        $fuzzy  = $self->{'cache'}->{$search_form.$auth_type}->{'fuzzy'};
42
        $fuzzy  = $self->{'cache'}->{$search_form.$auth_type}->{'fuzzy'};
Lines 59-65 sub get_link { Link Here
59
61
60
        if ( !defined $authid && $self->{'broader_headings'} ) {
62
        if ( !defined $authid && $self->{'broader_headings'} ) {
61
            my $field     = $heading->field();
63
            my $field     = $heading->field();
62
            my @subfields = grep { $_->[0] ne '9' } $field->subfields();
64
            my @subfields = grep { $_->[0] ne $authsubfield } $field->subfields();
63
            if ( scalar @subfields > 1 ) {
65
            if ( scalar @subfields > 1 ) {
64
                pop @subfields;
66
                pop @subfields;
65
                $field =
67
                $field =
(-)a/C4/UsageStats.pm (+1 lines)
Lines 111-116 sub BuildReport { Link Here
111
        BiblioAddsAuthorities
111
        BiblioAddsAuthorities
112
        AuthorityMergeLimit
112
        AuthorityMergeLimit
113
        AuthorityMergeMode
113
        AuthorityMergeMode
114
        AuthoritySubfieldLink
114
        UseAuthoritiesForTracings
115
        UseAuthoritiesForTracings
115
        CatalogModuleRelink
116
        CatalogModuleRelink
116
        hide_marc
117
        hide_marc
(-)a/C4/XSLT.pm (-1 / +1 lines)
Lines 173-179 sub get_xslt_sysprefs { Link Here
173
                              TrackClicks opacthemes IdRef OpacSuppression
173
                              TrackClicks opacthemes IdRef OpacSuppression
174
                              OPACResultsLibrary OPACShowOpenURL
174
                              OPACResultsLibrary OPACShowOpenURL
175
                              OpenURLResolverURL OpenURLImageLocation
175
                              OpenURLResolverURL OpenURLImageLocation
176
                              OpenURLText OPACShowMusicalInscripts OPACPlayMusicalInscripts / )
176
                              OpenURLText OPACShowMusicalInscripts OPACPlayMusicalInscripts AuthoritySubfieldLink / )
177
    {
177
    {
178
        my $sp = C4::Context->preference( $syspref );
178
        my $sp = C4::Context->preference( $syspref );
179
        next unless defined($sp);
179
        next unless defined($sp);
(-)a/Koha/Authorities.pm (+16 lines)
Lines 22-27 use Modern::Perl; Link Here
22
use Carp;
22
use Carp;
23
23
24
use Koha::Database;
24
use Koha::Database;
25
use C4::Context;
25
26
26
use Koha::Authority;
27
use Koha::Authority;
27
28
Lines 94-99 sub linked_biblionumbers { Link Here
94
    return @biblionumbers;
95
    return @biblionumbers;
95
}
96
}
96
97
98
=head3 authority_linking_subfield
99
100
    $authsubfield = Koha::Authorities->authority_linking_subfield;
101
102
    Returns the authority subfield for selected MARC format
103
104
=cut
105
106
sub authority_linking_subfield {
107
    my ( $class ) = @_;
108
109
    return C4::Context->preference('AuthoritySubfieldLink');
110
111
}
112
97
=head3 type
113
=head3 type
98
114
99
=cut
115
=cut
(-)a/authorities/blinddetail-biblio-search.pl (-1 / +3 lines)
Lines 57-62 my $authid = $query->param('authid'); Link Here
57
my $index        = $query->param('index');
57
my $index        = $query->param('index');
58
my $tagid        = $query->param('tagid');
58
my $tagid        = $query->param('tagid');
59
my $relationship = $query->param('relationship');
59
my $relationship = $query->param('relationship');
60
my $authsubfield = Koha::Authorities->authority_linking_subfield;
60
61
61
# open template
62
# open template
62
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
63
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Lines 87-93 if ($authid) { Link Here
87
    # Get all values for each distinct subfield and add to subfield loop
88
    # Get all values for each distinct subfield and add to subfield loop
88
    my %done_subfields;
89
    my %done_subfields;
89
    for ( $field->subfields ) {
90
    for ( $field->subfields ) {
90
        next if $_->[0] eq '9'; # $9 will be set with authid value
91
        next if $_->[0] eq $authsubfield; # $9 will be set with authid value
91
        my $letter = $_->[0];
92
        my $letter = $_->[0];
92
        $letter ||= '@';
93
        $letter ||= '@';
93
        next if defined $done_subfields{$letter};
94
        next if defined $done_subfields{$letter};
Lines 114-119 if ($authid) { Link Here
114
115
115
$template->param(
116
$template->param(
116
    authid          => $authid ? $authid : "",
117
    authid          => $authid ? $authid : "",
118
    authsubfield    => $authsubfield,
117
    index           => $index,
119
    index           => $index,
118
    tagid           => $tagid,
120
    tagid           => $tagid,
119
    update_ind1     => defined($indicator1),
121
    update_ind1     => defined($indicator1),
(-)a/authorities/detail.pl (-1 / +2 lines)
Lines 210-217 my $count = $authobj ? $authobj->get_usage_count : 0; Link Here
210
my $sth = $dbh->prepare("select distinct tagfield from marc_subfield_structure where authtypecode=?");
210
my $sth = $dbh->prepare("select distinct tagfield from marc_subfield_structure where authtypecode=?");
211
$sth->execute($authtypecode);
211
$sth->execute($authtypecode);
212
my $biblio_fields;
212
my $biblio_fields;
213
my $authsubfield = Koha::Authorities->authority_linking_subfield;
213
while (my ($tagfield) = $sth->fetchrow) {
214
while (my ($tagfield) = $sth->fetchrow) {
214
	$biblio_fields.= $tagfield."9,";
215
	$biblio_fields.= $tagfield.$authsubfield.",";
215
}
216
}
216
chop $biblio_fields if $biblio_fields;
217
chop $biblio_fields if $biblio_fields;
217
218
(-)a/cataloguing/addbiblio.pl (-4 / +6 lines)
Lines 338-343 sub create_input { Link Here
338
338
339
339
340
    # it's an authorised field
340
    # it's an authorised field
341
    my $authsubfield = Koha::Authorities->authority_linking_subfield;
341
    if ( $tagslib->{$tag}->{$subfield}->{authorised_value} ) {
342
    if ( $tagslib->{$tag}->{$subfield}->{authorised_value} ) {
342
        $subfield_data{marc_value} =
343
        $subfield_data{marc_value} =
343
          build_authorized_values_list( $tag, $subfield, $value, $dbh,
344
          build_authorized_values_list( $tag, $subfield, $value, $dbh,
Lines 345-351 sub create_input { Link Here
345
346
346
    # it's a subfield $9 linking to an authority record - see bug 2206
347
    # it's a subfield $9 linking to an authority record - see bug 2206
347
    }
348
    }
348
    elsif ($subfield eq "9" and
349
    elsif ($subfield eq $authsubfield and
349
           exists($tagslib->{$tag}->{'a'}->{authtypecode}) and
350
           exists($tagslib->{$tag}->{'a'}->{authtypecode}) and
350
           defined($tagslib->{$tag}->{'a'}->{authtypecode}) and
351
           defined($tagslib->{$tag}->{'a'}->{authtypecode}) and
351
           $tagslib->{$tag}->{'a'}->{authtypecode} ne '') {
352
           $tagslib->{$tag}->{'a'}->{authtypecode} ne '') {
Lines 516-521 sub build_tabs { Link Here
516
    if($max_num_tab >= 9){
517
    if($max_num_tab >= 9){
517
        $max_num_tab = 9;
518
        $max_num_tab = 9;
518
    }
519
    }
520
    my $authsubfield = Koha::Authorities->authority_linking_subfield;
519
    # loop through each tab 0 through 9
521
    # loop through each tab 0 through 9
520
    for ( my $tabloop = 0 ; $tabloop <= $max_num_tab ; $tabloop++ ) {
522
    for ( my $tabloop = 0 ; $tabloop <= $max_num_tab ; $tabloop++ ) {
521
        my @loop_data = (); #innerloop in the template.
523
        my @loop_data = (); #innerloop in the template.
Lines 578-584 sub build_tabs { Link Here
578
                            );
580
                            );
579
                        }
581
                        }
580
                    }
582
                    }
581
583
                    
582
                    # now, loop again to add parameter subfield that are not in the MARC::Record
584
                    # now, loop again to add parameter subfield that are not in the MARC::Record
583
                    foreach my $subfield ( sort( keys %{ $tagslib->{$tag} } ) )
585
                    foreach my $subfield ( sort( keys %{ $tagslib->{$tag} } ) )
584
                    {
586
                    {
Lines 588-594 sub build_tabs { Link Here
588
                        next
590
                        next
589
                          if ( ( $tagslib->{$tag}->{$subfield}->{hidden} <= -4 )
591
                          if ( ( $tagslib->{$tag}->{$subfield}->{hidden} <= -4 )
590
                            or ( $tagslib->{$tag}->{$subfield}->{hidden} >= 5 ) )
592
                            or ( $tagslib->{$tag}->{$subfield}->{hidden} >= 5 ) )
591
                            and not ( $subfield eq "9" and
593
                            and not ( $subfield eq $authsubfield and
592
                                      exists($tagslib->{$tag}->{'a'}->{authtypecode}) and
594
                                      exists($tagslib->{$tag}->{'a'}->{authtypecode}) and
593
                                      defined($tagslib->{$tag}->{'a'}->{authtypecode}) and
595
                                      defined($tagslib->{$tag}->{'a'}->{authtypecode}) and
594
                                      $tagslib->{$tag}->{'a'}->{authtypecode} ne ""
596
                                      $tagslib->{$tag}->{'a'}->{authtypecode} ne ""
Lines 638-644 sub build_tabs { Link Here
638
                    next
640
                    next
639
                      if ( ( $tagslib->{$tag}->{$subfield}->{hidden} <= -4 )
641
                      if ( ( $tagslib->{$tag}->{$subfield}->{hidden} <= -4 )
640
                        or ( $tagslib->{$tag}->{$subfield}->{hidden} >= 5 ) )
642
                        or ( $tagslib->{$tag}->{$subfield}->{hidden} >= 5 ) )
641
                      and not ( $subfield eq "9" and
643
                      and not ( $subfield eq $authsubfield and
642
                                exists($tagslib->{$tag}->{'a'}->{authtypecode}) and
644
                                exists($tagslib->{$tag}->{'a'}->{authtypecode}) and
643
                                defined($tagslib->{$tag}->{'a'}->{authtypecode}) and
645
                                defined($tagslib->{$tag}->{'a'}->{authtypecode}) and
644
                                $tagslib->{$tag}->{'a'}->{authtypecode} ne ""
646
                                $tagslib->{$tag}->{'a'}->{authtypecode} ne ""
(-)a/installer/data/mysql/atomicupdate/bug_17511.perl (+8 lines)
Line 0 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    # you can use $dbh here like:
4
    $dbh->do(q{INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('AuthoritySubfieldLink', '9', NULL, 'Define authority linking subfield. Note: if you change this you should change the value also from indexing configurations.', 'Free') });
5
6
    # Always end with this (adjust the bug info)
7
    NewVersion( $DBversion, 17511, "Change authority linking subfield from 9 to 0");
8
}
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 67-72 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
67
('AuthorityMergeLimit','50',NULL,'Maximum number of biblio records updated immediately when an authority record has been modified.','integer'),
67
('AuthorityMergeLimit','50',NULL,'Maximum number of biblio records updated immediately when an authority record has been modified.','integer'),
68
('AuthorityMergeMode','loose','loose|strict','Authority merge mode','Choice'),
68
('AuthorityMergeMode','loose','loose|strict','Authority merge mode','Choice'),
69
('AuthoritySeparator','--','10','Used to separate a list of authorities in a display. Usually --','free'),
69
('AuthoritySeparator','--','10','Used to separate a list of authorities in a display. Usually --','free'),
70
('AuthoritySubfieldLink','9',NULL,'Define authority linking subfield. Note: if you change this you should change the value also from indexing configurations.','Free'),
70
('AuthSuccessLog','',NULL,'If enabled, log successful authentications','YesNo'),
71
('AuthSuccessLog','',NULL,'If enabled, log successful authentications','YesNo'),
71
('autoBarcode','OFF','incremental|annual|hbyymmincr|EAN13|OFF','Used to autogenerate a barcode: incremental will be of the form 1, 2, 3; annual of the form 2007-0001, 2007-0002; hbyymmincr of the form HB08010001 where HB=Home Branch','Choice'),
72
('autoBarcode','OFF','incremental|annual|hbyymmincr|EAN13|OFF','Used to autogenerate a barcode: incremental will be of the form 1, 2, 3; annual of the form 2007-0001, 2007-0002; hbyymmincr of the form HB08010001 where HB=Home Branch','Choice'),
72
('AutoCreateAuthorities','0',NULL,'Automatically create authorities that do not exist when cataloging records.','YesNo'),
73
('AutoCreateAuthorities','0',NULL,'Automatically create authorities that do not exist when cataloging records.','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/authorities.pref (+5 lines)
Lines 63-68 Authorities: Link Here
63
                  "loose": loose
63
                  "loose": loose
64
                  "strict": strict
64
                  "strict": strict
65
            - mode. In strict mode subfields that are not found in the authority record, are deleted. Loose mode will keep them. Loose mode is the historical behavior and still the default.
65
            - mode. In strict mode subfields that are not found in the authority record, are deleted. Loose mode will keep them. Loose mode is the historical behavior and still the default.
66
        -
67
            - "Define authority linking subfield."
68
            - pref: AuthoritySubfieldLink
69
              default: "9"
70
            - <b>Note:</b> if you change this you should also change the value from indexing mappings.
66
71
67
    Linker:
72
    Linker:
68
        -
73
        -
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt (-1 / +2 lines)
Lines 42-47 Link Here
42
            [% ELSE %]
42
            [% ELSE %]
43
                var index_start = "[% index | html %]";
43
                var index_start = "[% index | html %]";
44
                var whichfield;
44
                var whichfield;
45
                var authsubfield = "[% authsubfield %]";
45
                try {
46
                try {
46
                    whichfield = opener.opener.document.getElementById(index_start);
47
                    whichfield = opener.opener.document.getElementById(index_start);
47
                } catch(e) {
48
                } catch(e) {
Lines 136-142 Link Here
136
                    [% IF ( clear ) %]
137
                    [% IF ( clear ) %]
137
                        if (subfield){subfield.value="" ;}
138
                        if (subfield){subfield.value="" ;}
138
                    [% ELSE %]
139
                    [% ELSE %]
139
                        if(code.value=='9'){
140
                        if(code.value==authsubfield){
140
                            subfield.value = "[% To.json(authid) | $raw %]";
141
                            subfield.value = "[% To.json(authid) | $raw %]";
141
                            break;
142
                            break;
142
                        }
143
                        }
(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl (-6 / +12 lines)
Lines 28-33 Link Here
28
        <xsl:variable name="Show856uAsImage" select="marc:sysprefs/marc:syspref[@name='Display856uAsImage']"/>
28
        <xsl:variable name="Show856uAsImage" select="marc:sysprefs/marc:syspref[@name='Display856uAsImage']"/>
29
        <xsl:variable name="DisplayIconsXSLT" select="marc:sysprefs/marc:syspref[@name='DisplayIconsXSLT']"/>
29
        <xsl:variable name="DisplayIconsXSLT" select="marc:sysprefs/marc:syspref[@name='DisplayIconsXSLT']"/>
30
        <xsl:variable name="OpacSuppression" select="marc:sysprefs/marc:syspref[@name='OpacSuppression']"/>
30
        <xsl:variable name="OpacSuppression" select="marc:sysprefs/marc:syspref[@name='OpacSuppression']"/>
31
        <xsl:variable name="AuthoritySubfieldLink" select="marc:sysprefs/marc:syspref[@name='AuthoritySubfieldLink']"/>
31
        <xsl:variable name="TracingQuotesLeft">
32
        <xsl:variable name="TracingQuotesLeft">
32
           <xsl:choose>
33
           <xsl:choose>
33
             <xsl:when test="marc:sysprefs/marc:syspref[@name='UseICU']='1'">{</xsl:when>
34
             <xsl:when test="marc:sysprefs/marc:syspref[@name='UseICU']='1'">{</xsl:when>
Lines 153-158 Link Here
153
                    <xsl:with-param name="codes">abc</xsl:with-param>
154
                    <xsl:with-param name="codes">abc</xsl:with-param>
154
                    <xsl:with-param name="index">au</xsl:with-param>
155
                    <xsl:with-param name="index">au</xsl:with-param>
155
                    <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
156
                    <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
157
                    <xsl:with-param name="AuthoritySubfieldLink" select="$AuthoritySubfieldLink"/>
156
                    <!-- do not use label 'by ' here, it would be repeated for every occurrence of 100,110,111,700,710,711 -->
158
                    <!-- do not use label 'by ' here, it would be repeated for every occurrence of 100,110,111,700,710,711 -->
157
                </xsl:call-template>
159
                </xsl:call-template>
158
            </h5>
160
            </h5>
Lines 162-173 Link Here
162
        <xsl:call-template name="showAuthor">
164
        <xsl:call-template name="showAuthor">
163
            <xsl:with-param name="authorfield" select="marc:datafield[@tag=100 or @tag=110 or @tag=111]"/>
165
            <xsl:with-param name="authorfield" select="marc:datafield[@tag=100 or @tag=110 or @tag=111]"/>
164
            <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
166
            <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
167
            <xsl:with-param name="AuthoritySubfieldLink" select="$AuthoritySubfieldLink"/>
165
        </xsl:call-template>
168
        </xsl:call-template>
166
169
167
        <!-- #13382 Suppress 700$i and 7xx/@ind2=2 -->
170
        <!-- #13382 Suppress 700$i and 7xx/@ind2=2 -->
168
        <xsl:call-template name="showAuthor">
171
        <xsl:call-template name="showAuthor">
169
            <xsl:with-param name="authorfield" select="marc:datafield[(@tag=700 or @tag=710 or @tag=711) and not(@ind2=2) and not(marc:subfield[@code='i'])]"/>
172
            <xsl:with-param name="authorfield" select="marc:datafield[(@tag=700 or @tag=710 or @tag=711) and not(@ind2=2) and not(marc:subfield[@code='i'])]"/>
170
            <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
173
            <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
174
            <xsl:with-param name="AuthoritySubfieldLink" select="$AuthoritySubfieldLink"/>
171
        </xsl:call-template>
175
        </xsl:call-template>
172
176
173
    <xsl:if test="$DisplayIconsXSLT!='0' and $materialTypeCode!=''">
177
    <xsl:if test="$DisplayIconsXSLT!='0' and $materialTypeCode!=''">
Lines 195-200 Link Here
195
        <xsl:with-param name="searchurl">/cgi-bin/koha/catalogue/search.pl</xsl:with-param>
199
        <xsl:with-param name="searchurl">/cgi-bin/koha/catalogue/search.pl</xsl:with-param>
196
        <xsl:with-param name="UseControlNumber" select="$UseControlNumber"/>
200
        <xsl:with-param name="UseControlNumber" select="$UseControlNumber"/>
197
        <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
201
        <xsl:with-param name="UseAuthoritiesForTracings" select="$UseAuthoritiesForTracings"/>
202
        <xsl:with-param name="AuthoritySubfieldLink" select="$AuthoritySubfieldLink"/>
198
    </xsl:call-template>
203
    </xsl:call-template>
199
204
200
        <!-- Analytics information -->
205
        <!-- Analytics information -->
Lines 646-653 Link Here
646
            <a>
651
            <a>
647
            <xsl:choose>
652
            <xsl:choose>
648
            <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
653
            <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
649
            <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
654
            <xsl:when test="marc:subfield[@code=$AuthoritySubfieldLink] and $UseAuthoritiesForTracings='1'">
650
                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
655
                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
651
            </xsl:when>
656
            </xsl:when>
652
            <xsl:when test="$TraceSubjectSubdivisions='1'">
657
            <xsl:when test="$TraceSubjectSubdivisions='1'">
653
                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:call-template name="subfieldSelectSubject">
658
                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:call-template name="subfieldSelectSubject">
Lines 705-712 Link Here
705
                <xsl:for-each select="marc:datafield[@tag=655]">
710
                <xsl:for-each select="marc:datafield[@tag=655]">
706
                    <a>
711
                    <a>
707
                        <xsl:choose>
712
                        <xsl:choose>
708
                            <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
713
                            <xsl:when test="marc:subfield[@code=$AuthoritySubfieldLink] and $UseAuthoritiesForTracings='1'">
709
                                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
714
                                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
710
                            </xsl:when>
715
                            </xsl:when>
711
                            <xsl:when test="$TraceSubjectSubdivisions='1'">
716
                            <xsl:when test="$TraceSubjectSubdivisions='1'">
712
                                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:call-template name="subfieldSelect">
717
                                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:call-template name="subfieldSelect">
Lines 1459-1464 Link Here
1459
    <xsl:template name="showAuthor">
1464
    <xsl:template name="showAuthor">
1460
	<xsl:param name="authorfield"/>
1465
	<xsl:param name="authorfield"/>
1461
    <xsl:param name="UseAuthoritiesForTracings"/>
1466
    <xsl:param name="UseAuthoritiesForTracings"/>
1467
    <xsl:param name="AuthoritySubfieldLink"/>
1462
	<xsl:if test="count($authorfield)&gt;0">
1468
	<xsl:if test="count($authorfield)&gt;0">
1463
        <h5 class="author">
1469
        <h5 class="author">
1464
        <xsl:for-each select="$authorfield">
1470
        <xsl:for-each select="$authorfield">
Lines 1471-1478 Link Here
1471
        </xsl:choose>
1477
        </xsl:choose>
1472
        <a>
1478
        <a>
1473
        <xsl:choose>
1479
        <xsl:choose>
1474
            <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
1480
            <xsl:when test="marc:subfield[@code=$AuthoritySubfieldLink] and $UseAuthoritiesForTracings='1'">
1475
                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
1481
                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
1476
            </xsl:when>
1482
            </xsl:when>
1477
            <xsl:otherwise>
1483
            <xsl:otherwise>
1478
            <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute>
1484
            <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute>
(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl (-2 / +3 lines)
Lines 27-32 Link Here
27
        <xsl:variable name="DisplayIconsXSLT" select="marc:sysprefs/marc:syspref[@name='DisplayIconsXSLT']"/>
27
        <xsl:variable name="DisplayIconsXSLT" select="marc:sysprefs/marc:syspref[@name='DisplayIconsXSLT']"/>
28
        <xsl:variable name="IntranetBiblioDefaultView" select="marc:sysprefs/marc:syspref[@name='IntranetBiblioDefaultView']"/>
28
        <xsl:variable name="IntranetBiblioDefaultView" select="marc:sysprefs/marc:syspref[@name='IntranetBiblioDefaultView']"/>
29
        <xsl:variable name="OpacSuppression" select="marc:sysprefs/marc:syspref[@name='OpacSuppression']"/>
29
        <xsl:variable name="OpacSuppression" select="marc:sysprefs/marc:syspref[@name='OpacSuppression']"/>
30
        <xsl:variable name="AuthoritySubfieldLink" select="marc:sysprefs/marc:syspref[@name='AuthoritySubfieldLink']"/>
30
        <xsl:variable name="leader" select="marc:leader"/>
31
        <xsl:variable name="leader" select="marc:leader"/>
31
        <xsl:variable name="leader6" select="substring($leader,7,1)"/>
32
        <xsl:variable name="leader6" select="substring($leader,7,1)"/>
32
        <xsl:variable name="leader7" select="substring($leader,8,1)"/>
33
        <xsl:variable name="leader7" select="substring($leader,8,1)"/>
Lines 353-360 Link Here
353
        <xsl:for-each select="marc:datafield[(@tag=100 or @tag=700 or @tag=110 or @tag=710 or @tag=111 or @tag=711) and @ind1!='z']">
354
        <xsl:for-each select="marc:datafield[(@tag=100 or @tag=700 or @tag=110 or @tag=710 or @tag=111 or @tag=711) and @ind1!='z']">
354
            <a>
355
            <a>
355
                <xsl:choose>
356
                <xsl:choose>
356
                    <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
357
                    <xsl:when test="marc:subfield[@code=$AuthoritySubfieldLink] and $UseAuthoritiesForTracings='1'">
357
                        <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
358
                        <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
358
                    </xsl:when>
359
                    </xsl:when>
359
                    <xsl:otherwise>
360
                    <xsl:otherwise>
360
                        <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute>
361
                        <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute>
(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl (-6 / +7 lines)
Lines 209-217 Link Here
209
                                <xsl:value-of select="$str"/>
209
                                <xsl:value-of select="$str"/>
210
                            </a>
210
                            </a>
211
                        </xsl:when>
211
                        </xsl:when>
212
                       <xsl:when test="boolean($index) and boolean(marc:subfield[@code=9]) and $UseAuthoritiesForTracings='1'">
212
                       <xsl:when test="boolean($index) and boolean(marc:subfield[@code=$AuthoritySubfieldLink]) and $UseAuthoritiesForTracings='1'">
213
                            <a>
213
                            <a>
214
                                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of  select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
214
                                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of  select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
215
                                  <xsl:value-of select="$str"/>
215
                                  <xsl:value-of select="$str"/>
216
                            </a>
216
                            </a>
217
                        </xsl:when>
217
                        </xsl:when>
Lines 407-412 Link Here
407
        <xsl:param name="searchurl"/>
407
        <xsl:param name="searchurl"/>
408
        <xsl:param name="UseControlNumber"/>
408
        <xsl:param name="UseControlNumber"/>
409
        <xsl:param name="UseAuthoritiesForTracings"/>
409
        <xsl:param name="UseAuthoritiesForTracings"/>
410
        <xsl:param name="AuthoritySubfieldLink"/>
410
        <!-- Series -->
411
        <!-- Series -->
411
        <xsl:if test="marc:datafield[@tag=440 or @tag=490]">
412
        <xsl:if test="marc:datafield[@tag=440 or @tag=490]">
412
        <span class="results_summary series"><span class="label">Series: </span>
413
        <span class="results_summary series"><span class="label">Series: </span>
Lines 474-481 Link Here
474
                            </xsl:call-template>
475
                            </xsl:call-template>
475
                        </a>
476
                        </a>
476
                    </xsl:when>
477
                    </xsl:when>
477
                    <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
478
                    <xsl:when test="marc:subfield[@code=$AuthoritySubfieldLink] and $UseAuthoritiesForTracings='1'">
478
                        <a><xsl:attribute name="href"><xsl:value-of select="$searchurl"/>?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
479
                        <a><xsl:attribute name="href"><xsl:value-of select="$searchurl"/>?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
479
                            <xsl:call-template name="chopPunctuation">
480
                            <xsl:call-template name="chopPunctuation">
480
                                <xsl:with-param name="chopString">
481
                                <xsl:with-param name="chopString">
481
                                    <xsl:call-template name="subfieldSelect">
482
                                    <xsl:call-template name="subfieldSelect">
Lines 516-523 Link Here
516
                            </xsl:call-template>
517
                            </xsl:call-template>
517
                        </a>
518
                        </a>
518
                    </xsl:when>
519
                    </xsl:when>
519
                    <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
520
                    <xsl:when test="marc:subfield[@code=$AuthoritySubfieldLink] and $UseAuthoritiesForTracings='1'">
520
                        <a><xsl:attribute name="href"><xsl:value-of select="$searchurl"/>?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
521
                        <a><xsl:attribute name="href"><xsl:value-of select="$searchurl"/>?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
521
                            <xsl:call-template name="chopPunctuation">
522
                            <xsl:call-template name="chopPunctuation">
522
                                <xsl:with-param name="chopString">
523
                                <xsl:with-param name="chopString">
523
                                    <xsl:call-template name="subfieldSelect">
524
                                    <xsl:call-template name="subfieldSelect">
(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/NORMARCslim2intranetDetail.xsl (-8 / +9 lines)
Lines 23-28 Link Here
23
        <xsl:variable name="SubjectModifier"><xsl:if test="marc:sysprefs/marc:syspref[@name='TraceCompleteSubfields']='1'">,complete-subfield</xsl:if></xsl:variable>
23
        <xsl:variable name="SubjectModifier"><xsl:if test="marc:sysprefs/marc:syspref[@name='TraceCompleteSubfields']='1'">,complete-subfield</xsl:if></xsl:variable>
24
        <xsl:variable name="TraceSubjectSubdivisions" select="marc:sysprefs/marc:syspref[@name='TraceSubjectSubdivisions']"/>
24
        <xsl:variable name="TraceSubjectSubdivisions" select="marc:sysprefs/marc:syspref[@name='TraceSubjectSubdivisions']"/>
25
        <xsl:variable name="OpacSuppression" select="marc:sysprefs/marc:syspref[@name='OpacSuppression']"/>
25
        <xsl:variable name="OpacSuppression" select="marc:sysprefs/marc:syspref[@name='OpacSuppression']"/>
26
        <xsl:variable name="AuthoritySubfieldLink" select="marc:sysprefs/marc:syspref[@name='AuthoritySubfieldLink']"/>
26
        <xsl:variable name="TracingQuotesLeft">
27
        <xsl:variable name="TracingQuotesLeft">
27
          <xsl:choose>
28
          <xsl:choose>
28
            <xsl:when test="marc:sysprefs/marc:syspref[@name='UseICU']='1'">{</xsl:when>
29
            <xsl:when test="marc:sysprefs/marc:syspref[@name='UseICU']='1'">{</xsl:when>
Lines 105-112 Link Here
105
        <xsl:for-each select="marc:datafield[@tag=100 or @tag=700]">
106
        <xsl:for-each select="marc:datafield[@tag=100 or @tag=700]">
106
        <a>
107
        <a>
107
        <xsl:choose>
108
        <xsl:choose>
108
            <xsl:when test="marc:subfield[@code=9]">
109
            <xsl:when test="marc:subfield[@code=$AuthoritySubfieldLink]">
109
                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
110
                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
110
            </xsl:when>
111
            </xsl:when>
111
            <xsl:otherwise>
112
            <xsl:otherwise>
112
            <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute>
113
            <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute>
Lines 120-127 Link Here
120
        <xsl:for-each select="marc:datafield[@tag=110 or @tag=710]">
121
        <xsl:for-each select="marc:datafield[@tag=110 or @tag=710]">
121
        <a>
122
        <a>
122
        <xsl:choose>
123
        <xsl:choose>
123
            <xsl:when test="marc:subfield[@code=9]">
124
            <xsl:when test="marc:subfield[@code=$AuthoritySubfieldLink]">
124
                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
125
                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
125
            </xsl:when>
126
            </xsl:when>
126
            <xsl:otherwise>
127
            <xsl:otherwise>
127
            <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute>
128
            <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute>
Lines 134-141 Link Here
134
        <xsl:for-each select="marc:datafield[@tag=111 or @tag=711]">
135
        <xsl:for-each select="marc:datafield[@tag=111 or @tag=711]">
135
        <a>
136
        <a>
136
        <xsl:choose>
137
        <xsl:choose>
137
            <xsl:when test="marc:subfield[@code=9]">
138
            <xsl:when test="marc:subfield[@code=$AuthoritySubfieldLink]">
138
                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
139
                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
139
            </xsl:when>
140
            </xsl:when>
140
            <xsl:otherwise>
141
            <xsl:otherwise>
141
            <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute>
142
            <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute>
Lines 407-414 Link Here
407
            <a>
408
            <a>
408
            <xsl:choose>
409
            <xsl:choose>
409
            <!-- Will implement this later
410
            <!-- Will implement this later
410
                <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
411
                <xsl:when test="marc:subfield[@code=$AuthoritySubfieldLink] and $UseAuthoritiesForTracings='1'">
411
                    <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
412
                    <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
412
                </xsl:when>
413
                </xsl:when>
413
            -->
414
            -->
414
            <xsl:when test="$TraceSubjectSubdivisions='1'">
415
            <xsl:when test="$TraceSubjectSubdivisions='1'">
(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/NORMARCslim2intranetResults.xsl (-6 / +7 lines)
Lines 27-32 Link Here
27
        <xsl:variable name="OpacSuppression" select="marc:sysprefs/marc:syspref[@name='OpacSuppression']"/>
27
        <xsl:variable name="OpacSuppression" select="marc:sysprefs/marc:syspref[@name='OpacSuppression']"/>
28
        <xsl:variable name="IntranetBiblioDefaultView" select="marc:sysprefs/marc:syspref[@name='IntranetBiblioDefaultView']"/>
28
        <xsl:variable name="IntranetBiblioDefaultView" select="marc:sysprefs/marc:syspref[@name='IntranetBiblioDefaultView']"/>
29
        <xsl:variable name="UseAuthoritiesForTracings" select="marc:sysprefs/marc:syspref[@name='UseAuthoritiesForTracings']"/>
29
        <xsl:variable name="UseAuthoritiesForTracings" select="marc:sysprefs/marc:syspref[@name='UseAuthoritiesForTracings']"/>
30
        <xsl:variable name="AuthoritySubfieldLink" select="marc:sysprefs/marc:syspref[@name='AuthoritySubfieldLink']"/>
30
        <xsl:variable name="leader" select="marc:leader"/>
31
        <xsl:variable name="leader" select="marc:leader"/>
31
        <xsl:variable name="leader6" select="substring($leader,7,1)"/>
32
        <xsl:variable name="leader6" select="substring($leader,7,1)"/>
32
        <xsl:variable name="leader7" select="substring($leader,8,1)"/>
33
        <xsl:variable name="leader7" select="substring($leader,8,1)"/>
Lines 305-312 Link Here
305
    <xsl:for-each select="marc:datafield[(@tag=100 or @tag=700) and @ind1!='z']">
306
    <xsl:for-each select="marc:datafield[(@tag=100 or @tag=700) and @ind1!='z']">
306
    <a>
307
    <a>
307
    <xsl:choose>
308
    <xsl:choose>
308
        <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
309
        <xsl:when test="marc:subfield[@code=$AuthoritySubfieldLink] and $UseAuthoritiesForTracings='1'">
309
            <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
310
            <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
310
        </xsl:when>
311
        </xsl:when>
311
        <xsl:otherwise>
312
        <xsl:otherwise>
312
        <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute>
313
        <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute>
Lines 320-327 Link Here
320
    <xsl:for-each select="marc:datafield[(@tag=110 or @tag=710) and @ind1!='z']">
321
    <xsl:for-each select="marc:datafield[(@tag=110 or @tag=710) and @ind1!='z']">
321
    <a>
322
    <a>
322
    <xsl:choose>
323
    <xsl:choose>
323
        <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
324
        <xsl:when test="marc:subfield[@code=$AuthoritySubfieldLink] and $UseAuthoritiesForTracings='1'">
324
            <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
325
            <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
325
        </xsl:when>
326
        </xsl:when>
326
        <xsl:otherwise>
327
        <xsl:otherwise>
327
        <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute>
328
        <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute>
Lines 342-349 Link Here
342
        </xsl:choose>
343
        </xsl:choose>
343
    <a>
344
    <a>
344
    <xsl:choose>
345
    <xsl:choose>
345
        <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
346
        <xsl:when test="marc:subfield[@code=$AuthoritySubfieldLink] and $UseAuthoritiesForTracings='1'">
346
            <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
347
            <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
347
        </xsl:when>
348
        </xsl:when>
348
        <xsl:otherwise>
349
        <xsl:otherwise>
349
        <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute>
350
        <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=au:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute>
(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/NORMARCslimUtils.xsl (-2 / +2 lines)
Lines 231-239 Link Here
231
                                <xsl:value-of select="$str"/>
231
                                <xsl:value-of select="$str"/>
232
                            </a>
232
                            </a>
233
                        </xsl:when>
233
                        </xsl:when>
234
                       <xsl:when test="boolean($index) and boolean(marc:subfield[@code=9])">
234
                       <xsl:when test="boolean($index) and boolean(marc:subfield[@code=$AuthoritySubfieldLink])">
235
                            <a>
235
                            <a>
236
                                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of  select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
236
                                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of  select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
237
                                  <xsl:value-of select="$str"/>
237
                                  <xsl:value-of select="$str"/>
238
                            </a>
238
                            </a>
239
                        </xsl:when>
239
                        </xsl:when>
(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslim2intranetDetail.xsl (+1 lines)
Lines 16-21 Link Here
16
16
17
<xsl:template match="marc:record">
17
<xsl:template match="marc:record">
18
  <xsl:variable name="Show856uAsImage" select="marc:sysprefs/marc:syspref[@name='Display856uAsImage']"/>
18
  <xsl:variable name="Show856uAsImage" select="marc:sysprefs/marc:syspref[@name='Display856uAsImage']"/>
19
  <xsl:variable name="AuthoritySubfieldLink" select="marc:sysprefs/marc:syspref[@name='AuthoritySubfieldLink']"/>
19
  <xsl:variable name="leader" select="marc:leader"/>
20
  <xsl:variable name="leader" select="marc:leader"/>
20
  <xsl:variable name="leader6" select="substring($leader,7,1)"/>
21
  <xsl:variable name="leader6" select="substring($leader,7,1)"/>
21
  <xsl:variable name="leader7" select="substring($leader,8,1)"/>
22
  <xsl:variable name="leader7" select="substring($leader,8,1)"/>
(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslim2intranetResults.xsl (+1 lines)
Lines 18-23 Link Here
18
18
19
<xsl:template match="marc:record">
19
<xsl:template match="marc:record">
20
  <xsl:variable name="IntranetBiblioDefaultView" select="marc:sysprefs/marc:syspref[@name='IntranetBiblioDefaultView']"/>
20
  <xsl:variable name="IntranetBiblioDefaultView" select="marc:sysprefs/marc:syspref[@name='IntranetBiblioDefaultView']"/>
21
  <xsl:variable name="AuthoritySubfieldLink" select="marc:sysprefs/marc:syspref[@name='AuthoritySubfieldLink']"/>
21
  <xsl:variable name="leader" select="marc:leader"/>
22
  <xsl:variable name="leader" select="marc:leader"/>
22
  <xsl:variable name="leader6" select="substring($leader,7,1)"/>
23
  <xsl:variable name="leader6" select="substring($leader,7,1)"/>
23
  <xsl:variable name="leader7" select="substring($leader,8,1)"/>
24
  <xsl:variable name="leader7" select="substring($leader,8,1)"/>
(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslimUtils.xsl (-4 / +4 lines)
Lines 255-262 Link Here
255
        <xsl:for-each select="marc:datafield[@tag=$tag]">
255
        <xsl:for-each select="marc:datafield[@tag=$tag]">
256
          <a>
256
          <a>
257
            <xsl:choose>
257
            <xsl:choose>
258
              <xsl:when test="marc:subfield[@code=9]">
258
              <xsl:when test="marc:subfield[@code=$AuthoritySubfieldLink]">
259
                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
259
                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
260
              </xsl:when>
260
              </xsl:when>
261
              <xsl:otherwise>
261
              <xsl:otherwise>
262
                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=su:<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute>
262
                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=su:<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute>
Lines 295-304 Link Here
295
            <xsl:call-template name="addClassRtl" />
295
            <xsl:call-template name="addClassRtl" />
296
            <a>
296
            <a>
297
              <xsl:choose>
297
              <xsl:choose>
298
                <xsl:when test="marc:subfield[@code=9]">
298
                <xsl:when test="marc:subfield[@code=$AuthoritySubfieldLink]">
299
                  <xsl:attribute name="href">
299
                  <xsl:attribute name="href">
300
                    <xsl:text>/cgi-bin/koha/catalogue/search.pl?q=an:</xsl:text>
300
                    <xsl:text>/cgi-bin/koha/catalogue/search.pl?q=an:</xsl:text>
301
                    <xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/>
301
                    <xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/>
302
                  </xsl:attribute>
302
                  </xsl:attribute>
303
                </xsl:when>
303
                </xsl:when>
304
                <xsl:otherwise>
304
                <xsl:otherwise>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl (-12 / +12 lines)
Lines 712-719 Link Here
712
            <a>
712
            <a>
713
            <xsl:attribute name="class">subject</xsl:attribute>
713
            <xsl:attribute name="class">subject</xsl:attribute>
714
            <xsl:choose>
714
            <xsl:choose>
715
            <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
715
            <xsl:when test="marc:subfield[@code=$AuthoritySubfieldLink] and $UseAuthoritiesForTracings='1'">
716
                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
716
                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
717
            </xsl:when>
717
            </xsl:when>
718
            <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
718
            <!-- #1807 Strip unwanted parenthesis from subjects for searching -->
719
            <xsl:when test="$TraceSubjectSubdivisions='1'">
719
            <xsl:when test="$TraceSubjectSubdivisions='1'">
Lines 742-750 Link Here
742
            </xsl:call-template>
742
            </xsl:call-template>
743
            </a>
743
            </a>
744
            </span>
744
            </span>
745
            <xsl:if test="marc:subfield[@code=9]">
745
            <xsl:if test="marc:subfield[@code=$AuthoritySubfieldLink]">
746
                <a class='authlink'>
746
                <a class='authlink'>
747
                    <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
747
                    <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
748
                    <xsl:element name="i">
748
                    <xsl:element name="i">
749
                        <xsl:attribute name="class">fa fa-search</xsl:attribute>
749
                        <xsl:attribute name="class">fa fa-search</xsl:attribute>
750
                    </xsl:element>
750
                    </xsl:element>
Lines 765-772 Link Here
765
                    <xsl:for-each select="marc:datafield[@tag=655]">
765
                    <xsl:for-each select="marc:datafield[@tag=655]">
766
                        <a>
766
                        <a>
767
                            <xsl:choose>
767
                            <xsl:choose>
768
                                <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
768
                                <xsl:when test="marc:subfield[@code=$AuthoritySubfieldLink] and $UseAuthoritiesForTracings='1'">
769
                                    <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
769
                                    <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
770
                                </xsl:when>
770
                                </xsl:when>
771
                                <xsl:when test="$TraceSubjectSubdivisions='1'">
771
                                <xsl:when test="$TraceSubjectSubdivisions='1'">
772
                                    <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:call-template name="subfieldSelectSubject">
772
                                    <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:call-template name="subfieldSelectSubject">
Lines 788-797 Link Here
788
                            <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
788
                            <xsl:with-param name="subdivDelimiter">-- </xsl:with-param>
789
                        </xsl:call-template>
789
                        </xsl:call-template>
790
                        </a>
790
                        </a>
791
                        <xsl:if test="marc:subfield[@code=9]">
791
                        <xsl:if test="marc:subfield[@code=$AuthoritySubfieldLink]">
792
                            <xsl:text> </xsl:text>
792
                            <xsl:text> </xsl:text>
793
                            <a class='authlink'>
793
                            <a class='authlink'>
794
                                <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
794
                                <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
795
                                <xsl:element name="i">
795
                                <xsl:element name="i">
796
                                    <xsl:attribute name="class">fa fa-search</xsl:attribute>
796
                                    <xsl:attribute name="class">fa fa-search</xsl:attribute>
797
                                </xsl:element>
797
                                </xsl:element>
Lines 1649-1656 Link Here
1649
            </xsl:choose>
1649
            </xsl:choose>
1650
            <a>
1650
            <a>
1651
                <xsl:choose>
1651
                <xsl:choose>
1652
                    <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
1652
                    <xsl:when test="marc:subfield[@code=$AuthoritySubfieldLink] and $UseAuthoritiesForTracings='1'">
1653
                        <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:"<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/>"</xsl:attribute>
1653
                        <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:"<xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/>"</xsl:attribute>
1654
                    </xsl:when>
1654
                    </xsl:when>
1655
                    <xsl:otherwise>
1655
                    <xsl:otherwise>
1656
                        <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute>
1656
                        <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute>
Lines 1882-1890 Link Here
1882
                    </span>
1882
                    </span>
1883
                </xsl:if>
1883
                </xsl:if>
1884
            </a>
1884
            </a>
1885
            <xsl:if test="marc:subfield[@code=9]">
1885
            <xsl:if test="marc:subfield[@code=$AuthoritySubfieldLink]">
1886
                <a class='authlink'>
1886
                <a class='authlink'>
1887
                    <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
1887
                    <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
1888
                    <xsl:element name="i">
1888
                    <xsl:element name="i">
1889
                        <xsl:attribute name="class">fa fa-search</xsl:attribute>
1889
                        <xsl:attribute name="class">fa fa-search</xsl:attribute>
1890
                    </xsl:element>
1890
                    </xsl:element>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl (-6 / +6 lines)
Lines 206-214 Link Here
206
                                    <xsl:value-of select="$str"/>
206
                                    <xsl:value-of select="$str"/>
207
                                </a>
207
                                </a>
208
                            </xsl:when>
208
                            </xsl:when>
209
                           <xsl:when test="boolean($index) and boolean(marc:subfield[@code=9])">
209
                           <xsl:when test="boolean($index) and boolean(marc:subfield[@code=$AuthoritySubfieldLink])">
210
                                <a>
210
                                <a>
211
                                    <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of  select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
211
                                    <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of  select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
212
                                    <xsl:value-of select="$str"/>
212
                                    <xsl:value-of select="$str"/>
213
                                </a>
213
                                </a>
214
                            </xsl:when>
214
                            </xsl:when>
Lines 438-445 Link Here
438
                            </xsl:call-template>
438
                            </xsl:call-template>
439
                        </a>
439
                        </a>
440
                    </xsl:when>
440
                    </xsl:when>
441
                    <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
441
                    <xsl:when test="marc:subfield[@code=$AuthoritySubfieldLink] and $UseAuthoritiesForTracings='1'">
442
                        <a><xsl:attribute name="href"><xsl:value-of select="$searchurl"/>?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
442
                        <a><xsl:attribute name="href"><xsl:value-of select="$searchurl"/>?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
443
                            <xsl:call-template name="chopPunctuation">
443
                            <xsl:call-template name="chopPunctuation">
444
                                <xsl:with-param name="chopString">
444
                                <xsl:with-param name="chopString">
445
                                    <xsl:call-template name="subfieldSelect">
445
                                    <xsl:call-template name="subfieldSelect">
Lines 480-487 Link Here
480
                            </xsl:call-template>
480
                            </xsl:call-template>
481
                        </a>
481
                        </a>
482
                    </xsl:when>
482
                    </xsl:when>
483
                    <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
483
                    <xsl:when test="marc:subfield[@code=$AuthoritySubfieldLink] and $UseAuthoritiesForTracings='1'">
484
                        <a><xsl:attribute name="href"><xsl:value-of select="$searchurl"/>?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
484
                        <a><xsl:attribute name="href"><xsl:value-of select="$searchurl"/>?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
485
                            <xsl:call-template name="chopPunctuation">
485
                            <xsl:call-template name="chopPunctuation">
486
                                <xsl:with-param name="chopString">
486
                                <xsl:with-param name="chopString">
487
                                    <xsl:call-template name="subfieldSelect">
487
                                    <xsl:call-template name="subfieldSelect">
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/NORMARCslim2OPACDetail.xsl (-16 / +16 lines)
Lines 100-116 Link Here
100
        <xsl:for-each select="marc:datafield[@tag=100 or @tag=700]">
100
        <xsl:for-each select="marc:datafield[@tag=100 or @tag=700]">
101
        <a>
101
        <a>
102
        <xsl:choose>
102
        <xsl:choose>
103
            <xsl:when test="marc:subfield[@code=9]">
103
            <xsl:when test="marc:subfield[@code=$AuthoritySubfieldLink]">
104
                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
104
                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
105
            </xsl:when>
105
            </xsl:when>
106
            <xsl:otherwise>
106
            <xsl:otherwise>
107
            <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute>
107
            <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute>
108
            </xsl:otherwise>
108
            </xsl:otherwise>
109
        </xsl:choose>
109
        </xsl:choose>
110
        <xsl:call-template name="nameABCDQ"/></a>
110
        <xsl:call-template name="nameABCDQ"/></a>
111
        <xsl:if test="marc:subfield[@code=9]">
111
        <xsl:if test="marc:subfield[@code=$AuthoritySubfieldLink]">
112
            <a class='authlink'>
112
            <a class='authlink'>
113
                <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
113
                <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
114
                <xsl:element name="img">
114
                <xsl:element name="img">
115
                    <xsl:attribute name="src">/opac-tmpl/<xsl:value-of select="$theme"/>/images/filefind.png</xsl:attribute>
115
                    <xsl:attribute name="src">/opac-tmpl/<xsl:value-of select="$theme"/>/images/filefind.png</xsl:attribute>
116
                    <xsl:attribute name="style">vertical-align:middle</xsl:attribute>
116
                    <xsl:attribute name="style">vertical-align:middle</xsl:attribute>
Lines 126-142 Link Here
126
        <xsl:for-each select="marc:datafield[@tag=110 or @tag=710]">
126
        <xsl:for-each select="marc:datafield[@tag=110 or @tag=710]">
127
        <a>
127
        <a>
128
        <xsl:choose>
128
        <xsl:choose>
129
            <xsl:when test="marc:subfield[@code=9]">
129
            <xsl:when test="marc:subfield[@code=$AuthoritySubfieldLink]">
130
                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
130
                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
131
            </xsl:when>
131
            </xsl:when>
132
            <xsl:otherwise>
132
            <xsl:otherwise>
133
            <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute>
133
            <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute>
134
            </xsl:otherwise>
134
            </xsl:otherwise>
135
        </xsl:choose>
135
        </xsl:choose>
136
        <xsl:call-template name="nameABCDN"/></a>
136
        <xsl:call-template name="nameABCDN"/></a>
137
        <xsl:if test="marc:subfield[@code=9]">
137
        <xsl:if test="marc:subfield[@code=$AuthoritySubfieldLink]">
138
            <a class='authlink'>
138
            <a class='authlink'>
139
                <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
139
                <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
140
                <xsl:element name="img">
140
                <xsl:element name="img">
141
                    <xsl:attribute name="src">/opac-tmpl/<xsl:value-of select="$theme"/>/images/filefind.png</xsl:attribute>
141
                    <xsl:attribute name="src">/opac-tmpl/<xsl:value-of select="$theme"/>/images/filefind.png</xsl:attribute>
142
                    <xsl:attribute name="style">vertical-align:middle</xsl:attribute>
142
                    <xsl:attribute name="style">vertical-align:middle</xsl:attribute>
Lines 151-167 Link Here
151
        <xsl:for-each select="marc:datafield[@tag=111 or @tag=711]">
151
        <xsl:for-each select="marc:datafield[@tag=111 or @tag=711]">
152
        <a>
152
        <a>
153
        <xsl:choose>
153
        <xsl:choose>
154
            <xsl:when test="marc:subfield[@code=9]">
154
            <xsl:when test="marc:subfield[@code=$AuthoritySubfieldLink]">
155
                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
155
                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
156
            </xsl:when>
156
            </xsl:when>
157
            <xsl:otherwise>
157
            <xsl:otherwise>
158
            <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute>
158
            <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=au:<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/></xsl:attribute>
159
            </xsl:otherwise>
159
            </xsl:otherwise>
160
        </xsl:choose>
160
        </xsl:choose>
161
        <xsl:call-template name="nameACDEQ"/></a>
161
        <xsl:call-template name="nameACDEQ"/></a>
162
        <xsl:if test="marc:subfield[@code=9]">
162
        <xsl:if test="marc:subfield[@code=$AuthoritySubfieldLink]">
163
            <a class='authlink'>
163
            <a class='authlink'>
164
                <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
164
                <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
165
                <xsl:element name="img">
165
                <xsl:element name="img">
166
                    <xsl:attribute name="src">/opac-tmpl/<xsl:value-of select="$theme"/>/images/filefind.png</xsl:attribute>
166
                    <xsl:attribute name="src">/opac-tmpl/<xsl:value-of select="$theme"/>/images/filefind.png</xsl:attribute>
167
                    <xsl:attribute name="style">vertical-align:middle</xsl:attribute>
167
                    <xsl:attribute name="style">vertical-align:middle</xsl:attribute>
Lines 436-443 Link Here
436
            <a>
436
            <a>
437
            <xsl:choose>
437
            <xsl:choose>
438
            <!-- Will implement this later
438
            <!-- Will implement this later
439
                <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'">
439
                <xsl:when test="marc:subfield[@code=$AuthoritySubfieldLink] and $UseAuthoritiesForTracings='1'">
440
                    <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
440
                    <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
441
                </xsl:when>
441
                </xsl:when>
442
            -->
442
            -->
443
            <xsl:when test="$TraceSubjectSubdivisions='1'">
443
            <xsl:when test="$TraceSubjectSubdivisions='1'">
Lines 463-471 Link Here
463
                </xsl:with-param>
463
                </xsl:with-param>
464
            </xsl:call-template>
464
            </xsl:call-template>
465
            </a>
465
            </a>
466
            <xsl:if test="marc:subfield[@code=9]">
466
            <xsl:if test="marc:subfield[@code=$AuthoritySubfieldLink]">
467
                <a class='authlink'>
467
                <a class='authlink'>
468
                    <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
468
                    <xsl:attribute name="href">/cgi-bin/koha/opac-authoritiesdetail.pl?authid=<xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
469
                    <xsl:element name="img">
469
                    <xsl:element name="img">
470
                        <xsl:attribute name="src">/opac-tmpl/<xsl:value-of select="$theme"/>/images/filefind.png</xsl:attribute>
470
                        <xsl:attribute name="src">/opac-tmpl/<xsl:value-of select="$theme"/>/images/filefind.png</xsl:attribute>
471
                        <xsl:attribute name="style">vertical-align:middle</xsl:attribute>
471
                        <xsl:attribute name="style">vertical-align:middle</xsl:attribute>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/NORMARCslimUtils.xsl (-2 / +2 lines)
Lines 228-236 Link Here
228
                                    <xsl:value-of select="$str"/>
228
                                    <xsl:value-of select="$str"/>
229
                                </a>
229
                                </a>
230
                            </xsl:when>
230
                            </xsl:when>
231
                           <xsl:when test="boolean($index) and boolean(marc:subfield[@code=9])">
231
                           <xsl:when test="boolean($index) and boolean(marc:subfield[@code=$AuthoritySubfieldLink])">
232
                                <a>
232
                                <a>
233
                                    <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of  select="str:encode-uri(marc:subfield[@code=9], true())"/></xsl:attribute>
233
                                    <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of  select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/></xsl:attribute>
234
                                    <xsl:value-of select="$str"/>
234
                                    <xsl:value-of select="$str"/>
235
                                </a>
235
                                </a>
236
                            </xsl:when>
236
                            </xsl:when>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslimUtils.xsl (-6 / +6 lines)
Lines 241-253 Link Here
241
241
242
  <xsl:template name="tag_onesubject">
242
  <xsl:template name="tag_onesubject">
243
    <xsl:choose>
243
    <xsl:choose>
244
      <xsl:when test="marc:subfield[@code=9]">
244
      <xsl:when test="marc:subfield[@code=$AuthoritySubfieldLink]">
245
        <xsl:for-each select="marc:subfield">
245
        <xsl:for-each select="marc:subfield">
246
          <xsl:if test="@code='9'">
246
          <xsl:if test="@code=$AuthoritySubfieldLink">
247
            <xsl:variable name="start" select="position()"/>
247
            <xsl:variable name="start" select="position()"/>
248
            <xsl:variable name="ends">
248
            <xsl:variable name="ends">
249
              <xsl:for-each select="../marc:subfield[position() &gt; $start]">
249
              <xsl:for-each select="../marc:subfield[position() &gt; $start]">
250
                <xsl:if test="@code=9">
250
                <xsl:if test="@code=$AuthoritySubfieldLink">
251
                  <xsl:variable name="end" select="position() + $start"/>
251
                  <xsl:variable name="end" select="position() + $start"/>
252
                  <xsl:value-of select="$end"/>
252
                  <xsl:value-of select="$end"/>
253
                  <xsl:text>,</xsl:text>
253
                  <xsl:text>,</xsl:text>
Lines 357-366 Link Here
357
          <xsl:for-each select="marc:datafield[@tag=$tag]">
357
          <xsl:for-each select="marc:datafield[@tag=$tag]">
358
            <a>
358
            <a>
359
              <xsl:choose>
359
              <xsl:choose>
360
                <xsl:when test="marc:subfield[@code=9]">
360
                <xsl:when test="marc:subfield[@code=$AuthoritySubfieldLink]">
361
                  <xsl:attribute name="href">
361
                  <xsl:attribute name="href">
362
                    <xsl:text>/cgi-bin/koha/opac-search.pl?q=an:</xsl:text>
362
                    <xsl:text>/cgi-bin/koha/opac-search.pl?q=an:</xsl:text>
363
                    <xsl:value-of select="str:encode-uri(marc:subfield[@code=9], true())"/>
363
                    <xsl:value-of select="str:encode-uri(marc:subfield[@code=$AuthoritySubfieldLink], true())"/>
364
                  </xsl:attribute>
364
                  </xsl:attribute>
365
                </xsl:when>
365
                </xsl:when>
366
                <xsl:otherwise>
366
                <xsl:otherwise>
Lines 374-380 Link Here
374
              </xsl:choose>
374
              </xsl:choose>
375
              <xsl:for-each select="marc:subfield[@code='a' or @code='b' or @code='4' or @code='c' or @code='d' or @code='f' or @code='g' or @code='p']">
375
              <xsl:for-each select="marc:subfield[@code='a' or @code='b' or @code='4' or @code='c' or @code='d' or @code='f' or @code='g' or @code='p']">
376
                <xsl:choose>
376
                <xsl:choose>
377
                  <xsl:when test="@code='9'">
377
                  <xsl:when test="@code=$AuthoritySubfieldLink">
378
                  </xsl:when>
378
                  </xsl:when>
379
                  <xsl:otherwise>
379
                  <xsl:otherwise>
380
                    <xsl:value-of select="."/>
380
                    <xsl:value-of select="."/>
(-)a/misc/maintenance/batchAuthorityLinking.pl (+274 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
#-----------------------------------
4
# Copyright 2019 Koha-Suomi Oy
5
#
6
# This file is part of Koha.
7
#
8
# Koha is free software; you can redistribute it and/or modify it under the
9
# terms of the GNU General Public License as published by the Free Software
10
# Foundation; either version 2 of the License, or (at your option) any later
11
# version.
12
#
13
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License along
18
# with Koha; if not, write to the Free Software Foundation, Inc.,
19
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
#-----------------------------------
21
22
use Modern::Perl;
23
use Getopt::Long;
24
25
use C4::Context;
26
use C4::Biblio;
27
use C4::Record;
28
use MARC::Field;
29
30
use Koha::Authorities;
31
32
my ($help, $confirm, $verbose);
33
my $schema = 'MARC21';
34
my $chunks = 500;
35
my $authsubfield = Koha::Authorities->authority_linking_subfield;
36
my $oldsubfield;
37
38
GetOptions(
39
  'h|help'      => \$help,
40
  'v|verbose:i' => \$verbose,
41
  'c|confirm'   => \$confirm,
42
  's|schema:s'  => \$schema,
43
  'o|oldsubfield:s'  => \$oldsubfield,
44
  'chunks:i'    => \$chunks,
45
);
46
47
my $usage = << 'ENDUSAGE';
48
49
Changes authority linking subfield from $9 to $0
50
51
  -h --help          This nice help!
52
53
  -v --verbose      More chatty output.
54
55
  -c --confirm      Confirm that you want to mangle your bibliographic records
56
57
  -s --schema      Select MARC schema, MARC21, UNIMARC or NORMARC. Default is MARC21
58
59
  -o --oldsubfield  Define old ayhtority linking subfield value
60
61
  --chunks          Increase processed chunks
62
63
64
EXAMPLE:
65
66
perl batchAuthorityLinking.pl -v -c
67
perl batchAuthorityLinking.pl -v -c -s NORMARC -o 9
68
perl batchAuthorityLinking.pl -v --chunks 1000
69
70
ENDUSAGE
71
72
if ($help) {
73
    print $usage;
74
    exit 0;
75
}
76
77
our $marc21Authorityfields = {
78
    '100' => 1,
79
    '110' => 1,
80
    '111' => 1,
81
    '130' => 1,
82
    '245' => 1,
83
    '400' => 1,
84
    '410' => 1,
85
    '440' => 1,
86
    '490' => 1,
87
    '600' => 1,
88
    '610' => 1,
89
    '611' => 1,
90
    '630' => 1,
91
    '648' => 1,
92
    '650' => 1,
93
    '651' => 1,
94
    '652' => 1,
95
    '653' => 1,
96
    '654' => 1,
97
    '655' => 1,
98
    '656' => 1,
99
    '657' => 1,
100
    '662' => 1,
101
    '690' => 1,
102
    '691' => 1,
103
    '696' => 1,
104
    '697' => 1,
105
    '698' => 1,
106
    '699' => 1,
107
    '700' => 1,
108
    '710' => 1,
109
    '711' => 1,
110
    '730' => 1,
111
    '751' => 1,
112
    '796' => 1,
113
    '797' => 1,
114
    '798' => 1,
115
    '799' => 1,
116
    '800' => 1,
117
    '810' => 1,
118
    '811' => 1,
119
    '830' => 1,
120
    '896' => 1,
121
    '897' => 1,
122
    '898' => 1,
123
    '899' => 1
124
};
125
126
our $normarcAuthorityfields = {
127
    '100' => 1,
128
    '110' => 1,
129
    '111' => 1,
130
    '130' => 1,
131
    '245' => 1,
132
    '440' => 1,
133
    '490' => 1,
134
    '600' => 1,
135
    '610' => 1,
136
    '611' => 1,
137
    '630' => 1,
138
    '650' => 1,
139
    '651' => 1,
140
    '652' => 1,
141
    '653' => 1,
142
    '654' => 1,
143
    '655' => 1,
144
    '656' => 1,
145
    '657' => 1,
146
    '690' => 1,
147
    '700' => 1,
148
    '710' => 1,
149
    '711' => 1,
150
    '730' => 1,
151
    '800' => 1,
152
    '810' => 1,
153
    '811' => 1,
154
    '830' => 1
155
};
156
157
our $unimarcAuthorityfields = {
158
    '500' => 1,
159
    '501' => 1,
160
    '503' => 1,
161
    '510' => 1,
162
    '512' => 1,
163
    '513' => 1,
164
    '514' => 1,
165
    '515' => 1,
166
    '516' => 1,
167
    '517' => 1,
168
    '518' => 1,
169
    '519' => 1,
170
    '520' => 1,
171
    '530' => 1,
172
    '531' => 1,
173
    '532' => 1,
174
    '540' => 1,
175
    '541' => 1,
176
    '545' => 1,
177
    '560' => 1,
178
    '600' => 1,
179
    '601' => 1,
180
    '602' => 1,
181
    '604' => 1,
182
    '605' => 1,
183
    '606' => 1,
184
    '607' => 1,
185
    '608' => 1,
186
    '610' => 1,
187
    '615' => 1,
188
    '616' => 1,
189
    '617' => 1,
190
    '620' => 1,
191
    '621' => 1,
192
    '700' => 1,
193
    '701' => 1,
194
    '702' => 1,
195
    '710' => 1,
196
    '711' => 1,
197
    '712' => 1,
198
    '716' => 1,
199
    '720' => 1,
200
    '721' => 1,
201
    '722' => 1,
202
    '730' => 1
203
};
204
205
my $params = {
206
    chunks => $chunks,
207
    page => 1
208
};
209
210
211
my $pageCount = 1;
212
my $authorityfields;
213
214
if ($schema eq 'NORMARC') {
215
    $authorityfields = $normarcAuthorityfields;
216
} elsif ($schema eq 'UNIMARC') {
217
    $authorityfields = $normarcAuthorityfields;
218
} else {
219
    $authorityfields = $marc21Authorityfields;
220
}
221
222
223
while ($pageCount >= $params->{page}) {
224
    my $biblios = biblios($params);
225
    my $count = 0;
226
    my $lastnumber = 0;
227
    foreach my $biblio (@{$biblios}) {
228
        my $record = C4::Record::marcxml2marc($biblio->{metadata});
229
        foreach my $field ($record->fields) {
230
            my @subfield_data;
231
            if ($authorityfields->{$field->tag}) {
232
                if ($field->subfields) {
233
                    for my $subfield ($field->subfields) {
234
                        if ($subfield->[0] eq $oldsubfield) {
235
                            $subfield->[0] = $authsubfield;
236
                            print "Change $schema $oldsubfield field to $authsubfield from ".$biblio->{biblionumber}."\n" if (defined $verbose);
237
                        }
238
                        push @subfield_data, $subfield->[0], $subfield->[1];
239
                    }
240
                }
241
            }
242
            $field->replace_with(MARC::Field->new(
243
                $field->tag(), $field->indicator(1), $field->indicator(2),
244
                @subfield_data)
245
            ) if @subfield_data; 
246
        }
247
        my $frameworkcode = C4::Biblio::GetFrameworkCode( $biblio->{biblionumber} );
248
        C4::Biblio::ModBiblio($record, $biblio->{biblionumber}, $frameworkcode) if $confirm;
249
        $count++;
250
        $lastnumber = $biblio->{biblionumber};
251
    }
252
    print "last processed biblio $lastnumber\n";
253
    print "$count biblios processed!\n";
254
    if ($count eq $params->{chunks}) {
255
        $pageCount++;
256
        $params->{page} = $pageCount;
257
    } else {
258
        $pageCount = 0;
259
    }
260
}
261
262
sub biblios {
263
    my ($params) = @_;
264
    print "Starting to change offset $params->{page}!\n";
265
    my $biblios = Koha::Biblio::Metadatas->search({format => 'marcxml', schema => $schema},
266
    {
267
        page => $params->{page},
268
        rows => $params->{chunks}
269
    }
270
    )->unblessed;
271
272
    return $biblios;
273
274
}
(-)a/t/db_dependent/Koha/Authorities.t (-1 / +24 lines)
Lines 193-198 unimarc,*,ind1:auth2,ind2:auth1|); Link Here
193
    is( $auth->controlled_indicators({ biblio_tag => '456' })->{ind2}, '1', 'UNIMARC: Swapped ind1' );
193
    is( $auth->controlled_indicators({ biblio_tag => '456' })->{ind2}, '1', 'UNIMARC: Swapped ind1' );
194
};
194
};
195
195
196
subtest 'Test linking subfield syspref' => sub {
197
    plan tests => 4;
198
199
    t::lib::Mocks::mock_preference( 'AuthoritySubfieldLink', '9' );
200
    my $authsubfield = Koha::Authorities->authority_linking_subfield;
201
    is( $authsubfield, '9', 'Authority subfield link is 9' );
202
    my $record = MARC::Record->new;
203
    $record->append_fields(
204
        MARC::Field->new( '110', '', '', $authsubfield => '202' )
205
    );
206
    is( $record->field('110')->subfield($authsubfield), '202', 'Subfield 9 value is 202' );
207
208
    t::lib::Mocks::mock_preference( 'AuthoritySubfieldLink', '0' );
209
    $authsubfield = Koha::Authorities->authority_linking_subfield;
210
    is( $authsubfield, '0', 'Authority subfield link is 0' );
211
    $record = MARC::Record->new;
212
    $record->append_fields(
213
        MARC::Field->new( '110', '', '', $authsubfield => '203' )
214
    );
215
    is( $record->field('110')->subfield($authsubfield), '203', 'Subfield 0 value is 203' );
216
217
};
218
196
sub simple_search_compat {
219
sub simple_search_compat {
197
    if( $search_compat_pars->[0] == 0 ) {
220
    if( $search_compat_pars->[0] == 0 ) {
198
        return ( $search_compat_pars->[1], [], 0 );
221
        return ( $search_compat_pars->[1], [], 0 );
Lines 205-210 sub simple_search_compat { Link Here
205
}
228
}
206
229
207
sub few_marcxml_records {
230
sub few_marcxml_records {
231
    my ($authsubfield) = @_;
208
    return [
232
    return [
209
q|<?xml version="1.0" encoding="UTF-8"?>
233
q|<?xml version="1.0" encoding="UTF-8"?>
210
<record xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.loc.gov/MARC21/slim" xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd">
234
<record xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.loc.gov/MARC21/slim" xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd">
211
- 

Return to bug 17511