From 2a550f731c3a37a053d72f51338a9ea82d3c0dd1 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. --- .../intranet-tmpl/prog/en/includes/tools-menu.inc | 18 +++++++++++++- .../prog/en/modules/tools/tools-home.tt | 29 ++++++++++++++++------ 2 files changed, 39 insertions(+), 8 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 64f2a53..67ccf55 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc @@ -5,6 +5,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
+ +[% 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 d47b320..df906c3 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 @@ -13,7 +13,11 @@
+[% 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 @@ -27,7 +31,7 @@ [% IF ( CAN_user_tools_moderate_comments ) %]
Comments [% IF ( pendingcomments ) %][% pendingcomments | html %][% END %]
-
Moderate patron comments.
+
Moderate patron comments.
[% END %] [% IF ( CAN_user_tools_import_patrons ) %] @@ -62,19 +66,23 @@ [% IF ( CAN_user_tools_moderate_tags ) %]
Tags [% IF ( pendingtags ) %][% pendingtags | html %][% END %]
-
Moderate patron tags
+
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
@@ -83,11 +91,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 %] @@ -100,7 +108,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
@@ -125,7 +133,14 @@
+[% 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.1.4