From c087cc7a27518ce2c98204b15d5ee5dfbc9a0186 Mon Sep 17 00:00:00 2001 From: Civiware Solutions Date: Fri, 29 Jun 2018 01:19:19 +0530 Subject: [PATCH] added hook to disable edit link --- batchexportperm.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/batchexportperm.php b/batchexportperm.php index 5b42bbf..f85d681 100644 --- a/batchexportperm.php +++ b/batchexportperm.php @@ -139,10 +139,27 @@ function batchexportperm_civicrm_entityTypes(&$entityTypes) { * * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_permission */ -function deleterelationships_civicrm_permission(&$permissions) { +function batchexportperm_civicrm_permission(&$permissions) { $prefix = ts('CiviCRM') . ': '; $permissions['edit exported contributions'] = [ $prefix . ts('Edit exported contributions'), ts('Edit exported contributions'), ]; } + +/** + * Implements hook_civicrm_links(). + * + * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_links + */ +function batchexportperm_civicrm_links($op, $objectName, $objectId, &$links, &$mask, &$values) { + if ($op == 'contribution.selector.row' && $objectName == 'Contribution') { + if (!CRM_Core_Permission::check('edit exported contributions')) { + foreach ($links as $key => $link) { + if ($link['name'] == 'Edit') { + unset($links[$key]); + } + } + } + } +}