Time Accounting - "Today's Entry" issues with timezones

Moderator: crythias

Locked
brody
Znuny newbie
Posts: 3
Joined: 22 Apr 2014, 03:43
Znuny Version: 3.2.9
Real Name: Brody Kenrick
Company: Thje Scotney Group

Time Accounting - "Today's Entry" issues with timezones

Post by brody »

Hi,

We have just installed the OTRS Time Accounting Add-on. Everything is working well in general. However, some of our users want to be able to update their worked upon projects/tasks throughout the day but they have an early start time (6AM) and in our setup the ability to edit the entry for today does not become available until 10AM (until 10AM today appears the same as any day in the future with only the options to set as vacation, sick etc).

At first we assumed that this 10AM was linked to the calendar for the user but we changed calendar settings for working hours and it seemed to have no impact - always a 10AM cut-off.

Is the "current day only available to edit after 10AM" a hard-coded setting? or is it modifiable in some place?

Apologies if I missed some documentation that covers this.

We are using OTRS 3.2.9 and KIX4OTRS and Time Accounting 2.2.1.

Regards,
Brody
Last edited by brody on 20 May 2014, 04:41, edited 1 time in total.
brody
Znuny newbie
Posts: 3
Joined: 22 Apr 2014, 03:43
Znuny Version: 3.2.9
Real Name: Brody Kenrick
Company: Thje Scotney Group

Re: Time Accounting - "Today's Entry" available after 10AM o

Post by brody »

I looked into this a bit more and it seems to be an issue related to timezone settings. We are running on a machine with UTC as system time and we have an offset of +10 (Sydney, AU).

The entry block on the Edit page for the current day is called the UnitBlock (dtl:block:UnitBlock in AgentTimeAccountingEdit.dtl @ https://github.com/OTRS/TimeAccounting/ ... ngEdit.dtl).

It only gets displayed for this condition being met in @ https://github.com/OTRS/TimeAccounting/ ... ounting.pm.

Code: Select all

        if ( time() > timelocal( 1, 0, 0, $Param{Day}, $Param{Month} - 1, $Param{Year} - 1900 ) ) {
            $Self->{LayoutObject}->Block(
                Name => 'UnitBlock',
                Data => { %Param, %Frontend },
            );
        }
This is using the builtin functions of time and timelocal(). These ignore the +10 offset (they can't have any knowledge of the offset). This results in a failure to open today's entry until after 10AM.

I am not yet sure if the offset is taken care of in the Kernel::System::Time->SystemTime() or not - the name would indicate that it might be the SystemTime and not TZ compensated.

The timelocal function is used quite a few other times also in the file. The style guide points out to not use time/timelocal @ http://otrs.github.io/doc/manual/develo ... guide.html "Use the functions of the TimeObject instead of the builtin functions like time(), localtime() etc."

We can't change our production setup from UTC system time so we'll probably need to make a code change to correct this. I'll look into this but happy if anyone can point out a way that won't require this.

Thanks,
Brody
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Time Accounting - "Today's Entry" available after 10AM o

Post by crythias »

Please submit a bug report to bugs.otrs.Org
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
brody
Znuny newbie
Posts: 3
Joined: 22 Apr 2014, 03:43
Znuny Version: 3.2.9
Real Name: Brody Kenrick
Company: Thje Scotney Group

Re: Time Accounting - "Today's Entry" available after 10AM o

Post by brody »

Locked