如何在编辑模式下添加字段?糖客户关系管理系统 [英] How to add a field while in edit mode? SugarCRM CE

查看:35
本文介绍了如何在编辑模式下添加字段?糖客户关系管理系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Sugar CRM CE.在机会的编辑视图中,有一个 + 按钮和一个 - 按钮用于添加或删除电子邮件字段.这允许您在编辑视图中单击 + 并添加额外的电子邮件字段.如何将此类功能添加到其他自定义字段?谢谢

I am using Sugar CRM CE. While in edit view of Opportunities, there is a + button and a - button to add or take away email fields. This allows you to click on the + and add an additional email field while in edit view. How can I add this type of feature to other custom fields? Thanks

推荐答案

您正在寻找一种在另一个模块中添加 n 个相关条目的方法.

You search for a way to add n related entries in another module.

据我所知,没有现成的解决方案.

There is no out of the box solution to my knowledge.

但我做了一些类似的事情,将来自另一个模块的多个字段集成到一个编辑视图中,以加快产品订单的速度.

But I did something similar to integrate multiple fields from another module into a editview to make i.e. a product order faster.

在您的情况下,首先将 javascript 添加到 {MODULE}/metadata/editviewdefs.php:

In your case first add a javascript to the {MODULE}/metadata/editviewdefs.php:

$viewdefs[{MODULE}] = array (
  'EditView' => array (
    'includes' => array (
        array (
          'file' => 'modules/{MODULE}/js/selectScript.js'
     )

在这个文件 modules/{MODULE}/js/selectScript.js 中,你放了一些 javascript 来生成按钮(即通过 jquery 将它们定位在描述字段之后).该脚本应该将所有相关信息添加到一个隐藏的文本字段(即命名为 website_json)中,其中包含例如这样的 JSON:

Into this file modules/{MODULE}/js/selectScript.js you put some javascript to generate the buttons (i.e. by positioning them via jquery after the description field). The script should add all the relevant information into a hidden textfield (i.e. named websites_json) which contains for example JSON like this:

{'websites' : ['www.somethin.it', 'www.somethingelse.com']}

如果您必须处理此信息以在另一个模块中创建多个对象,您可以在 (custom/) modules/{MODULE}/Save.php 中添加一个文件,您可以在其中处理 javascript 创建的数据,通过创建相关条目.例如,您可以通过 $_REQUEST['websites_json'] 访问 json.然后你可以用它做任何需要做的事情.

If you have to process this information to create multiple objects in another module you could add a file in (custom/) modules/{MODULE}/Save.php in which you handle the data the javascript created, by creating the related entries. You would access the json for example by $_REQUEST['websites_json']. Then you could do with it what ever needs to be done.

在您只添加网站的情况下,您可以简单地在主要模块 vardefs 中添加一个文本字段来保存网站列表.因此,将其添加到模块的 vardefs 以创建 db 字段:

In your case with only websites to add you could simply add a textfield in the main modules vardefs to hold a list of websites. So add this to the vardefs of your module to create the db field:

$dictionary['{MODULE}'] = array(
    'table' => '{module}',
    'fields' => array(
        'websites_json' => array (
            'name' => 'websites_json',
            'vname' => 'LBL_WEBSITES_JSON',
            'type' => 'text',
        ),

该字段会自动保存.重新进入 editview 时,您应该重新创建网站列表以对其进行编辑,并且在 detailview 中,您需要处理 json 以将网站显示为列表.

The field gets saved automatically. On reentering editview you should recreate the websites list to edit it and in detailview you need to handle the json to display the websites as a list.

这篇关于如何在编辑模式下添加字段?糖客户关系管理系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆