From 7cfe568a4672e99c032c4202dca15b2e99bf851f 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: hc Signed-off-by: Bouzid Fergani --- .../intranet-tmpl/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 4ed27db..47414e8 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.7.4