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]); + } + } + } + } +}