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

(-)a/C4/Heading.pm (-2 / +24 lines)
Lines 148-154 sub authorities { Link Here
148
    my $self         = shift;
148
    my $self         = shift;
149
    my $skipmetadata = shift;
149
    my $skipmetadata = shift;
150
    my ( $results, $total ) = _search( $self, 'match-heading', $skipmetadata );
150
    my ( $results, $total ) = _search( $self, 'match-heading', $skipmetadata );
151
    return $results;
151
    return $self->_filter_exact($results);
152
}
152
}
153
153
154
=head2 preferred_authorities
154
=head2 preferred_authorities
Lines 266-271 sub _search { Link Here
266
266
267
}
267
}
268
268
269
=head2 _filter_exact
270
271
=cut
272
273
sub _filter_exact {
274
    my $self                = shift;
275
    my $results             = shift;
276
    my $exact_matched_auths = [];
277
    for my $matched_auth (@$results) {
278
        my $auth = Koha::Authorities->find( $matched_auth->{authid} );
279
        next unless $auth;
280
        my $authrec            = $auth->record;
281
        my $auth_tag_to_report = Koha::Authority::Types->find( $self->{auth_type} )->auth_tag_to_report;
282
        my $auth_heading_field = $authrec->field($auth_tag_to_report);
283
        $auth_heading_field->set_tag( $self->field->tag );
284
        my $auth_heading = C4::Heading->new_from_field($auth_heading_field);
285
        if ( $auth_heading->search_form eq $self->search_form ) {
286
            push @$exact_matched_auths, $matched_auth;
287
        }
288
    }
289
    return $exact_matched_auths;
290
}
291
269
=head1 INTERNAL FUNCTIONS
292
=head1 INTERNAL FUNCTIONS
270
293
271
=head2 _marc_format_handler
294
=head2 _marc_format_handler
272
- 

Return to bug 38729