SugarCRM v6.5 如何从另一个模块中获取字段并将其显示到另一个模块中?
SugarCRM v6.5 How to get the field from another module and display it into a different module?
我知道这种关系,但他们只获得主要字段,没有其他字段。例如,我有两个模块,模块 1 保存用户的个人信息,而模块 2 可以说保存此人的活动。在模块 2 中,我想根据他在模块 1 中的信息显示性别。
我该如何处理?
请按照以下步骤实现此目的:
注意:确保 Module-1 和 Module-2 具有 1-M 或 M-M
关系之一
第 1 步:在模块 2 中创建新字段 store/display 性别
值
第 2 步:在模块 2 中创建新文件
位置(custom/modules/Module2/views/view.detail.php)
<?php
require_once('include/MVC/View/views/view.detail.php');
class Module2ViewDetail extends ViewDetail {
function Module2ViewDetail() {
parent::ViewDetail();
}
function display() {
$recordId = $this->bean->id;
global $db;
if($recordId){
/* write a query to fetch gender($gender) from module */
}
$this->dv->process();
$this->ss->assign('GENDER',$gender);
echo $this->dv->display();
}
}
?>
- 第 3 步:\custom\modules\Module2\metadata\detailviewdefs.php
将自定义代码添加到您在模块 2 中创建的性别字段中,如下所示。 (请注意:字段名称与您自定义的字段名称相似):
1 =>
array (
0 =>
array (
'name' => 'gender_c',
'label' => 'LBL_GENDER',
'customCode' => '{$GENDER}',
),
1 => '',
),
希望对您有所帮助。谢谢!
我知道这种关系,但他们只获得主要字段,没有其他字段。例如,我有两个模块,模块 1 保存用户的个人信息,而模块 2 可以说保存此人的活动。在模块 2 中,我想根据他在模块 1 中的信息显示性别。
我该如何处理?
请按照以下步骤实现此目的: 注意:确保 Module-1 和 Module-2 具有 1-M 或 M-M
关系之一第 1 步:在模块 2 中创建新字段 store/display 性别 值
第 2 步:在模块 2 中创建新文件 位置(custom/modules/Module2/views/view.detail.php)
<?php require_once('include/MVC/View/views/view.detail.php'); class Module2ViewDetail extends ViewDetail { function Module2ViewDetail() { parent::ViewDetail(); } function display() { $recordId = $this->bean->id; global $db; if($recordId){ /* write a query to fetch gender($gender) from module */ } $this->dv->process(); $this->ss->assign('GENDER',$gender); echo $this->dv->display(); } } ?>
- 第 3 步:\custom\modules\Module2\metadata\detailviewdefs.php
将自定义代码添加到您在模块 2 中创建的性别字段中,如下所示。 (请注意:字段名称与您自定义的字段名称相似):
1 =>
array (
0 =>
array (
'name' => 'gender_c',
'label' => 'LBL_GENDER',
'customCode' => '{$GENDER}',
),
1 => '',
),
希望对您有所帮助。谢谢!