From cd0f8c914192265508f72cb5e9a045a1cee839d3 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 17 Jun 2024 15:41:53 +0000 Subject: [PATCH] Bug 37103: Link log viewer options to corresponding system preference This patch updates the log viewer interface so that users with the correct permissions can click a module's "Log not enabled" icon to go directly to the corresponding system preference for enabling the log. To test, apply the patch and go to Tools -> Log viewer (must have "view_system_logs" permission). - You should see an icon next to each module for which logging is disabled. Hovering over the icon should give a tooltip: "Log not enabled." - If you are logged in as a user with "manage_sysprefs" permission, clicking the icon should take you directly to the system preference for enabling or disabling that module's logs. - If your user does not have "manage_sysprefs" permission the icon should not be a link. Sponsored-By: Athens County Public Libraries Signed-off-by: Brendan Lawlor Signed-off-by: Laura_Escamilla Signed-off-by: Katrin Fischer --- .../prog/en/modules/tools/viewlog.tt | 35 ++++++++++--------- koha-tmpl/intranet-tmpl/prog/js/viewlog.js | 8 +++++ 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt index 545b038b3d..78a181b9b3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt @@ -69,39 +69,39 @@ [% BLOCK translate_log_module %] [% SWITCH module %] -[% CASE 'AUTH' %]Authentication[% UNLESS Koha.Preference('AuthFailureLog') || Koha.Preference('AuthScuccessLog') %] [% END %] -[% CASE 'CATALOGUING' %]Catalog[% UNLESS Koha.Preference('CataloguingLog') %] [% END %] +[% CASE 'AUTH' %]Authentication[% UNLESS Koha.Preference('AuthFailureLog') || Koha.Preference('AuthScuccessLog') %] [% END %] +[% CASE 'CATALOGUING' %]Cataloging[% UNLESS Koha.Preference('CataloguingLog') %] [% END %] -[% CASE 'AUTHORITIES' %]Authorities[% UNLESS Koha.Preference('AuthoritiesLog') %] [% END %] +[% CASE 'AUTHORITIES' %]Authorities[% UNLESS Koha.Preference('AuthoritiesLog') %] [% END %] -[% CASE 'MEMBERS' %]Patrons[% UNLESS Koha.Preference('BorrowersLog') %] [% END %] +[% CASE 'MEMBERS' %]Patrons[% UNLESS Koha.Preference('BorrowersLog') %] [% END %] -[% CASE 'ACQUISITIONS' %]Acquisitions[% UNLESS Koha.Preference('AcquisitionLog') %][% END %] +[% CASE 'ACQUISITIONS' %]Acquisitions[% UNLESS Koha.Preference('AcquisitionLog') %][% END %] -[% CASE 'SERIAL' %]Serials[% UNLESS Koha.Preference('SubscriptionLog') %] [% END %] +[% CASE 'SERIAL' %]Serials[% UNLESS Koha.Preference('SubscriptionLog') %] [% END %] -[% CASE 'HOLDS' %]Holds[% UNLESS Koha.Preference('HoldsLog') %] [% END %] +[% CASE 'HOLDS' %]Holds[% UNLESS Koha.Preference('HoldsLog') %] [% END %] -[% CASE 'ILL' %]Interlibrary loans[% UNLESS Koha.Preference('IllLog') %] [% END %] +[% CASE 'ILL' %]Interlibrary loans[% UNLESS Koha.Preference('IllLog') %] [% END %] -[% CASE 'CIRCULATION' %]Circulation[% UNLESS Koha.Preference('IssueLog') %] [% END %] +[% CASE 'CIRCULATION' %]Circulation[% UNLESS Koha.Preference('IssueLog') %] [% END %] -[% CASE 'CLAIMS' %]Claims[% UNLESS Koha.Preference('ClaimsLog') %] [% END %] +[% CASE 'CLAIMS' %]Claims[% UNLESS Koha.Preference('ClaimsLog') %] [% END %] -[% CASE 'FINES' %]Fines[% UNLESS Koha.Preference('FinesLog') %] [% END %] +[% CASE 'FINES' %]Fines[% UNLESS Koha.Preference('FinesLog') %] [% END %] [% CASE 'SYSTEMPREFERENCE' %]System preferences -[% CASE 'CRONJOBS' %]Cron jobs[% UNLESS Koha.Preference('CronjobLog') %] [% END %] +[% CASE 'CRONJOBS' %]Cron jobs[% UNLESS Koha.Preference('CronjobLog') %] [% END %] -[% CASE 'REPORTS' %]Reports[% UNLESS Koha.Preference('ReportsLog') %] [% END %] +[% CASE 'REPORTS' %]Reports[% UNLESS Koha.Preference('ReportsLog') %] [% END %] [% CASE 'SEARCHENGINE' %]Search engine -[% CASE 'NOTICES' %]Notices[% UNLESS Koha.Preference('NoticesLog') %] [% END %] -[% CASE 'NEWS' %]News[% UNLESS Koha.Preference('NewsLog') %] [% END %] -[% CASE 'RECALLS' %]Recalls[% UNLESS Koha.Preference('RecallsLog') %] [% END %] -[% CASE 'SUGGESTION' %]Suggestions[% UNLESS Koha.Preference('SuggestionsLog') %] [% END %] +[% CASE 'NOTICES' %]Notices[% UNLESS Koha.Preference('NoticesLog') %] [% END %] +[% CASE 'NEWS' %]News[% UNLESS Koha.Preference('NewsLog') %] [% END %] +[% CASE 'RECALLS' %]Recalls[% UNLESS Koha.Preference('RecallsLog') %] [% END %] +[% CASE 'SUGGESTION' %]Suggestions[% UNLESS Koha.Preference('SuggestionsLog') %] [% END %] [% CASE %][% module | html %] [% END %] @@ -491,6 +491,7 @@ [% Asset.js("lib/jsdiff/jsdiff.min.js") | $raw %] [% Asset.js("js/viewlog.js") | $raw %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/viewlog.js b/koha-tmpl/intranet-tmpl/prog/js/viewlog.js index 568320af81..52c9582233 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/viewlog.js +++ b/koha-tmpl/intranet-tmpl/prog/js/viewlog.js @@ -149,4 +149,12 @@ $(document).ready(function(){ return false; } }); + + $(".log-disabled").each(function(){ + if( CAN_user_parameters_manage_sysprefs ){ + let pref = $(this).data("log") + url = "/cgi-bin/koha/admin/preferences.pl?op=search&searchfield="; + $(this).wrap("") + } + }).tooltip(); }); -- 2.39.5