2

Helllo,
Recently I upgraded to 6.2 GA from 6.1.4 via the upgrade patch.

Even since then I'm unable to create anything that has direct relation with Date & Time, namely, Call Logs, Meetings and Tasks.

When I do the same using a subpanel, the entry simply vanishes and is NEVER created.

When I try from one of the respective modules under Activities, I get a HTTP 500 error upon submission.

The Apache error log reveals the following:

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

Unfortunately, this has happened to a production server and I noticed this problem only too late.

How can I fix this? Seeking your help urgently.

Thanks, m^e

UPDATE 1

I've managed to apply a temporary patch to this and got it working... Line 849 of TimeDate.php is part of a function that looks like:

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);
} 

This function is in turn calling another one _getUserTZ() to which it is supposed to pass a variable of the type User. Instead it is passing null.

I used a snippet to check for empty $user and assign a value to it if needed. The code is part of another function named _getUser() found in this same file....

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

I borrowed the code from this function and pasted it inside to_display_date_time(), making it look like:

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);
}

Now Calls / Meetings are working again.. but I still wonder what's the actual fix to this issue. My way should prove to be a quick fix for anyone who needs to rectify this in a hurry.

If anyone can get to the root of the problem and a more elegant fix, I'm willing to offer a bounty.

Cheers, m^e

pnuts
  • 58,317
  • 11
  • 87
  • 139
miCRoSCoPiC_eaRthLinG
  • 2,910
  • 4
  • 40
  • 56
  • Have you tried comparing to 6.5.10 and see if the problem is fixed there? – jmertic Feb 27 '13 at 20:16
  • I ran into this stepping through from 5.5.4->6.0.4->6.1.7->6.2.6->6.3.3->6.4.6. Am About to go to 6.5.11, but wanted to stop by and mention that it appears it fixed itself in the 6.4.6 step. – Ajith Antony Mar 21 '13 at 05:11

0 Answers0