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

(-)a/Koha/Biblio.pm (-1 / +15 lines)
Lines 498-504 sub get_marc_components { Link Here
498
    my $components;
498
    my $components;
499
    if (defined($searchstr)) {
499
    if (defined($searchstr)) {
500
        my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX});
500
        my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX});
501
        my ( $errors, $results, $total_hits ) = $searcher->simple_search_compat( $searchstr, 0, $max_results );
501
        my ( $error, $results, $total_hits );
502
        eval {
503
            ( $error, $results, $total_hits ) = $searcher->simple_search_compat( $searchstr, 0, $max_results );
504
        };
505
        if( $error || $@ ) {
506
            $error //= q{};
507
            $error .= $@ if $@;
508
            warn "Warning from simple_search_compat: $error";
509
            $self->add_message(
510
                {
511
                    type    => 'error',
512
                    message => 'component_search',
513
                }
514
            );
515
        }
502
        $components = $results if defined($results) && @$results;
516
        $components = $results if defined($results) && @$results;
503
    }
517
    }
504
518
(-)a/catalogue/detail.pl (-1 / +3 lines)
Lines 200-206 my $showcomp = C4::Context->preference('ShowComponentRecords'); Link Here
200
my $show_analytics;
200
my $show_analytics;
201
if ( $showcomp eq 'both' || $showcomp eq 'staff' ) {
201
if ( $showcomp eq 'both' || $showcomp eq 'staff' ) {
202
    if ( my $components = $biblio->get_marc_components(C4::Context->preference('MaxComponentRecords')) ) {
202
    if ( my $components = $biblio->get_marc_components(C4::Context->preference('MaxComponentRecords')) ) {
203
        $show_analytics = 1; # just show link when having results
203
        $show_analytics = 1 if @{$components}; # just show link when having results
204
        $template->param( analytics_error => 1 ) if @{$biblio->messages};
204
        my $parts;
205
        my $parts;
205
        for my $part ( @{$components} ) {
206
        for my $part ( @{$components} ) {
206
            $part = C4::Search::new_record_from_zebra( 'biblioserver', $part );
207
            $part = C4::Search::new_record_from_zebra( 'biblioserver', $part );
Lines 221-226 if ( $showcomp eq 'both' || $showcomp eq 'staff' ) { Link Here
221
    }
222
    }
222
} else { # check if we should show analytics anyway
223
} else { # check if we should show analytics anyway
223
    $show_analytics = 1 if @{$biblio->get_marc_components(1)}; # count matters here, results does not
224
    $show_analytics = 1 if @{$biblio->get_marc_components(1)}; # count matters here, results does not
225
    $template->param( analytics_error => 1 ) if @{$biblio->messages};
224
}
226
}
225
227
226
# XSLT processing of some stuff
228
# XSLT processing of some stuff
(-)a/opac/opac-detail.pl (-2 / +1 lines)
Lines 630-636 my $showcomp = C4::Context->preference('ShowComponentRecords'); Link Here
630
my ( $parts, $show_analytics );
630
my ( $parts, $show_analytics );
631
if ( $showcomp eq 'both' || $showcomp eq 'opac' ) {
631
if ( $showcomp eq 'both' || $showcomp eq 'opac' ) {
632
    if ( my $components = $biblio->get_marc_components(C4::Context->preference('MaxComponentRecords')) ) {
632
    if ( my $components = $biblio->get_marc_components(C4::Context->preference('MaxComponentRecords')) ) {
633
        $show_analytics = 1; # just show link when having results
633
        $show_analytics = 1 if @{$components}; # just show link when having results
634
        for my $part ( @{$components} ) {
634
        for my $part ( @{$components} ) {
635
            $part = C4::Search::new_record_from_zebra( 'biblioserver', $part );
635
            $part = C4::Search::new_record_from_zebra( 'biblioserver', $part );
636
            my $id = Koha::SearchEngine::Search::extract_biblionumber( $part );
636
            my $id = Koha::SearchEngine::Search::extract_biblionumber( $part );
637
- 

Return to bug 11175