2

您好,
最近我通过升级补丁从6.1.4升级到6.2 GA 。

即使从那时起,我也无法创建与日期和时间直接相关的任何内容,即通话记录、会议和任务。

当我使用子面板执行相同操作时,条目就会消失并且永远不会创建。

当我从“活动”下的相应模块之一尝试时,提交时收到HTTP 500错误。

Apache 错误日志显示以下内容:

PHP Catchable fatal error:  Argument 1 passed to TimeDate::_getUserTZ() must be 
an instance of User, boolean given, called in /home/crm/include/TimeDate.php on 
line 849 and defined in /home/crm/include/TimeDate.php on line 259, referer: 
http://mysite/index.php?module=Leads&offset=1&stamp=1307694072083825200&return_module=Leads&action=DetailView&record=xxxxxxxxxxxx

不幸的是,这发生在生产服务器上,我发现这个问题太晚了。

我怎样才能解决这个问题?紧急寻求您的帮助。

谢谢,m^e

更新 1

我已经设法对此应用了一个临时补丁并让它工作...... TimeDate.php 的第 849 行是一个看起来像这样的函数的一部分:

function to_display_date_time($date, $meridiem = true, $convert_tz = true, $user = null)
{

    return $this->_convert($date,
        self::DB_DATETIME_FORMAT, self::$gmtTimezone, $this->get_date_time_format($user),
        $convert_tz ? $this->_getUserTZ($user) : self::$gmtTimezone, true);
} 

该函数依次调用另一个函数_getUserTZ(),它应该将类型的变量传递给该函数User。相反,它正在传递null

我使用了一个片段来检查空的 $user 并在需要时为其分配一个值。该代码是_getUser()在同一文件中找到的另一个名为的函数的一部分......

protected function _getUser(User $user = null)
{
    if (empty($user)) {
        $user = $this->user;
    }
    if (empty($user)) {
        $user = $GLOBALS['current_user'];
    }
    return $user;
}

我从这个函数中借用了代码并将其粘贴到里面to_display_date_time(),使它看起来像:

function to_display_date_time($date, $meridiem = true, $convert_tz = true, $user = null)
{
    if (empty($user)) {
        $user = $this->user;
    }
    if (empty($user)) {
        $user = $GLOBALS['current_user'];
    }
    return $this->_convert($date,
        self::DB_DATETIME_FORMAT, self::$gmtTimezone, $this->get_date_time_format($user),
        $convert_tz ? $this->_getUserTZ($user) : self::$gmtTimezone, true);
}

现在电话/会议又开始工作了。但我仍然想知道这个问题的实际解决方法是什么。对于任何需要尽快纠正此问题的人来说,我的方法应该被证明是一种快速解决方法。

如果有人可以找到问题的根源并提供更优雅的解决方案,我愿意提供赏金。

干杯,m^e

4

0 回答 0