Reports problem - Incorrect "Start date" data.

Discussion forum about Anuko Time Tracker
Post Reply
provaz
Posts: 4
Joined: Fri Mar 28, 2014 8:48 am

Reports problem - Incorrect "Start date" data.

Post by provaz » Mon Feb 04, 2019 8:30 pm

Hello,

can you please help? I suddenly cannot generate any report. TT says:

Incorrect "Start date" data.
Incorrect "End date" data.
Snímek obrazovky 2019-02-04 v 21.14.43.png
Snímek obrazovky 2019-02-04 v 21.14.43.png (97.27 KiB) Viewed 1037 times
It doesn't matter if I choose (date, last week, last month, one user, few users). Reports triggered by cron are sent by email - ok.

I have followed dbinstall.php and instructions since 1.5.

No changes were made in the code.
No changes were made on the server.

sometimes I get 500 error message and log says:

Code: Select all

PHP Fatal error: Call to undefined method ttReportHelper::getReportOptions() in /srv/httpd/servers/timetracker/docs/report.php on line 173, referer timetracker/reports.php 
line 173 seems identical to latest stable.

Can you please help? Everything was fine until recently.

Thanks in advance.
Libor

wrc
Posts: 278
Joined: Tue May 25, 2010 8:30 pm

Re: Reports problem - Incorrect "Start date" data.

Post by wrc » Mon Feb 04, 2019 10:01 pm

provaz wrote:
Mon Feb 04, 2019 8:30 pm
sometimes I get 500 error message and log says:

Code: Select all

PHP Fatal error: Call to undefined method ttReportHelper::getReportOptions() in /srv/httpd/servers/timetracker/docs/report.php on line 173, referer timetracker/reports.php 
Looks like your files may be out of sync. Specifically, WEB-INF/lib/ttReportHelper.class.php must contain getReportOptions function and it is not there, apparently. Using an older version, perhaps?

Make sure ALL your source files are good.

provaz
Posts: 4
Joined: Fri Mar 28, 2014 8:48 am

Re: Reports problem - Incorrect "Start date" data.

Post by provaz » Wed Feb 06, 2019 8:41 pm

Nope, I have latest and file is in right place.
Snímek obrazovky 2019-02-06 v 21.39.46.png
Snímek obrazovky 2019-02-06 v 21.39.46.png (20.08 KiB) Viewed 1021 times


:cry:

peter
Posts: 77
Joined: Sat May 29, 2010 2:06 pm

Re: Reports problem - Incorrect "Start date" data.

Post by peter » Thu Feb 07, 2019 2:17 am

You have not provided a lot of details, have you?

1) What is actually in the "Start date" and "End date" fields?
2) What version of TT shows up in the footer?

Are you sure that all PHP files are up-to-date, as with recent code the ttReportHelper::getReportOptions() is defined and the error 500 should not show up. Also, what exactly is "sometimes"? Do you see this error in the log a the moment you see the "Incorrect Start date data" and "Incorrect end date" data, or it is not related to this event at all?

Based on recent code (and I am guessing here that you use recent code), here is what occurs in reports.php page:

- You click on the Generate button below, assuming Start date and End date contain valid data.
- You get to the POST handler on line 332 in reports.php. The code there looks like this:

Code: Select all

    // Generate button pressed. Check some values.
    if (!$bean->getAttribute('period')) {
      $start_date = new DateAndTime($user->getDateFormat(), $bean->getAttribute('start_date'));

      if ($start_date->isError() || !$bean->getAttribute('start_date'))
        $err->add($i18n->get('error.field'), $i18n->get('label.start_date'));

      $end_date = new DateAndTime($user->getDateFormat(), $bean->getAttribute('end_date'));
      if ($end_date->isError() || !$bean->getAttribute('end_date'))
        $err->add($i18n->get('error.field'), $i18n->get('label.end_date'));
    }
- If my guessing is correct, then $start_date and $end_date may be bogus, perhaps because the code failed to obtain the values from your PHP session (using the getAttributes() call).
- One may confirm this by inserting these strings AFTER the values are defined and see what it dies with...

die($start_date->toString());
die($end_date->toString());

Now, if you don't get values from session, this may happen, for example, if PHP tries to save data in a not accessible location. Try to use PHP_SESSION_PATH in config,php but make sure the path exists and the directory is writable, as this could be the problem.

If the above step solves the issue and you want to try the existing session path, try to troubleshoot this further, perhaps the directory does not exist, or has wrong permissions.

Nik
Posts: 479
Joined: Wed May 26, 2010 5:55 pm

Re: Reports problem - Incorrect "Start date" data.

Post by Nik » Thu Feb 07, 2019 2:17 pm

We may need to add a check whether PHP_SESSION_PATH (either customset or default) is writable in environment checks in dbinstall.php.

Nik
Posts: 479
Joined: Wed May 26, 2010 5:55 pm

Re: Reports problem - Incorrect "Start date" data.

Post by Nik » Mon Feb 11, 2019 6:33 pm

Nik wrote:
Thu Feb 07, 2019 2:17 pm
We may need to add a check whether PHP_SESSION_PATH (either customset or default) is writable in environment checks in dbinstall.php.
In Time Tracker 1.18.36.4715, I added a check for PHP session path to be writable in dbinstall.php. If the path is not writable, then the error message is printed out about it.

time_tracker_php_session_path_error.jpg
time_tracker_php_session_path_error.jpg (40.09 KiB) Viewed 981 times

By the way, was the problem because of invalid / not writable session path or it is still not resolved?

Nik
Posts: 479
Joined: Wed May 26, 2010 5:55 pm

Re: Reports problem - Incorrect "Start date" data.

Post by Nik » Wed Feb 13, 2019 11:10 pm

Well, actually, the session path check above is unreliable because open_basedir restriction could be in effect. In this case the error is printed while nothing is wrong.

So, I replaced this check with browser cookie check instead, because this could also be the root problem.

browser_cookies_check.jpg
browser_cookies_check.jpg (18.93 KiB) Viewed 962 times

Post Reply