From 9cf301ac6ff5d1d39881fa41f316d3e48c81a2db 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 --- 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 76b4dbc6b4..607634c405 100644 --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm @@ -986,6 +986,7 @@ sub clean_search_term { $term =~ s/((?preference("marcflavour"); }; 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"; $template->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 36c64d4f60..9e12ef8cc4 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -217,12 +217,15 @@ my $ean = GetNormalizedEAN( $record, $marcflavour ); }; 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 $lang = C4::Languages::getlanguage(); -- 2.39.5