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

(-)a/Koha/Authority.pm (-1 / +50 lines)
Lines 20-25 package Koha::Authority; Link Here
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use base qw(Koha::Object);
22
use base qw(Koha::Object);
23
24
use Koha::Authority::BiblioIndicators;
23
use Koha::SearchEngine::Search;
25
use Koha::SearchEngine::Search;
24
26
25
=head1 NAME
27
=head1 NAME
Lines 59-64 sub linked_biblionumbers { Link Here
59
    return Koha::Authorities->linked_biblionumbers( $params );
61
    return Koha::Authorities->linked_biblionumbers( $params );
60
}
62
}
61
63
64
=head3 controlled_biblio_indicators
65
66
    Some authority types control the indicators of some corresponding
67
    biblio fields (especially in MARC21).
68
    For example, if you have a PERSO_NAME authority (report tag 100), the
69
    first indicator of biblio field 600 directly comes from the authority,
70
    and the second indicator depends on thesaurus settings in the authority
71
    record. Use this method to obtain such controlled values. In this example
72
    you should pass 600 in the biblio_tag parameter.
73
74
    my $result = $self->controlled_biblio_indicators({
75
        record => $auth_marc, biblio_tag => $bib_tag
76
    });
77
    my $ind1 = $result->{ind1};
78
    my $ind2 = $result->{ind2};
79
80
    If an indicator is not controlled, the result hash does not contain a key
81
    for its value.
82
83
    Note: The record parameter is a temporary bypass in order to prevent
84
    needless conversion of $self->marcxml.
85
86
=cut
87
88
sub controlled_biblio_indicators {
89
    my ( $self, $params ) = @_;
90
    my $tag = $params->{biblio_tag} // q{};
91
    my $record = $params->{record};
92
93
    my $flavour = C4::Context->preference('marcflavour') eq 'UNIMARC'
94
        ? 'UNIMARCAUTH'
95
        : 'MARC21';
96
    if( !$record ) {
97
        $record = MARC::Record->new_from_xml(
98
            $self->marcxml, 'UTF-8', $flavour );
99
    }
100
101
    my $authtype = Koha::Authority::Types->find( $self->authtypecode );
102
    return {} if !$authtype;
103
104
    return Koha::Authority::BiblioIndicators->new->get({
105
        auth_record => $record,
106
        report_tag  => $authtype->auth_tag_to_report,
107
        biblio_tag  => $tag,
108
        flavour     => $flavour,
109
    });
110
}
111
62
=head2 Class Methods
112
=head2 Class Methods
63
113
64
=head3 type
114
=head3 type
65
- 

Return to bug 14769