Example: If one creates an event that occurs on three dates, then downloads an iCal file, it will correctly contain an entry with the correct occurrence rule; however, that entry will be duplicated two more times. So instead of having three events, there will be nine -- three identical events on each of the three event dates.

Issues that addressed the same sort of duplication on the other calendar displays recommended changing the Multiple Values setting under Fields. This does work for the Month, Day, Upcoming, and other displays, but not for the iCal display, as it does not utilize Fields. I've also tried turning on Aggregation, but that did nothing.

This makes it impossible to use the repeating dates and iCal features on the same calendar.

Comments

karens’s picture

Project: Calendar » Date iCal
Version: 7.x-3.x-dev »
Component: iCal export » Code

I decided to set Date iCal up as a new project. It can be expanded to include a Feeds parser for importing ical items and add some features to make it easier to import/export ical feeds. Plus it could have another maintainer that is someone interested in doing more work on the iCal standard. I will be deprecating the Calendar iCal module in favor of that one.

New module is at http://drupal.org/project/date_ical.

piemanji’s picture

Version: » 7.x-1.0

Just seen this bug when I tried to import my feed into Google Calendar. Quickly written a (very inefficient) bit of code to solve the problem while someone does a proper fix. Put this code in the right place in date-ical-vcalendar.tpl.php. Hope it proves useful to someone.

print "BEGIN:VCALENDAR\r\n";
print "VERSION:2.0\r\n";
print "METHOD:$method\r\n";
if (!empty($title)):
  print "X-WR-CALNAME;VALUE=TEXT:$title\r\n";
endif;
print "PRODID:-//Drupal iCal API//EN\r\n";
// Note that theme('date_vevent') already has the right line endings.
$printedeventids = array();
foreach($rows as $row):
  $numstart = strpos($row,'calendar.')+9;
  $numend = strpos($row,'.field_')-1;
  $eventid = substr($row,$numstart,$numend-$numstart+1);
  $printed = 0;
  foreach($printedeventids as $printedeventid) {
	if ($printedeventid == $eventid) {
	  $printed = 1;
	  break;
	}
  }
  if (!$printed) {
	print $row;
	//print 'Test';
	$printedeventids[sizeof($printedeventids)] = $eventid;
  }
endforeach;
print "END:VCALENDAR\r\n";

(Just realised I'm not running the dev version - maybe it's solved there? But don't have the time at the minute to check so I'll leave this here for now.)

piemanji’s picture

A much simpler alternative to this, I've realised, is commenting out the "rrule" line in date-ical-vevent.tpl.php. The advantage to this is that it is able to show the correct time across daylight savings boundaries.

cindyr’s picture

piemanji - sweet. thanks. it worked.

kaynen’s picture

A much simpler alternative to this, I've realised, is commenting out the "rrule" line in date-ical-vevent.tpl.php.

Commenting out that line does not work for me. That instead just shows the first occurrence of the event, rather than all of them. The approach in number two works well for me; however, the timezone bug is still preventing this from working perfectly. Thanks for your help piemanji.

gribnif’s picture

Status: Active » Needs review
StatusFileSize
new1.33 KB

I have an alternate approach, which involves a couple of simple changes to date_ical_plugin_row_ical_feed.inc:

1. Only return one occurrence (delta) for each repeating event.

2. Instead of returning the occurrence that appeared within the specified range, always return the first occurrence with its repeat rule. Without this change, the calendar client will incorrectly try to repeat the event past the end of the actual repeat range. While this change does mean there will likely be occurrences outside of the desired date range, at least they will be valid occurrences. Ideally, the code should modify the repeat rule to only return the occurrences that fit within the chosen range, but that will be difficult to code correctly.

gribnif’s picture

StatusFileSize
new1.32 KB

The first version of the patch would cause PHP warnings. This version fixes that.

SyneX’s picture

The patch of #7 works for me.

coredumperror’s picture

Status: Needs review » Needs work

Due to the order in which I applied patches for these 7.x-1.x issues, this patch no longer applies cleanly to the code. And, the conflicting patch that I already applied may have fixed this bug.

Could you please test the newest 7.x-1.x-dev build to see if this problem persists? If it does, could you please re-roll this patch against the most recent dev release? Thanks!

Or, you could try upgrading to the 7.x-2.x branch, since 7.x-1.x is in bug-fix only mode now, and will soon be abandoned. If you have any problems with the 7.x-2.x branch, please open a new issue.

vlad.pavlovic’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.