From 7de19f4e5c00025a29b6b8db2d095592bf48e20c Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Tue, 21 Apr 2020 10:54:56 +0000 Subject: [PATCH] Bug 20484: Implement blocking_errors for ES config page Signed-off-by: Martin Renvoize --- admin/searchengine/elasticsearch/mappings.pl | 8 +++++++- .../intranet-tmpl/prog/en/includes/blocking_errors.inc | 2 ++ .../modules/admin/searchengine/elasticsearch/mappings.tt | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/admin/searchengine/elasticsearch/mappings.pl b/admin/searchengine/elasticsearch/mappings.pl index 0ed7aa2522..202c0fe128 100755 --- a/admin/searchengine/elasticsearch/mappings.pl +++ b/admin/searchengine/elasticsearch/mappings.pl @@ -24,12 +24,13 @@ use C4::Output; use C4::Auth; use Koha::SearchEngine::Elasticsearch; -use Koha::SearchEngine::Elasticsearch::Indexer; use Koha::SearchMarcMaps; use Koha::SearchFields; use Koha::Caches; use Try::Tiny; +use Module::Load::Conditional qw(can_load); + my $input = new CGI; my ( $template, $borrowernumber, $cookie ) = get_template_and_user( @@ -41,6 +42,11 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( } ); +unless ( can_load( modules => { 'Koha::SearchEngine::Elasticsearch::Indexer' => undef } ) ) { + output_and_exit( $input, $cookie, $template, 'missing_es_modules'); +} + + my $index = $input->param('index') || 'biblios'; my $op = $input->param('op') || 'list'; my @messages; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/blocking_errors.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/blocking_errors.inc index 510d95fbc2..146264a10f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/blocking_errors.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/blocking_errors.inc @@ -17,6 +17,8 @@
The form submission failed (Wrong CSRF token). Try to come back, refresh the page, then try again.
[% CASE 'budget_is_locked' %]
The budget is locked, fund creation is not possible.
+ [% CASE 'missing_es_modules' %] +
Necessary Elasticsearch packages are not installed on your server. Please contact your server admin if you wish to configure Elasticsearch
[% CASE %][% blocking_error | html %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt index 92043e08c5..4c9c5865d0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt @@ -70,6 +70,8 @@ a.add, a.delete { +[% INCLUDE 'blocking_errors.inc' %] +
-- 2.39.5