Logic 逻辑挂钩显示父记录中的某些信息会引发错误
我有一个SugarCRM 6.5 CE的托管实例,我必须满足的一个要求是在相关的任务/活动记录中显示父记录的一些信息——联系电话号码、联系电子邮件地址 到目前为止,我所发现的只是指向创建一个逻辑挂钩,用于从父记录(Contacts)中提取联系人信息,并在子记录(Tasks)的自定义字段中显示这些信息 根据一些说明和示例,我得出如下结论 在“custom/modules/Tasks”下,我创建了一个名为“logic_hooks.php”的文件Logic 逻辑挂钩显示父记录中的某些信息会引发错误,logic,hook,sugarcrm,Logic,Hook,Sugarcrm,我有一个SugarCRM 6.5 CE的托管实例,我必须满足的一个要求是在相关的任务/活动记录中显示父记录的一些信息——联系电话号码、联系电子邮件地址 到目前为止,我所发现的只是指向创建一个逻辑挂钩,用于从父记录(Contacts)中提取联系人信息,并在子记录(Tasks)的自定义字段中显示这些信息 根据一些说明和示例,我得出如下结论 在“custom/modules/Tasks”下,我创建了一个名为“logic_hooks.php”的文件 在“custom/modules/Tasks/ho
在“custom/modules/Tasks/hooks”下,我创建了一个名为“contact_info.phplogic_hooks.php”的文件
有了这个钩子,我可以毫无问题地创建新任务,但是当打开一个现有的任务时,我收到一条消息,阅读
处理您的请求时出错,请稍后再试
作为SugarCRM的新手(顺便说一句,我正在处理的是6.5.20 CE),我一点也不知道这里出了什么问题
我也找不到任何应该写在某处的调试消息
--Sil68“contact_info.phplogic_hooks.php”文件应与logic_hooks.php(custom/modules/error_log('some helpful message');
在contact_info.php文件中,查看哪些消息(如果有)被发送到错误日志。这可以告诉你它是否启动了逻辑钩子,如果是,它通过逻辑钩子有多远
<?php
class contact_info_class {
// retrieve contact information from parent record
function contact_info_method($bean, $event, $arguments) {
// debug
$GLOBALS['log'] = LoggerManager::getLogger('SugarCRM');
$GLOBALS['log']->debug("Tasks: contact_info_method called for event ".$event . "(BeanID: " . $bean->id . ")");
// fetch data
if ($bean->fetched_row['id'] != $bean->id) {
// load Task
//$bean = BeanFactory::getBean('Tasks', $id);
// check if relationship is loaded
//if ($bean->load_relationship('contact_tasks_parent'))
if ($bean->load_relationship('contact_tasks')) {
// fetch related beans
//$relatedBeans = $bean->contact_tasks_parent->getBeans();
$relatedBeans = $bean->contact_tasks->getBeans();
$parentBean = false;
if (!empty($relatedBeans)) {
// order the results
reset($relatedBeans);
// first record in the list is the parent
$parentBean = current($relatedBeans);
// retrieve data from parent bean
$bean->contact_phone_c = $parentBean->phone_work
$bean->contact_primary_email_c = $parentBean->email1
}
}
}
} // contact_info_method
} // contact_info_class
?>
error_log('some helpful message');