@@ -, +, @@ --- C4/AuthoritiesMarc.pm | 2 +- Koha/Authority.pm | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) --- a/C4/AuthoritiesMarc.pm +++ a/C4/AuthoritiesMarc.pm @@ -1471,7 +1471,7 @@ sub merge { my $newtag = $tags_new && @$tags_new ? _merge_newtag( $tag, $tags_new ) : $tag; - my $controlled_ind = Koha::Authority->new({ authtypecode => $authtypeto ? $authtypeto->authtypecode : undef })->controlled_indicators({ record => $MARCto, biblio_tag => $newtag }); #FIXME Replace this tric with new when refactoring + my $controlled_ind = $authto->controlled_indicators({ record => $MARCto, biblio_tag => $newtag }); my $field_to = MARC::Field->new( $newtag, $controlled_ind->{ind1} // $field->indicator(1), --- a/Koha/Authority.pm +++ a/Koha/Authority.pm @@ -99,12 +99,16 @@ sub controlled_indicators { $self->marcxml, 'UTF-8', $flavour ); } - my $authtype = Koha::Authority::Types->find( $self->authtypecode ); - return {} if !$authtype; + if( !$self->{_report_tag} ) { + my $authtype = Koha::Authority::Types->find( $self->authtypecode ); + return {} if !$authtype; # very exceptional + $self->{_report_tag} = $authtype->auth_tag_to_report; + } - return Koha::Authority::ControlledIndicators->new->get({ + $self->{_ControlledInds} //= Koha::Authority::ControlledIndicators->new; + return $self->{_ControlledInds}->get({ auth_record => $record, - report_tag => $authtype->auth_tag_to_report, + report_tag => $self->{_report_tag}, biblio_tag => $tag, flavour => $flavour, }); --