SugarCRM:自定义模块 allocate_to_user 字段不保存“id”价值

发布于 2024-10-12 06:47:07 字数 1880 浏览 8 评论 0原文


我正在设计一个名为 Agents 的自定义模块,使用 SugarCE 6.0.0 中的 ModuleBuilder

该模块基于帐户。在 Studio 中,当我从可分配部分单击分配的用户名并保存时,它会生成两个字段,即:

  • 分配的用户名
  • _id_c< /strong>

当我部署包并尝试从分配给字段中选择用户名时,首先它根本不会获取任何结果(无论是通过自动填充还是弹出窗口)。

我检查了 custom/modulebuilder/packages/MyPackage/modules/Agents/vardefs.php,这是我发现的:

'_id_c' => 
array (
  'required' => false,
  'name' => '_id_c',
  'vname' => '',
  'type' => 'id',
  'massupdate' => 0,
  'comments' => '',
  'help' => '',    
  'importable' => 'true',
  'duplicate_merge' => 'disabled',
  'duplicate_merge_dom_value' => 0,
  'audited' => false,
  'reportable' => true,
  'len' => 36,
  'size' => '20',
),
'assigned_user_name' => 
array (
  'required' => true,
  'name' => 'assigned_user_name',
  'link' => 'assigned_user_link',
  'vname' => 'LBL_ASSIGNED_TO_NAME',
  'rname' => 'name',
  'type' => 'relate',
  'reportable' => true,
  'source' => 'non-db',
  'table' => 'users',
  'id_name' => '_id_c',
  'module' => '',
  'duplicate_merge' => 'disabled',
  'massupdate' => 0,
  'comments' => '',
  'help' => '',
  'importable' => 'true',
  'duplicate_merge_dom_value' => '0',
  'audited' => true,
  'len' => '255',
  'size' => '20',
  'ext2' => '',
  'quicksearch' => 'enabled',
  'studio' => 'visible',
),

请注意,未设置 allowed_user_name 中的 module 选项到正确的值。 第一个问题:这是 Studio 的错误吗?

我的快速解决方法是设置 module =>; “用户” 并且它起作用了。我现在可以从下拉(自动填充)列表中选择用户名。

但是,选择用户名仍然不会使用用户的 36 个字符 UUID 填充隐藏的 _id_c 字段,因此,当我保存记录并重新加载它时,指派的用户名字段仍为空白。

有谁知道为什么会发生这种情况?对此有什么补救措施吗?

谢谢,
米^e

I'm designing a Custom Module named Agents, using ModuleBuilder in SugarCE 6.0.0.

The module is based on Accounts. In Studio, when I click on assigned_user_name from the Assignable section and save it, it generates two fields, namely:

  • assigned_user_name
  • _id_c

When I deployed the package and tried to pick a username from the assigned to field, at first it wouldn't fetch any results at all (neither through autofill nor popup).

I checked out the custom/modulebuilder/packages/MyPackage/modules/Agents/vardefs.php, here's what I found:

'_id_c' => 
array (
  'required' => false,
  'name' => '_id_c',
  'vname' => '',
  'type' => 'id',
  'massupdate' => 0,
  'comments' => '',
  'help' => '',    
  'importable' => 'true',
  'duplicate_merge' => 'disabled',
  'duplicate_merge_dom_value' => 0,
  'audited' => false,
  'reportable' => true,
  'len' => 36,
  'size' => '20',
),
'assigned_user_name' => 
array (
  'required' => true,
  'name' => 'assigned_user_name',
  'link' => 'assigned_user_link',
  'vname' => 'LBL_ASSIGNED_TO_NAME',
  'rname' => 'name',
  'type' => 'relate',
  'reportable' => true,
  'source' => 'non-db',
  'table' => 'users',
  'id_name' => '_id_c',
  'module' => '',
  'duplicate_merge' => 'disabled',
  'massupdate' => 0,
  'comments' => '',
  'help' => '',
  'importable' => 'true',
  'duplicate_merge_dom_value' => '0',
  'audited' => true,
  'len' => '255',
  'size' => '20',
  'ext2' => '',
  'quicksearch' => 'enabled',
  'studio' => 'visible',
),

Note that the module option in assigned_user_name is not being set to the right value.
First question: Is this a Studio bug?

My quick fix was to set module => 'Users' and it worked. I was now able to select the username from a dropdown (autofill) list.

However, selecting a username still doesn't populate the hidden _id_c field with the 36 Char UUID of the user and hence, when I save the record and reload it, the assigned_user_name field remains blank.

Does anyone have an idea as to why this is happening? And any remedies for this?

Thanks,
m^e

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

月隐月明月朦胧 2024-10-19 06:47:07

好吧,不要认为您应该在 vardef 中获取这些字段,因为这些字段是在所有模块扩展的父类中定义的。默认情况下,这些是分配用户的用户字段:

var $assigned_user_id;
var $assigned_user_name;
var $assigned_user_link;

通过查看您的代码,您可以尝试设置:

'id_name' => 'assigned_user_id'

您不应该为此字段(_id_c) 创建其他字段。

Well don't think you should be getting these in your vardefs because these fields are defined in parent class which all modules extend. By default these are the fields that are user for assigned user:

var $assigned_user_id;
var $assigned_user_name;
var $assigned_user_link;

By looking at your code you can try setting:

'id_name' => 'assigned_user_id'

You are not supposed to create additional field for this field (_id_c).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文