Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 :

  • Can we create custom modules without using module builder, if yes then what would be steps?
  • Do we need to write module in /module folder or /custom/module folder or on both place?

any link is also appreciated.

like image 497
diEcho Avatar asked Mar 21 '14 06:03

diEcho


People also ask

How do I create a custom module in Sugarcrm?

Creating New Modules Module Builder functionality is managed within the 'Developer Tools' section of Sugar's administration console. Upon selecting 'Module Builder', the user has the option of creating a "New Package".

What is module in Sugarcrm?

Overview. Module Builder is a very useful and versatile part of Sugar. With Module Builder, Sugar administrators and developers have the ability to build custom modules to fulfill any needs that are not covered by the out-of-the-box Sugar modules (Accounts, Contacts, Opportunities, Cases, etc.).

How do I export a module from SuiteCRM?

Export Custom Module PackageClick on the package name and click either the Publish or Export button. Publish: Click "Publish" to create a zip file containing the custom module package to be saved on your local machine. The custom module will appear in Studio once the package is installed via Module Loader.


1 Answers

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

like image 180
Hakulukiam Avatar answered Sep 23 '22 17:09

Hakulukiam