From 013b589f23e34bdb08dd162ab1ed0f0477c66994 Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Mon, 4 Feb 2019 06:30:51 +0000 Subject: [PATCH] Bug 8387: Hide headings in tools when user has no permissions for any listed below The headings for each column on the tools page will show, even if the user has no permission for any tool below it. This patch tries to correct this. To test: - Try various combinations of tool permissions - On the tools module start page and for the tools sidebar visible on the left on a tool's page: - Make sure headings don't show when you have no permissions for any of the tools listed below - Make sure headings show correctly if you have one or many of the tools permissions needed Signed-off-by: Owen Leonard The qa tool gives some warnings but I think they can be considered false positives. Signed-off-by: Martin Renvoize Signed-off-by: Nick Clemens (cherry picked from commit 1fe43199b642fa575fd93131e1390c55d4631e52) Signed-off-by: Martin Renvoize (cherry picked from commit dc2bca10630211abe4118917a4c7d185a9b6b2cf) Signed-off-by: Lucas Gass --- .../prog/en/includes/tools-menu.inc | 18 ++++++- .../prog/en/modules/tools/tools-home.tt | 48 ++++++++++++------- 2 files changed, 49 insertions(+), 17 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc index d3e03a95ad..6aeb2e4d12 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc @@ -3,6 +3,9 @@ +[% IF ( CAN_user_tools_manage_patron_lists || CAN_user_clubs || CAN_user_tools_moderate_comments || CAN_user_tools_import_patrons + || CAN_user_tools_edit_notices || CAN_user_tools_edit_notice_status_triggers || CAN_user_tools_label_creator || CAN_user_tools_delete_anonymize_patrons + || CAN_user_tools_edit_patrons || CAN_user_tools_moderate_tags || CAN_user_tools_batch_upload_patron_images ) %]
Patrons and circulation
+[% END %] +[% IF ( CAN_user_tools_items_batchdel || CAN_user_tools_items_batchmod || CAN_user_tools_records_batchdel + || CAN_user_tools_records_batchmod || CAN_user_tools_export_catalog || CAN_user_tools_inventory + || CAN_user_tools_label_creator || CAN_user_tools_rotating_collections + || ( CAN_user_stockrotation_manage_rotas && Koha.Preference('StockRotation') ) + || CAN_user_tools_marc_modification_templates || CAN_user_tools_stage_marc_import + || CAN_user_tools_manage_staged_marc || CAN_user_tools_upload_local_cover_images ) %]
Catalog
+[% END %] +[% IF ( CAN_user_tools_edit_calendar || CAN_user_tools_manage_csv_profiles || CAN_user_tools_view_system_logs || CAN_user_tools_edit_news + || CAN_user_tools_schedule_tasks || CAN_user_tools_edit_quotes || ( UseKohaPlugins && CAN_user_plugins_tool ) + || CAN_user_tools_upload_general_files || CAN_user_tools_access_files ) %]
Additional tools
    [% IF ( CAN_user_tools_edit_calendar ) %] @@ -111,4 +125,6 @@ [% IF ( CAN_user_tools_access_files ) %]
  • Access files
  • [% END %] -
+ +[% END %] + diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt index 0152389a9b..ac583c2a59 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt @@ -8,12 +8,15 @@ -
-
-
-
+
+
+
+[% IF ( CAN_user_tools_manage_patron_lists || CAN_user_clubs || CAN_user_tools_moderate_comments || CAN_user_tools_import_patrons + || CAN_user_tools_edit_notices || CAN_user_tools_edit_notice_status_triggers || CAN_user_tools_label_creator || CAN_user_tools_delete_anonymize_patrons + || CAN_user_tools_edit_patrons || CAN_user_tools_moderate_tags || CAN_user_tools_batch_upload_patron_images ) %]

Patrons and circulation

+[% END %]
[% IF (CAN_user_tools_manage_patron_lists) %]
Patron lists @@ -25,9 +28,9 @@
Manage patron clubs..
[% END %] -[% IF ( CAN_user_tools_moderate_comments ) %] -
Comments [% IF ( pendingcomments ) %][% pendingcomments %][% END %]
-
Moderate patron comments.
+ [% IF ( CAN_user_tools_moderate_comments ) %] +
Comments [% IF ( pendingcomments ) %][% pendingcomments | html %][% END %]
+
Moderate patron comments.
[% END %] [% IF ( CAN_user_tools_import_patrons ) %] @@ -61,18 +64,24 @@ [% END %] [% IF ( CAN_user_tools_moderate_tags ) %] -
Tags [% IF ( pendingtags ) %][% pendingtags %][% END %]
-
Moderate patron tags
+
Tags [% IF ( pendingtags ) %][% pendingtags | html %][% END %]
+
Moderate patron tags
[% END %] [% IF ( CAN_user_tools_batch_upload_patron_images ) %]
Upload patron images
-
Upload patron images in a batch or one at a time
+
Upload patron images in a batch or one at a time
[% END %] -
+
-
+ + +
+[% IF ( CAN_user_tools_edit_calendar || CAN_user_tools_manage_csv_profiles || CAN_user_tools_view_system_logs || CAN_user_tools_edit_news + || CAN_user_tools_schedule_tasks || CAN_user_tools_edit_quotes || ( UseKohaPlugins && CAN_user_plugins_tool ) + || CAN_user_tools_upload_general_files || CAN_user_tools_access_files ) %]

Additional tools

+[% END %]
[% IF ( CAN_user_tools_edit_calendar ) %]
Calendar
@@ -81,11 +90,11 @@ [% IF ( CAN_user_tools_manage_csv_profiles ) %]
CSV profiles
-
Manage CSV export profiles
+
Manage CSV export profiles
[% END %] [% IF ( CAN_user_tools_view_system_logs ) %] -
Log viewer
+
Log viewer
Browse the system logs
[% END %] @@ -98,7 +107,7 @@
Task scheduler
Schedule tasks to run
[% END %] - + [% IF ( CAN_user_tools_edit_quotes ) %]
Edit quotes for QOTD feature
Quote editor for Quote-of-the-day feature in OPAC
@@ -122,8 +131,15 @@
-
+
+[% IF ( CAN_user_tools_items_batchdel || CAN_user_tools_items_batchmod || CAN_user_tools_records_batchdel + || CAN_user_tools_records_batchmod || CAN_user_tools_export_catalog || CAN_user_tools_inventory + || CAN_user_tools_label_creator || CAN_user_tools_rotating_collections + || ( CAN_user_stockrotation_manage_rotas && Koha.Preference('StockRotation') ) + || CAN_user_tools_marc_modification_templates || CAN_user_tools_stage_marc_import + || CAN_user_tools_manage_staged_marc || CAN_user_tools_upload_local_cover_images ) %]

Catalog

+[% END %]
[% IF ( CAN_user_tools_items_batchdel ) %]
Batch item deletion
-- 2.39.5