Portal Case Time Stamp off by 5 hours

Post upgrade to 7.4.1 seems that time stamps are 5 hours in the future. Was there something changed on the Cases Module that made the portal stamp incorrectly?

Can someone validate this?

Any help here would be great.

Spent most of yesterday reviewing time zone and any code on the AOP Joomla server. Servers timezone and PHP times are all set to eastern. Yet the dates are all still 5 hours ahead of eastern when viewing customer portal views. Matt or Will any assistance would be appreciated.

Is any one using AOP and seeing the same thing? This post has been out there for three months with no comments. Could there be something in the code that is causing the cases to be reported in local UK time? Really need some assistance here.

Since I am not getting anywhere with this. Does anyone happen to be using this new portal I ran across?

https://wordpress.org/plugins/sugarcrmsuitecrm-customer-portal/

Hi Nate,

Can you provide some screen shots with some examples of the full issue and detail the scenario so that we can replicate, log and fix?

Kind Regards,

Will.

Portal Server

server timezone

root@portal:~# date
Fri Mar 18 10:52:31 EDT 2016

php.ini files all set

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = "America/New_York"

CRM Server

server timezone

root@CRM:~# date
Fri Mar 18 11:00:20 EDT 2016

php.ini files all set

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = "US/Eastern"

The data viewed through the AOP shows all times 5 hours in the future. Last post provided timezone info from both the portal and CRM servers as well as PHP config. On the CRM we use a special CRM Portal user to tie AOP from Joomla to Suite. Attached its locale setting as well. I have looked through the code for the portal and am not able to see where the time is being translated. Maybe testing in your lab the servers can be set to US eastern for validation.

Was the timezone correct on the portal previously, or was it always incorrect?

Was it just after the upgrade to 7.4.1 you noticed the issue?

Thanks,

Will.

I have logged an issue for this on the portal GitHub Repository.

This will be reviewed and if it is a bug it will be fixed and a new portal release will be built.

Thanks,

Will.

Thanks, Will.

Per the last post sadly per my users this has been going on since the AOP deployment!! Sadly that was quite some time ago (over a year or two).

If you are logging a bug - can I ask that the browser display of the portal users cases be stamped with the date related to the zone the USER is in? This will help international support orgs to display the timestamps in the local-to-the-user time?

Hi,

We solved the problem changed Web services file.

The format shows the Portal is the same that has the database now. files must be modified to change the format required.

Thank you.

Glad you were able to work around it. Can you go into a bit more detail on the fix?

I was just about to ask if jrivas if he could collaborate with you but you beat me to it!

Thanks,

Will.

jrivas - can you please follow up with how you fixed this and what files were changed?

Hi, Change in two files of the Joomla

components/com_advancedopenportal/views/showcase/tmpl/default.php and components/com_advancedopenportal/models/SugarObject.php

Change the code like this:

class SugarObject {

private $date_fields = array("date_entered","date_modified");
private $format = "d/m/Y H:i";

public function __construct($case, $relations = array()){
    foreach($case['name_value_list'] as $name_value){
        $name = $name_value['name'];
        $value = $name_value['value'];
        if(in_array($name,$this->date_fields)){
        	$value = $value. ' -5 hours';
            $disp_name = $name . "_display";
            
            $this->$disp_name = date($this->format, strtotime($value));
        }

        $this->$name = $value;
    }
    foreach($relations as $relation){
        $relationname = $relation['name'];
        $newrecords = array();
        foreach($relation['records'] as $record){
            $new_record = new stdClass();
            foreach($record as $name_value){
                $name = $name_value['name'];
                $value = $name_value['value'];
                $new_record->$name = $value;
            }

            $newrecords[] = $new_record;
        }
        $this->$relationname = $newrecords;

    }
}

}

And…

<?php echo $this->case->name;?> (#<?php echo $this->case->case_number;?>) <?php echo $this->case->date_entered;?> <?php echo $this->case->status_display;?>

I hope, it help you

Thankyou

Thank you for the update, jrivas. Will try on my environment shortly and report back.

Confirmed that the modification to add line

$value = $value. ' -6 hours';

to components/com_advancedopenportal/models/SugarObject.php as mentioned in the thread previously - worked.

-6 vs -5 due to Eastern Daylight Time observed in America. Did not need to modify the default HTML template.

Again would like to keep the bug open for final fix so a time change will not throw off timestamps presented in AOP. This is only a work around. It would be ideal if the local computer timezone accessing the portal be presented to the user in browser, not the timezone of the server.

Thanks again jrivas for the workaround and Will for opening a bug.