From 471712625b3f5c727333409f9589a0b936d26cc0 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 21 Oct 2021 10:26:12 +0000 Subject: [PATCH] Bug 29284: (follow-up) Improve error logging to prevent warns Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall (cherry picked from commit cf29caf39fed2d81262735fe7893a1ac3a8d59b1) Signed-off-by: Victor Grousset/tuxayo --- Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 1 + catalogue/detail.pl | 7 +++++-- opac/opac-detail.pl | 7 +++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm index 01b62be4e8..9627a3f6ce 100644 --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm @@ -986,6 +986,7 @@ sub clean_search_term { $term =~ s/((?param( analytics_error => 1 ); } my $variables = { - show_analytics_link => $count > 0 ? 1 : 0 + show_analytics_link => defined $count && $count > 0 ? 1 : 0 }; $template->param( diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index e07143a751..b5cccc04bd 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -196,12 +196,15 @@ if ( $xslfile ) { $searcher->simple_search_compat( $query, 0, 0 ); }; if ($err || $@){ - warn "Warning from simple_search_compat: $err.$@"; + my $error = q{}; + $error .= $err if $err; + $error .= $@ if $@; + warn "Warning from simple_search_compat: $error"; } my $variables = { anonymous_session => ($borrowernumber) ? 0 : 1, - show_analytics_link => $count > 0 ? 1 : 0 + show_analytics_link => defined $count && $count > 0 ? 1 : 0 }; my @plugin_responses = Koha::Plugins->call( -- 2.39.5