Bug 29284: Don't die on analytics searching error
This patch adds an eval around the call to search for analytic records
It pases a value to the template on the staff side, but logs the warning on
the opac
This seems similar to 'decoding_error' which is noted on staff side, but absent on OPAC
The eval follows the patter used during searching
To test:
1 - Add a title to catalog, with 245a:
Digger does it all (not really!)
2 - Set searchEngine preference to: Elasticsearch
3 - The record does not load
4 - Apply patch
5 - The record loads, there is a note about analytics at the top fo the record
6 - View record in opac, no note
7 - Check logs on intranet and opac, searching error is logged
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
707a01380c
commit
f0bcbce767
|
|
@ -140,10 +140,16 @@ my $marcflavour = C4::Context->preference("marcflavour");
|
|||
( C4::Context->preference('UseControlNumber') and $record->field('001') )
|
||||
? 'rcn:'. $record->field('001')->data . ' AND (bib-level:a OR bib-level:b)'
|
||||
: "Host-item:($cleaned_title)";
|
||||
my ( $err, $result, $count ) = $searcher->simple_search_compat( $query, 0, 0 );
|
||||
my ( $err, $result, $count );
|
||||
eval {
|
||||
( $err, $result, $count ) =
|
||||
$searcher->simple_search_compat( $query, 0, 0 );
|
||||
|
||||
warn "Warning from simple_search_compat: $err"
|
||||
if $err;
|
||||
};
|
||||
if ($err || $@){
|
||||
warn "Warning from simple_search_compat: $err.$@";
|
||||
$template->param( analytics_error => 1 );
|
||||
}
|
||||
|
||||
my $variables = {
|
||||
show_analytics_link => $count > 0 ? 1 : 0
|
||||
|
|
|
|||
|
|
@ -99,6 +99,12 @@
|
|||
<span class="error"><br/> Error: [% decoding_error | html %]</span>
|
||||
</div>
|
||||
[% END %]
|
||||
[% IF analytics_error %]
|
||||
<div>
|
||||
<span class="analytics_error">
|
||||
There was an error searching for analytic records, please see the logs for details.</span>
|
||||
</div>
|
||||
[% END %]
|
||||
[% IF ( ocoins ) %]
|
||||
<!-- COinS / OpenURL -->
|
||||
<span class="Z3988" title="[% ocoins | html %]"></span>
|
||||
|
|
|
|||
|
|
@ -210,10 +210,15 @@ my $ean = GetNormalizedEAN( $record, $marcflavour );
|
|||
( C4::Context->preference('UseControlNumber') and $record->field('001') )
|
||||
? 'rcn:'. $record->field('001')->data . ' AND (bib-level:a OR bib-level:b)'
|
||||
: "Host-item:($cleaned_title)";
|
||||
my ( $err, $result, $count ) = $searcher->simple_search_compat( $query, 0, 0 );
|
||||
my ( $err, $result, $count );
|
||||
eval {
|
||||
( $err, $result, $count ) =
|
||||
$searcher->simple_search_compat( $query, 0, 0 );
|
||||
|
||||
warn "Warning from simple_search_compat: $err"
|
||||
if $err;
|
||||
};
|
||||
if ($err || $@){
|
||||
warn "Warning from simple_search_compat: $err.$@";
|
||||
}
|
||||
|
||||
my $variables = {
|
||||
anonymous_session => ($borrowernumber) ? 0 : 1,
|
||||
|
|
|
|||
Loading…
Reference in New Issue