2

如何在 SugarCRM 中有条件地隐藏详细视图上的按钮?

具体细节:

假设在帐户模块中我想从 DetailView 页面有条件地隐藏删除按钮,那么我可以在哪里放置显示/隐藏条件。

提前致谢。

4

2 回答 2

1

对于 SugarCRM Pro 版本

您应该编辑custom/modules/MODULE_NAME/metadata/detailviewdefs.php文件并根据需要更改$viewdefs[$module_name]['DetailView']['templateMeta']['form']数组。默认情况下,该数组对于几乎所有模块都是空的。

例子:

// Place this code on the end of a file.

// This line remove all buttons
$viewdefs[$module_name]['DetailView']['templateMeta']['form']['buttons'] = array();

// This will add some buttons according to your conditions:
if (condition for edit button = true)
    $viewdefs[$module_name]['DetailView']['templateMeta']['form']['buttons'][] = 'EDIT';
if (condition for duplicate button = true)
    $viewdefs[$module_name]['DetailView']['templateMeta']['form']['buttons'][] = 'DUPLICATE';
if (condition for delete button = true)
    $viewdefs[$module_name]['DetailView']['templateMeta']['form']['buttons'][] = 'DELETE';

每次更改此文件时,请记住运行管理 -> 修复 -> 快速修复和重建。

于 2013-04-26T17:41:25.583 回答
1

您应该可以在 /custom/modules/Account/metadata/detailviewdefs.php 中修改它

添加到这个类似:

if (your condition) {
    unset($viewdefs['Accounts']['DetailView']['templateMeta']['form']['buttons'][2])
    //2 being the index of the DELETE button
}

然后你需要运行:Admin -> Repair -> Quick Repair and Rebuild

于 2012-09-26T18:16:13.660 回答