Just updated Calendar, Date, Views and Event modules on one of my sites and now have a blank page when I try to visit the calendar.
Looking at the Apache Log I see:

PHP Fatal error: Call to undefined function event_get_offset() in /var/www/multi5/sites/all/modules/calendar/calendar.module on line 596

Observations:
- happens in Garland not just my custom theme
- calendar will display when empty, this error only occurs when trying to display a calendar view with an event.
- event_get_offset() exists in event_timezones.inc
- niether clearing the views cache, or clearing the cache with devel module helped

Drupal and Module versions:
Drupal 5.x-dev (2007-Jul-19) [using this because 5.1 has profile bugs that cause problems for this site]
Calendar 5.x-1.5
Date 5.x-1.6
Event 5.x-1.x-dev [stable 5.x-1.0 has bugs that cause issues for this site]
Views 5.x-1.6

A lot of different variables to consider here...anyone got any idea where to start looking to correct this? I find it quite odd that the function event_get_offset() exists but is undefined. Is this because calendar includes DATE_TIMEZONES not event timezones at line 595?

CommentFileSizeAuthor
#3 calendar-tzoffset-fix-0.patch638 bytesadrinux
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

adrinux’s picture

Here's the view that causes this error, it was working nicely before the module updates.

 $view = new stdClass();
  $view->name = 'event_calendar';
  $view->description = 'Calendar of events';
  $view->access = array (
);
  $view->view_args_php = '';
  $view->page = TRUE;
  $view->page_title = 'Event calendar';
  $view->page_header = '';
  $view->page_header_format = '4';
  $view->page_footer = '';
  $view->page_footer_format = '4';
  $view->page_empty = '';
  $view->page_empty_format = '4';
  $view->page_type = 'calendar';
  $view->url = 'event-calendar';
  $view->use_pager = FALSE;
  $view->nodes_per_page = '0';
  $view->sort = array (
  );
  $view->argument = array (
    array (
      'type' => 'calendar_year',
      'argdefault' => '2',
      'title' => '',
      'options' => '',
      'wildcard' => '',
      'wildcard_substitution' => '',
    ),
    array (
      'type' => 'calendar_month',
      'argdefault' => '2',
      'title' => '',
      'options' => '',
      'wildcard' => '',
      'wildcard_substitution' => '',
    ),
    array (
      'type' => 'calendar_day',
      'argdefault' => '2',
      'title' => '',
      'options' => '',
      'wildcard' => '',
      'wildcard_substitution' => '',
    ),
  );
  $view->field = array (
    array (
      'tablename' => 'node',
      'field' => 'title',
      'label' => '',
      'handler' => 'views_handler_field_nodelink',
      'options' => 'link',
    ),
    array (
      'tablename' => 'event',
      'field' => 'event_start',
      'label' => '',
      'handler' => 'views_handler_field_date_small',
      'sortable' => '1',
      'defaultsort' => 'ASC',
    ),
    array (
      'tablename' => 'node_data_field_venue_short',
      'field' => 'field_venue_short_value',
      'label' => '',
      'handler' => 'content_views_field_handler_ungroup',
      'options' => 'default',
    ),
  );
  $view->filter = array (
    array (
      'tablename' => 'node',
      'field' => 'status',
      'operator' => '=',
      'options' => '',
      'value' => '1',
    ),
    array (
      'tablename' => 'node',
      'field' => 'type',
      'operator' => 'OR',
      'options' => '',
      'value' => array (
  0 => 'event',
),
    ),
  );
  $view->exposed_filter = array (
  );
  $view->requires = array(node, event, node_data_field_venue_short);
  $views[$view->name] = $view;
adrinux’s picture

And here is the CCK field that's displayed on the calendar along with the event start time and title.

$content[type]  = array (
  'name' => 'Event',
  'type' => 'event',
  'description' => 'An event is a story which can be given a start and end date, thus appearing in the events calendar.',
  'title_label' => 'Title',
  'body_label' => 'Body',
  'min_word_count' => '0',
  'help' => '',
  'node_options' => 
  array (
    'status' => true,
    'revision' => true,
    'promote' => false,
    'sticky' => false,
  ),
  'comment' => '0',
  'upload' => '1',
  'event_nodeapi' => 'all',
  'signup_form' => true,
  'old_type' => 'event',
  'orig_type' => 'event',
  'module' => 'basicevent',
  'custom' => '0',
  'modified' => '1',
  'locked' => '1',
  'reset' => 'Reset to defaults',
);
$content[fields]  = array (
  0 => 
  array (
    'widget_type' => 'text',
    'label' => 'Venue-short',
    'weight' => '-2',
    'rows' => '1',
    'description' => 'The short venue is diplayed in the event listings and calendar.',
    'default_value_widget' => 
    array (
      'field_venue_short' => 
      array (
        0 => 
        array (
          'value' => '',
        ),
      ),
    ),
    'field_venue_short' => 
    array (
      0 => 
      array (
        'format' => '4',
      ),
    ),
    'default_value_php' => '',
    'group' => false,
    'required' => '0',
    'multiple' => '0',
    'text_processing' => '1',
    'max_length' => '50',
    'allowed_values' => '',
    'allowed_values_php' => '',
    'field_name' => 'field_venue_short',
    'field_type' => 'text',
    'module' => 'text',
    'default_value' => 
    array (
      0 => 
      array (
        'value' => '',
      ),
    ),
  ),
);
adrinux’s picture

Status: Active » Needs review
FileSize
638 bytes

On closer inspection, and having read a few other threads about tz issues with event, I decided the current include_once for event in calendar is pseudo-code. So I included event_timezones.inc instead, and that fixed the problem for me. No idea whether this is desirable for the event 2.x-dev branch though.

Patch attached.

sunod10’s picture

I had the same problem. I modified the include to:

include_once(EVENT_TIMEZONES);

and then added a corresponding path definition in event.module, to stick to convention:

define('EVENT_TIMEZONES', EVENT_PATH. '/event_timezones.inc');

It did the trick.

Stol’s picture

Using: calendar.module,v 1.20.2.75

I have the same problem with this version of calendar. I prefer to use the patch of adrinux because only one module needs to be patched.

Regards
Stol

rubenk’s picture

I reproduced this by selecting
any of the following in the timezone handling of the events section.
-----------------------------------------------------------
Use the time zone of the user editing or creating the event
Allow users to set event time zones
Use the event's time zone
Use the user's time zone
---------------------------

THIS DOES NOT OCCUR if I select the following
Use the sitewide time zone
Use the sitewide time zone

FYI really - does it affect the patch?

rubenk’s picture

Bump! I applied the patch to the calendar.module only (first patch) and it worked. Is it too early to commit.

KarenS’s picture

Status: Needs review » Fixed

Different fix applied. This relates to the changes made when timezones.inc was removed from some versions of the event module and the date version of that file got new function names.

Anonymous’s picture

Status: Fixed » Closed (fixed)