gpt4 book ai didi

suiteCRM 中的模块创建

转载 作者:行者123 更新时间:2023-12-02 09:55:30 26 4
gpt4 key购买 nike

我正在使用 SuiteCRM(Sugar CRM 6.x 社区​​版)并希望创建自定义登录页面,成功登录后我想根据用户类型进行重定向

尝试创建一些模块,但没有明确的文档,除了一些有用的 links ,以下是我的疑问:

  • 我们可以在不使用模块构建器的情况下创建自定义模块吗?如果可以,那么步骤是什么?
  • 我们是否需要在/module 文件夹或/custom/module 文件夹中或同时在两个地方编写模块?

任何链接也值得赞赏。

最佳答案

您可以通过修改“modules/Users/login.tpl”来创建自定义登录页面

自定义模块可以通过 Modulebuilder 或手动创建。

手动创建模块时,使用正确的名称很重要。最简单的方法是为文件夹、表和模块使用复数名称,为类使用单数名称。

手动步骤:

您需要在modules/中建立一个以您的模块命名的文件夹(即CAccounts)

在此文件夹中,您需要一个类似于类的文件(即 CAccount.php),其内容类似于以下内容:

require_once('data/SugarBean.php');
require_once('include/utils.php');

class CAccount extends SugarBean{

var $table_name = 'caccounts';
var $object_name = 'CAccount';
var $module_dir = 'CAccounts';
var $new_schema = true;
var $name;

var $created_by;
var $id;
var $deleted;
var $date_entered;
var $date_modified;
var $modified_user_id;
var $modified_by_name;

function CAccount (){
parent::SugarBean();
}

function get_summary_text(){
return $this->name;
}

function bean_implements($interface)
{
switch($interface)
{
case 'ACL':return true;
}

return false;
}

}

在此文件夹中,您需要一个 vardefs.php 文件:

$dictionary['CAccount'] = array(
'table'=>'caccounts',
'audited'=>false,
'fields'=>array (
//Your fielddefs here
)
);

require_once('include/SugarObjects/VardefManager.php');
VardefManager::createVardef('CAccounts','CAccount', array('basic'));

对于语言和元数据文件夹,请查看任何其他模块。

下一个文件位于“custom/Extension/application/Ext/Include/CAccounts.include.php”

$moduleList[] = 'CAccounts'; 
$beanList['CAccounts'] = 'CAccount';
$beanFiles['CAccount'] = 'modules/CAccounts/CAccount.php';

模块名称的语言文件必须位于“custom/Extension/application/Ext/Language/”

$app_list_strings['moduleList']['CAccounts'] = 'Custom Accounts';

要在选项卡中显示模块,您需要使用“重建和修复”,然后使用管理菜单中的“显示模块和子面板”选项。

对于自定义模块,您不需要“custom/”文件夹结构。如果提供的话,那里的文件将被 Sugar 使用,但在自定义模块中通常不需要这些文件。

有关模块框架的指南可以在 Sugarcrm 支持站点上找到: http://support.sugarcrm.com/02_Documentation/04_Sugar_Developer/Sugar_Developer_Guide_6.5/03_Module_Framework

关于suiteCRM 中的模块创建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22552117/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com