Lines 20-27
package Koha::Authority::ControlledIndicators;
Link Here
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
use C4::Context; |
21 |
use C4::Context; |
22 |
|
22 |
|
23 |
our $cached_indicators; |
|
|
24 |
|
25 |
=head1 NAME |
23 |
=head1 NAME |
26 |
|
24 |
|
27 |
Koha::Authority::ControlledIndicators - Obtain biblio indicators, controlled by authority record |
25 |
Koha::Authority::ControlledIndicators - Obtain biblio indicators, controlled by authority record |
Lines 39-45
Koha::Authority::ControlledIndicators - Obtain biblio indicators, controlled by
Link Here
|
39 |
sub new { |
37 |
sub new { |
40 |
my ( $class, $params ) = @_; |
38 |
my ( $class, $params ) = @_; |
41 |
$params = {} if ref($params) ne 'HASH'; |
39 |
$params = {} if ref($params) ne 'HASH'; |
42 |
$cached_indicators = undef; |
|
|
43 |
return bless $params, $class; |
40 |
return bless $params, $class; |
44 |
} |
41 |
} |
45 |
|
42 |
|
Lines 66-76
sub get {
Link Here
|
66 |
$flavour = uc($flavour); |
63 |
$flavour = uc($flavour); |
67 |
$flavour = 'UNIMARC' if $flavour eq 'UNIMARCAUTH'; |
64 |
$flavour = 'UNIMARC' if $flavour eq 'UNIMARCAUTH'; |
68 |
|
65 |
|
69 |
$cached_indicators //= _load_pref(); |
66 |
$self->{_parsed} //= _load_pref(); |
70 |
my $result = {}; |
67 |
my $result = {}; |
71 |
return $result if !exists $cached_indicators->{$flavour}; |
68 |
return $result if !exists $self->{_parsed}->{$flavour}; |
72 |
my $rule = $cached_indicators->{$flavour}->{$tag} // |
69 |
my $rule = $self->{_parsed}->{$flavour}->{$tag} // |
73 |
$cached_indicators->{$flavour}->{'*'} // |
70 |
$self->{_parsed}->{$flavour}->{'*'} // |
74 |
{}; |
71 |
{}; |
75 |
my $report_fld = $record ? $record->field( $report_tag ) : undef; |
72 |
my $report_fld = $record ? $record->field( $report_tag ) : undef; |
76 |
|
73 |
|
Lines 146-162
sub _thesaurus_info {
Link Here
|
146 |
return ( $ind, $sub2 ); |
143 |
return ( $ind, $sub2 ); |
147 |
} |
144 |
} |
148 |
|
145 |
|
149 |
=head3 clear |
|
|
150 |
|
151 |
Clear internal cache. |
152 |
|
153 |
=cut |
154 |
|
155 |
sub clear { |
156 |
my ( $self, $params ) = @_; |
157 |
$cached_indicators = undef; |
158 |
} |
159 |
|
160 |
=head1 AUTHOR |
146 |
=head1 AUTHOR |
161 |
|
147 |
|
162 |
Marcel de Rooy, Rijksmuseum Amsterdam, The Netherlands |
148 |
Marcel de Rooy, Rijksmuseum Amsterdam, The Netherlands |