modulesugarcrmsuitecrm

module creation in suiteCRM


I am using SuiteCRM ( Sugar CRM 6.x community edition ) & want to create a custom login page and after successful login I want to redirect based on user type

tried to create some modules but there is no clear documentation except few of useful links, below are my queries :

any link is also appreciated.


Solution

  • You can create a custom Login Page by modfying "modules/Users/login.tpl"

    Custom Modules can be created through Modulebuilder or manually.

    When creating modules manually it's important to use the right names. The easiest way is a Plural name for the folder, table and Module and a singular name for the class.

    Manual steps:

    You need a Folder in modules/ named like you module (i.e. CAccounts)

    In this folder you need a file named like the class (i.e CAccount.php) with something like that as content:

    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;
        }
    
    }
    

    In this folder you need a vardefs.php file:

    $dictionary['CAccount'] = array(
        'table'=>'caccounts',
        'audited'=>false,
        'fields'=>array (
              //Your fielddefs here     
         )
    );  
    
    require_once('include/SugarObjects/VardefManager.php');
    VardefManager::createVardef('CAccounts','CAccount', array('basic'));
    

    For the language and metadata folders look at any other module.

    Next is a file at "custom/Extension/application/Ext/Include/CAccounts.include.php"

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

    A language file for the module name must be in "custom/Extension/application/Ext/Language/"

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

    To display the Module in your tabs you need to use "rebuild and repair" and then the "Display Modules and Subpanels" option in the admin menu.

    For a custom module you don't need the "custom/" folder structure. Files there will be used by sugar if provided, but often there's no need for that in a custom module.

    Guides about the Module Framework can be found on the sugarcrm support site: http://support.sugarcrm.com/02_Documentation/04_Sugar_Developer/Sugar_Developer_Guide_6.5/03_Module_Framework