【问题标题】:module creation in suiteCRMsuiteCRM 中的模块创建
【发布时间】:2014-03-21 06:50:45
【问题描述】:

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

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

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

任何链接也很感激。

【问题讨论】:

    标签: module sugarcrm suitecrm


    【解决方案1】:

    您可以通过修改“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

    【讨论】:

    • 感谢您的快速回复。我正在调查这个
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-03-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-04
    • 1970-01-01
    相关资源
    最近更新 更多