Browse Source

Bug 26991: Add action logs to search engine administration

Search engine administration is very important,
we should log who/when it is changed.
I don't add a preference system to disable it,
like there is no for preference system logs.

Test plan :
1) Use searchengine Elasticsearch
2) Go to Administation > Search engine configuration (Elasticsearch)
3) Click on 'Reset Mappings' and accept
4) Edit some lines and save
5) Go to 'Tools' > 'Log viewer'
6) Select only 'Search engine' in Modules and submit
7) Select only 'Edit mappings' in Actions
8) Check you see a log
9) Select only 'Reset mappings' in Actions
10) Check you see a log

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
21.05.x
Fridolin Somers 1 year ago
committed by Jonathan Druart
parent
commit
5bc62d240c
  1. 5
      admin/searchengine/elasticsearch/mappings.pl
  2. 8
      koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt

5
admin/searchengine/elasticsearch/mappings.pl

@ -22,6 +22,7 @@ use List::Util qw( first );
use C4::Koha;
use C4::Output;
use C4::Auth;
use C4::Log;
use Koha::SearchEngine::Elasticsearch;
use Koha::SearchMarcMaps;
@ -168,6 +169,9 @@ if ( $op eq 'edit' ) {
$schema->storage->txn_rollback;
} else {
push @messages, { type => 'message', code => 'success_on_update' };
C4::Log::logaction( 'SEARCHENGINE', 'EDIT_MAPPINGS', undef, q{} );
$schema->storage->txn_commit;
Koha::SearchEngine::Elasticsearch->clear_search_fields_cache();
@ -178,6 +182,7 @@ if ( $op eq 'edit' ) {
elsif( $op eq 'reset_confirmed' ) {
Koha::SearchEngine::Elasticsearch->reset_elasticsearch_mappings;
push @messages, { type => 'message', code => 'success_on_reset' };
C4::Log::logaction( 'SEARCHENGINE', 'RESET_MAPPINGS', undef, q{} );
}
elsif( $op eq 'reset_confirm' ) {
$template->param( reset_confirm => 1 );

8
koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt

@ -94,6 +94,8 @@
[% CASE 'REPORTS' %]Reports[% UNLESS Koha.Preference('ReportsLog') %] <i class="fa fa-warning" title="Log not enabled"></i>[% END %]
[% CASE 'SEARCHENGINE' %]Search engine
[% CASE %][% module | html %]
[% END %]
[% END %]
@ -117,6 +119,8 @@
[% CASE 'STATUS_CHANGE' %]Change ILL request status
[% CASE 'PATRON_NOTICE' %]ILL notice sent to patron
[% CASE 'Run' %]Run
[% CASE 'EDIT_MAPPINGS' %]Edit mappings
[% CASE 'RESET_MAPPINGS' %]Reset mappings
[% CASE %][% action | html %]
[% END %]
[% END %]
@ -168,7 +172,7 @@
[% ELSE %]
<label for="moduleALL" class="viewlog"><input type="checkbox" id="moduleALL" name="modules" value=""> All</label>
[% END %]
[% FOREACH modx IN [ 'AUTH' 'CATALOGUING' 'AUTHORITIES' 'MEMBERS' 'ACQUISITIONS' 'SERIAL' 'HOLDS' 'ILL' 'CIRCULATION' 'LETTER' 'FINES' 'SYSTEMPREFERENCE' 'CRONJOBS', 'REPORTS' ] %]
[% FOREACH modx IN [ 'AUTH' 'CATALOGUING' 'AUTHORITIES' 'MEMBERS' 'ACQUISITIONS' 'SERIAL' 'HOLDS' 'ILL' 'CIRCULATION' 'LETTER' 'FINES' 'SYSTEMPREFERENCE' 'CRONJOBS', 'REPORTS', 'SEARCHENGINE' ] %]
[% IF modules.grep(modx).size %]
<label for="module[% modx | html %]" class="viewlog"><input type="checkbox" id="module[% modx | html %]" name="modules" value="[% modx | html %]" checked="checked"> [% PROCESS translate_log_module module=modx %]</label>
[% ELSE %]
@ -190,7 +194,7 @@
<label for="actionALL" class="viewlog"><input type="checkbox" id="actionALL" name="actions" value=""> All</label>
[% END %]
[% FOREACH actx IN [ 'ADD' 'DELETE' 'MODIFY' 'ISSUE' 'RETURN' 'RENEW' 'CREATE' 'CANCEL' 'SUSPEND' 'RESUME' 'ADDCIRCMESSAGE' 'DELCIRCMESSAGE' 'STATUS_CHANGE' 'PATRON_NOTICE' 'CHANGE PASS' 'Run' ] %]
[% FOREACH actx IN [ 'ADD' 'DELETE' 'MODIFY' 'ISSUE' 'RETURN' 'RENEW' 'CREATE' 'CANCEL' 'SUSPEND' 'RESUME' 'ADDCIRCMESSAGE' 'DELCIRCMESSAGE' 'STATUS_CHANGE' 'PATRON_NOTICE' 'CHANGE PASS' 'Run' 'EDIT_MAPPINGS' 'RESET_MAPPINGS' ] %]
[% IF actions.grep(actx).size %]
<label for="action[% actx| replace('\s+', '_') | html %]" class="viewlog"><input type="checkbox" id="action[% actx | replace('\s+', '_') | html %]" name="actions" value="[% actx | html %]" checked="checked"> [% PROCESS translate_log_action action=actx %]</label>
[% ELSE %]

Loading…
Cancel
Save