Author Topic: FengOffice 1.6.1 Error 500: Internal Server Error  (Read 5167 times)

William

  • Freshman
  • *
  • Posts: 13
    • View Profile
FengOffice 1.6.1 Error 500: Internal Server Error
« on: January 07, 2010, 12:58:02 am »
After helping a user upgrade to FengOffice 1.6.1 from OpenGoo 1.5.3 the following error message was received after debugging was turned on in the config file:

Fatal error: Call to a member function getTimestamp() on a non-object in /usr/local/apache2/htdocs/pm/opengoo/application/helpers/calendar.php on line 105

This prevents the Overview tab from being displayed.

When clicking on the Calendar tab the following pop-up error is shown:

Error: og.eventSelected is not a function

Everything appears to be in good working order except the Calendar functions.  We can disable the calendar module and the Overview tab will display properly.

The function this error refers to is:

function forwardRepDate(ProjectTask $task, $min_date) {
   if ($task->isRepetitive()) {
      if (($task->getRepeatBy() == 'start_date' && !$task->getStartDate() instanceof DateTimeValue) ||
         ($task->getRepeatBy() == 'due_date' && !$task->getDueDate() instanceof DateTimeValue)) {
            return array('date' => $min_date, 'count' => 0); //This should not happen...
      }
      
      $date = new DateTimeValue($task->getRepeatBy() == 'start_date' ? $task->getStartDate()->getTimestamp() : $task->getDueDate()->getTimestamp());
      $count = 0;
      if($date->getTimestamp() >= $min_date->getTimestamp()) {
         return array('date' => $date, 'count' => $count);
      }
      
      while ($date->getTimestamp() < $min_date->getTimestamp()) {
         if ($task->getRepeatD() > 0) {
            $date = $date->add('d', $task->getRepeatD());
         } else if ($task->getRepeatM() > 0) {
            $date = $date->add('M', $task->getRepeatM());
         } else if ($task->getRepeatY() > 0) {
            $date = $date->add('y', $task->getRepeatY());
         }
         $count++;
      }
      return array('date' => $date, 'count' => $count);
   } else return array('date' => $min_date, 'count' => 0);
}

Hope that helps troubleshoot the issue.
« Last Edit: January 07, 2010, 12:34:38 pm by William »

William

  • Freshman
  • *
  • Posts: 13
    • View Profile
Re: FengOffice 1.6.1 Error 500: Internal Server Error
« Reply #1 on: January 11, 2010, 10:24:08 pm »
Replaced all files (except config) with download from today.  Error persists.

On a clean install, Feng 1.6.1 seems to run with no errors.  This only seems to occur on an upgrade.  Seems to be a possible DB migration issue.

William

  • Freshman
  • *
  • Posts: 13
    • View Profile
Re: FengOffice 1.6.1 Error 500: Internal Server Error
« Reply #2 on: January 13, 2010, 02:47:13 pm »
Quick update.  The calendar tab is fine on work spaces which do not have any repetitive tasks.  I am going to install a clean copy of FengOffice 1.6.1 on a development server to define the intended database table structure and compare that to the database table structure of the installation which has the issue.  I haven't seen any other posts in the forums with these error reports so I am going to proceed as if this is a separate issue.  Stop me if this has already been solved.

William

  • Freshman
  • *
  • Posts: 13
    • View Profile
Re: FengOffice 1.6.1 Error 500: Internal Server Error
« Reply #3 on: January 13, 2010, 07:28:42 pm »
Went through task list and made all repetitive tasks single occurrence tasks and then re-enabled calendar module.  Calendar and overview tabs now work properly, as long as users don't enter a task which repeats.  Seems the problem is most likely in the database or with the generate task repetition code.  Since I haven't seen others with these symptoms, I'm going to concentrate on the database side of troubleshooting.  I haven't had a chance to compare tables between the corrupt updated version and a fresh install of FengOffice 1.6.1 yet but hopefully this weekend will yield the time I need.

ignacio

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
Re: FengOffice 1.6.1 Error 500: Internal Server Error
« Reply #4 on: January 20, 2010, 11:19:39 am »
Hi William,

Try changing the beginning of that function to:

Code: [Select]
function forwardRepDate(ProjectTask $task, $min_date) {
if ($task->isRepetitive()) {
if (($task->getRepeatBy() == 'start_date' && !$task->getStartDate() instanceof DateTimeValue) ||
($task->getRepeatBy() == 'due_date' && !$task->getDueDate() instanceof DateTimeValue) ||
$task->getRepeatBy() != 'due_date' && $task->getRepeatBy() != 'start_date' ||
!$min_date instanceof DateTimeValue) {
return array('date' => $min_date, 'count' => 0); //This should not happen...
}

That will avoid the error, but please tell me if repetitive tasks are shown correctly in the calendar with that change.

Thanks.

William

  • Freshman
  • *
  • Posts: 13
    • View Profile
Re: FengOffice 1.6.1 Error 500: Internal Server Error
« Reply #5 on: January 25, 2010, 08:04:08 pm »
Sorry for the late reply.  I appreciate the response.  Once I deleted all existing repeating tasks, I was able to re-enter the repeating tasks with no error.  At that point I was able to re-enable the Calendar module.  I can't re-create the error at this point.  I can add that code after hours to see if tasks still show and then remove it afterwards if that will help you.

There are numerous other errors, so I'm thinking when time permits I'll have to compare how the DB is intended to be structured compared to what state our DB is in now.  If you have DB documentation already that would save me time.  There have been numerous DB migration errors from release to release so I'm willing to bet the DB is the central cause.