SuiteCRM 填充相关字段

如何解决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 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?
Java在半透明框架/面板/组件上重新绘画。
Java“ Class.forName()”和“ Class.forName()。newInstance()”之间有什么区别?
在此环境中不提供编译器。也许是在JRE而不是JDK上运行?
Java用相同的方法在一个类中实现两个接口。哪种接口方法被覆盖?
Java 什么是Runtime.getRuntime()。totalMemory()和freeMemory()?
java.library.path中的java.lang.UnsatisfiedLinkError否*****。dll
JavaFX“位置是必需的。” 即使在同一包装中
Java 导入两个具有相同名称的类。怎么处理?
Java 是否应该在HttpServletResponse.getOutputStream()/。getWriter()上调用.close()?
Java RegEx元字符(。)和普通点?