From d1da1a688d5a4fb1ea78d53b6308aa08ac09cdd0 Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Fri, 12 Jul 2019 12:40:22 +0000 Subject: [PATCH] Bug 23101: Hide action buttons on contracts if user lacks permission When the user doesn't have superlibrarian, full acq or contracts_manage permission, don't show buttons for editing and deleting contracts. To test: - Create a vendor with a few contracts - Create a staff user with - superlibrarian = can view edit/delete contracts - full acq perms = same - without manage_contracts = can view, but action buttons are gone - Make sure the sorting of the contracts table works in all cases Signed-off-by: Holly Cooper Signed-off-by: Bouzid Fergani Signed-off-by: Marcel de Rooy Signed-off-by: Martin Renvoize (cherry picked from commit d0a06e365b693de6609998b3d649d9ef4d083880) Signed-off-by: Fridolin Somers --- .../prog/en/modules/acqui/supplier.tt | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt index 4ed27db73e..47414e8638 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt @@ -351,7 +351,9 @@ Description Start date End date - Actions + [% IF CAN_user_acquisition_contracts_manage %] + Actions + [% END %] @@ -363,10 +365,12 @@ [% contract.contractdescription | html %] [% contract.contractstartdate | $KohaDates %] [% contract.contractenddate | $KohaDates %] - - Edit - Delete - + [% IF CAN_user_acquisition_contracts_manage %] + + Edit + Delete + + [% END %] [% END %] @@ -426,7 +430,11 @@ $(document).ready(function() { var contractst = $("#contractst").dataTable($.extend(true, {}, dataTablesDefaults, { "aoColumnDefs": [ + [% IF CAN_user_acquisition_contracts_manage %] { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }, + [% ELSE %] + { "bSortable": false, "bSearchable": false }, + [% END %] { "sType": "title-string", "aTargets" : [ "title-string" ] } ], 'sDom': 't' -- 2.39.5