套件CRM中的模块创建

时间:2014-03-21 06:50:46

标签: module sugarcrm suitecrm

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

试图创建一些模块,但除了很少有用的 links 之外没有明确的文档,下面是我的查询:

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

任何链接也表示赞赏。

1 个答案:

答案 0 :(得分:11)

您可以通过修改“modules / Users / login.tpl”

来创建自定义登录页面

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

手动创建模块时,使用正确的名称非常重要。 最简单的方法是文件夹,表格和模块的多个名称以及类的单数名称。

手动步骤:

您需要一个模块中的文件夹/命名为您的模块(即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 /”文件夹结构。如果提供了糖,将使用糖文件,但通常在自定义模块中不需要它。

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

相关问题