When attempting to import a cvs file that contained values for Start and End Year, Month, Day, Hour and Minute I received the following error message:
Fatal error: Call to undefined function: event_timezone_map() in /home/luna/public_html/spd/modules/node_import/import_event.inc on line 88
I'm not sure if this is a bug or a problem with my configuration relating to the timezone offset. I didn't change it when I created the account, so it was at the default GMT setting. I then updated my timezone setting and got the same error.

Roger

Comments

dado’s picture

Seems to be a problem with recent change to event module. See my bug report here.
http://drupal.org/node/64701

KSA213755’s picture

Thanks for the link.

dado’s picture

It seems that the code for import_event.inc needs to be changed. The event module is making some new assumptions if the jscalendar module is installed. I think we can no longer call an event module validation function directly but rather replicate some of the desired code therein.

Specifically, this line (#61) of code in import_event.inc

//let event module add proper event related fields on the basis of the above
event_nodeapi($node, 'submit');

must be replaced with something like this:

//TODO: permit import of the event's timezone?
$node->timezone = event_timezone_map(variable_get('date_default_timezone', 0));

//copied from event module's function event_validate_form_date()
if (isset($node->{$prefix . 'year'}) && isset($node->{$prefix . 'month'}) && isset($node->{$prefix . 'day'}) && isset($node->{$prefix . 'hour'}) && isset($node->{$prefix . 'minute'})) {
    $hour = $node->{$prefix . 'hour'};
    if (variable_get('event_ampm', '0')) {
      if (($node->{$prefix . 'ampm'} == 'pm') && ($hour != 12)) {
        $hour += 12;
      }
      elseif (($node->{$prefix . 'ampm'} == 'am') && ($hour == 12)) {
        $hour -= 12;
      }
    }
    // translate the input values to GMT and set the node property value
    $offset = event_get_offset($node->timezone, gmmktime($hour, $node->{$prefix . 'minute'}, 0, $node->{$prefix . 'month'}, $node->{$prefix . 'day'}, $node->{$prefix . 'year'}));
    $node->{'event_'. $date} = _event_mktime($hour, $node->{$prefix . 'minute'}, 0, $node->{$prefix . 'month'}, $node->{$prefix . 'day'}, $node->{$prefix . 'year'}, $offset);
  }
  elseif (!$node->$date) {
    // Round to nearest hour:
    $now = _event_user_time();
    $node->$date = $now - ($now % (60 * 60));
  }


//copied from event module's function event_nodeapi ... case 'submit':
        if ($node->event_end < $node->event_start) {
          $node->event_end = $node->event_start;
        }
        switch (variable_get('event_timezone_display', 'event')) {
          case 'event' :
            $node->start_offset = event_get_offset($node->timezone, $node->event_start);
            $node->end_offset = event_get_offset($node->timezone, $node->event_end);
            break;
          case 'user' :
            global $user;
            $node->start_offset = $node->end_offset = $user->timezone;
            break;
          case 'site' :
            $node->start_offset = $node->end_offset = variable_get('date_default_timezone', 0);
            break;
        }
        $node->start_format = format_date($node->event_start, 'small', '', $node->start_offset);
        $node->end_format = format_date($node->event_end, 'small', '', $node->end_offset);

I will test this code when I get the chance. Anyone who wishes to try it or suggest alternative fix is of course welcome.

dado’s picture

I think this line of code must be added at the very beginning

include_once(drupal_get_path('module', 'event') .'/event_timezones.inc');
Robrecht Jacques’s picture

Status: Active » Closed (won't fix)

Versions 4.6 and 4.7 are no longer supported. If this bug is still present in the 5.x version, please reopen this issue.

The 5.x version includes this timezone file.

Setting it as "won't fix".