Bug 20484: (RM follow-up) Highlight ES disablement
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 21 Apr 2020 11:14:13 +0000 (12:14 +0100)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 21 Apr 2020 11:14:13 +0000 (12:14 +0100)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

admin/searchengine/elasticsearch/mappings.pl
koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt

index 202c0fe..17e4e86 100755 (executable)
@@ -34,7 +34,8 @@ use Module::Load::Conditional qw(can_load);
 
 my $input = new CGI;
 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
-    {   template_name   => 'admin/searchengine/elasticsearch/mappings.tt',
+    {
+        template_name   => 'admin/searchengine/elasticsearch/mappings.tt',
         query           => $input,
         type            => 'intranet',
         authnotrequired => 0,
@@ -50,6 +51,8 @@ unless ( can_load( modules => { 'Koha::SearchEngine::Elasticsearch::Indexer' =>
 my $index = $input->param('index') || 'biblios';
 my $op    = $input->param('op')    || 'list';
 my @messages;
+push @messages, { type => 'message', code => 'elasticsearch_disabled' }
+  if ( C4::Context->preference('SearchEngine') ne 'Elasticsearch' );
 
 my $database = Koha::Database->new();
 my $schema   = $database->schema;
index 4c9c586..bf6d73d 100644 (file)
@@ -97,6 +97,8 @@ a.add, a.delete {
           [% t("Mappings updated successfully.") | $raw %]
         [% CASE 'success_on_reset' %]
           [% t("Mappings have been reset successfully.") | $raw %]
+        [% CASE 'elasticsearch_disabled' %]
+          [% t("Elasticsearch is currently disabled.") | $raw %]
         [% CASE %]
           [% m.code | html %]
         [% END %]