Php 将字段复制到同一模块中的另一个字段-SuiteRM

Php 将字段复制到同一模块中的另一个字段-SuiteRM,php,sugarcrm,suitecrm,Php,Sugarcrm,Suitecrm,创建新记录时,我试图将值从关联字段复制到自定义模块的名称字段。为此,我使用以下逻辑钩: <?php // Do not store anything in this file that is not part of the array or the hook version. This file will // be automatically rebuilt in the future. $hook_version = 1; $hook_array = Array(); // posit

创建新记录时,我试图将值从关联字段复制到自定义模块的名称字段。为此,我使用以下逻辑钩:

<?php
// Do not store anything in this file that is not part of the array or the hook version. This file will
// be automatically rebuilt in the future.
$hook_version = 1;
$hook_array = Array();
// position, file, function
$hook_array['before_save'] = Array(); 
$hook_array['before_save'][] = Array(1, 'Value from one field to another', 'custom/modules/chan_channelpartner/textcopy.php', 'textcopy','textcopy');

?>

检查您的Apache/PHP日志中的错误。这里应该会弹出一些东西。

我能找到的与此问题相关的唯一错误是:PHP致命错误:在/home/cloudtr1/public\u html/include/utils/LogicHook.PHP的第238行中找不到类“textcopy”,该行引用了以下代码:$Class=new$hook\u Class($this->bean$event$arguments);你在屏幕上看到的输出完全把我吓坏了。可能该文件中存在编码问题或一些奇怪的PHP设置问题。它在$bean->棒极了!这正是问题所在。我把我的记事本++设置为USC-2LE编码。我已经改变了这一点,代码现在可以工作了。谢谢你的帮助
<?php
    if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

    class textcopy
    {
        function textcopy($bean, $event, $arguments)
        {
            $bean->name = $bean->namenew_c;
        }
}  

?>
name = $bean->namenew_c; } } ?>