How to create relationship among two modules?URL:http://sugarcrm.openapp.org/?p=94

转载内容:

The sub panel in the detail view of any module shows that how many other modules are related to that particular module. So creating a relationship amongst two module means adding the sub panel in the detail view of that module. To add sub panel you require to make changes in the following files:

The MetaData file

" />
易客CRM,中小企业最忠实的合作伙伴!

转载:如果创建SugarCRM/C3CRM两个模块之间的关系(Subpanel)?

626℃

How to create relationship among two modules?

URL:http://sugarcrm.openapp.org/?p=94

转载内容:

The sub panel in the detail view of any module shows that how many other modules are related to that particular module. So creating a relationship amongst two module means adding the sub panel in the detail view of that module. To add sub panel you require to make changes in the following files:

The MetaData file

The vardefs.php file

The layout_defs.php file

The language file

In addition to these files you may have to create sub panel files for the module if they don’t exist.

Step 1: Creating MetaData file.

The first file that you need to change is the metadata file under the metadata directory. Here you can see all the relationship files. Create one MetaData file and save it in the metadata directory.

/SugarSuite-Full-4.0.1/metadata/new_relationshipMetaData.php

Now you need to tell SugarCRM about this new MetaData file, for this you will need to add name of this file in the TableDictionary.php file.

/SugarSuite-Full-4.0.1/modules/TableDictionary.php

include_once(”metadata/new_relationshipMetaData.php”);

Step 2: Editing vardefs.php file.
The vardefs.php file is the next file that we will be editing.

1 ‘users’ => array (
2 ‘name’ => ‘new’,
3 ‘type’ => ‘link’,
4 ‘relationship’ => ‘new_relationship’,
5 ‘module’=>’New’,
6 ’source’=>’non-db’,
7 ‘ignore_role’=>true,
8 ‘vname’=>’LBL_NEW’,
),

Give the name of the relationship that you want to create: (’relationship’=>’new_relationship’,). Also change the vname and define this in the language file.

/Sugar4.0.1/SugarSuite-Full-4.0.1/modules/new/language/en_us.lang.php

‘LBL_NEW’ => ‘New’,

Step 3: Editing layout_defs.php.
The layout_defs.php is the file that shows the sub panel on the screen. The next 4 lines after ‘order’ point to the Module that the sub panel is from. In this case New:

’subpanel_setup’ => array(

‘new’ => array(
‘order’ => 10,
‘module’ => ‘New’,(This is the module that the sub panel will be pulled from.)
’subpanel_name’ => ‘default’,(This is the actual name of the sub panel php file.)
‘get_subpanel_data’ => ‘new’,
‘add_subpanel_data’ => ‘new_id’,
‘title_key’ => ‘LBL_NEW_SUBPANEL_TITLE’,(The tag from the language file that will be rendered as the title of the sub panel.)
),

Step 4: Editing language file.
This is the easiest step of all. You need to add two keys in the modules language file. The language file is contained in the language directory in the module directory.

/SugarSuite-Full-4.0.1/modules/Module/language/en_us.lang.php

You should insert the two new lines like this:

$mod_strings = array (

‘LBL_USERS_SUBPANEL_TITLE’ => ‘New’,

‘LBL_USERS’ => ‘New’,

and thats it. Run the Repair Relationships command from the administration module and marvel at your new sub panel.

转载请注明:易客CRM官方博客 » 转载:如果创建SugarCRM/C3CRM两个模块之间的关系(Subpanel)?

喜欢 (0)or分享 (0)