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

(-)a/C4/Heading.pm (-2 / +21 lines)
Lines 232-238 sub _search { Link Here
232
        && none { $_ eq $thesaurus } (
232
        && none { $_ eq $thesaurus } (
233
            'lcsh',         'lcac', 'mesh', 'nal',
233
            'lcsh',         'lcac', 'mesh', 'nal',
234
            'notspecified', 'cash', 'rvm',  'sears',
234
            'notspecified', 'cash', 'rvm',  'sears',
235
            'aat'
235
            'aat',          'notdefined'
236
        )
236
        )
237
        )
237
        )
238
    {
238
    {
Lines 244-249 sub _search { Link Here
244
            'AuthidAsc'
244
            'AuthidAsc'
245
        );
245
        );
246
        ( $matched_auths, $total ) = $searcher->search_auth_compat( $search_query, 0, 20, $skipmetadata );
246
        ( $matched_auths, $total ) = $searcher->search_auth_compat( $search_query, 0, 20, $skipmetadata );
247
248
        # We have to make sure that we do not link with an authority record
249
        # controlling the same term but from a different thesaurus.
250
        # This means we have to check the content of 040 $f of the authority record.
251
        my $matched_auths_exact = [];
252
        for my $matched_auth (@$matched_auths) {
253
            my $auth = Koha::Authorities->find( $matched_auth->{authid} );
254
            unless ($auth) {
255
                $total--;
256
                next;
257
            }
258
            my $auth_rec = $auth->record;
259
            my $s040f    = $auth_rec->subfield( '040', 'f' ) // '';
260
            if ( !$s040f || $s040f eq $thesaurus ) {
261
                push @{$matched_auths_exact}, $matched_auth;
262
            } else {
263
                $total--;
264
            }
265
        }
266
        $matched_auths = $matched_auths_exact;
247
    }
267
    }
248
    return ( $matched_auths, $total );
268
    return ( $matched_auths, $total );
249
269
250
- 

Return to bug 39503