如何解决SuiteCRM 填充相关字段
在商机模块编辑视图中,选择联系人(相关字段)时,我需要自动填充帐户名称(相关字段)。 我可以填写联系人和帐户名称编辑框,并且只能填写一个 ID。 这意味着我可以设置联系人或帐户名称,但不能设置他们的摊位。
有人可以帮忙吗?
array (
0 =>
array (
'name' => 'kontakt_c','studio' => 'visible','label' => 'LBL_KONTAKT','displayParams' => array (
'field_to_name_array' => array(
'id' => 'contact_id_c','name' => 'kontakt_c','account_name' => 'account_name','account_id' => 'account_id',),1 =>
array (
'name' => 'account_name',)
),
解决方法
我更喜欢使用自定义视图,在那里引入您可能需要的任何 javascript 代码。
首先在 custom/modules/Contacts/views/view.edit.php 中构建自定义视图:
<?php
require_once 'modules/Contacts/views/view.edit.php';
class CustomContactsViewEdit extends ContactsViewEdit
{
public function __construct()
{
parent::__construct();
$this->useForSubpanel = true;
$this->useModuleQuickCreateTemplate = true;
// Since the suite base modules name the bean in the singular,we configure in the view the name of the module in the plural. This property will be used by the SticViews class to load the language files
$this->moduleName = 'Contacts';
}
public function preDisplay()
{
parent::preDisplay();
// Write here you custom code
}
public function display()
{
parent::display();
echo '<script type="text/javascript" src="custom/modules/Contacts/CustomUtils.js"></script>';
}
}
然后你构建你的 javascript 文件 custom/modules/Contacts/CustomUtils.js 引入你可能需要的代码。
如果你不需要它是即时的,你也可以使用一个逻辑钩子 before_save 并分别在那里分配帐户/联系人。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。