SugarCRM 无法访问两个模块的关系 [英] SugarCRM can't access a relation of two modules
问题描述
所以我在这里发疯了,我不妨告诉你我所做的整件事,也许你可以帮助我.
So im going nuts here, I might as well tell you the whole thing i did, and maybe you can help me with it.
我使用的是按需版本的糖.
I am in the on demand version of sugar.
我需要关联 2 个自定义模块,因此我使用模块构建器为它们创建了一个包:
i need to relate 2 custom modules so i used the module builder to create a package for them:
自定义模块是表单和地图.然后我在两者之间创建了这样的关系:
the custom modules are form and map. then i created a relationship between both like this:
之后我将我的包部署到我的糖实例并继续创建一些测试数据.
After that i deployed my package to my sugar instance and proceeded to create some test data.
然后在我的自定义入口点上,我希望获得与特定表单相关的地图,所以这是我的代码:
then on my custom entry point i wish to get the maps related to a specific form so this is my code:
但是当我尝试调用我的入口点时它不会返回任何与表单相关的映射,这里是一个例子:
But when i try to call my entry point It wont return any maps related to the form, here is an example:
在示例中,地图没有回显,我只是找不到问题所在.任何帮助将不胜感激!
in the example the maps arent echoed, i just cant find where the problem is. any help would be appreciated !
推荐答案
我也遇到了 load_relationship 问题.在大多数情况下,问题出在您的情况下的 $rel_map 参数.在modules/Leads/views/view.convertleads.php中有一个Sugar函数:
I too have had problems with load_relationship. In most cases the problem ist the $rel_map param in your case. There is a Sugar function in modules/Leads/views/view.convertleads.php:
protected function findRelationship(
$from,
$to
)
{
global $dictionary;
require_once("modules/TableDictionary.php");
foreach ($from->field_defs as $field=>$def)
{
if (isset($def['type']) && $def['type'] == "link" && isset($def['relationship']))
{
$rel_name = $def['relationship'];
$rel_def = "";
if (isset($dictionary[$from->object_name]['relationships']) && isset($dictionary[$from->object_name]['relationships'][$rel_name]))
{
$rel_def = $dictionary[$from->object_name]['relationships'][$rel_name];
}
else if (isset($dictionary[$to->object_name]['relationships']) && isset($dictionary[$to->object_name]['relationships'][$rel_name]))
{
$rel_def = $dictionary[$to->object_name]['relationships'][$rel_name];
}
else if (isset($dictionary[$rel_name]) && isset($dictionary[$rel_name]['relationships'])
&& isset($dictionary[$rel_name]['relationships'][$rel_name]))
{
$rel_def = $dictionary[$rel_name]['relationships'][$rel_name];
}
if (!empty($rel_def)) {
if ($rel_def['lhs_module'] == $from->module_dir && $rel_def['rhs_module'] == $to->module_dir )
{
return $field;
}
else if ($rel_def['rhs_module'] == $from->module_dir && $rel_def['lhs_module'] == $to->module_dir )
{
return $field;
}
}
}
}
return false;
}
如果给定每个模块的 bean 作为参数,它将返回 load_relationship 所需的值.在代码 '$def['type'] == "link"' 中,您可以看到它获取链接而不是关系.
It returns the required Value for load_relationship if given a bean of each module as param. In the code '$def['type'] == "link"' you can see it fetches the link and NOT the relation.
简而言之:在 d_form 模块中获取关系的链接名称以在 load_relationship 中使用而不是关系名称
In short: get the linkname for your relation in your d_form module to use in load_relationship not the relationship name
这篇关于SugarCRM 无法访问两个模块的关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!