I am trying to import csv file into my nodes that have a birthday date which is suppose to date repeat. I can import the birthday date (12/01/72) but not the Repeat Rule. I tried using the repeat rule

RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=1;BYMONTHDAY=12;COUNT=20;WKST=SU

but it's not working.

Any help will be appreciated

Comments

troybthompson’s picture

I'm having a similar issue. Have you made any progress? I've tried many different formats and it seems to just ignore it on import.

megachriz’s picture

megachriz’s picture

Title: Date repeat rule not working » Mapping to date repeat rule not working
Project: Feeds » Date iCal
Version: 7.x-2.0-alpha8 » 7.x-3.x-dev
Component: Feeds Import (feature) » iCal Import

The Repeat Rule mapping is provided by Date iCal module, so moving the issue to there and updating issue title.

I know why it is not working: date_ical_feeds_set_rrule() expects a string for the parameter $repeat_rule (which is documented as the "values" parameter, see my_module_set_target() in feeds.api.php), but because of an API change in Feeds (see https://www.drupal.org/node/2301995), an array is now passed.

I'm not familiar with date repeat rule, but I see the code doesn't alter the entity if there is no repeat rule:

if (empty($repeat_rule)) {
  // Don't alter the entity if there's no repeat rule.
  return;
}

But what if a date had a repeat rule in the source in the past, but in an updated source it no longer has? The repeat rule would still be "active" on the entity. I think in such case the repeat rule should removed from the entity. This is how other mappers also work in Feeds now (in dev), see https://www.drupal.org/node/2301993.

coredumperror’s picture

Yeah, the changes that Feeds has been making have caused other problems for Date iCal users as well. I think it'd be best to simply wait for the changes being made to Feeds to settle down, and a new official release to come out, before I make any more changes to Date iCal.

ucscholar’s picture

Is Date iCal working for repeating events in iCalendar file format(.ics)?

coredumperror’s picture

Sure! You just need to enable the Date Repeat submodule of the Date module. That will allow you to import RRULEs from ics feeds.

ucscholar’s picture

Hi coredumperror,

Thank you for a quick response. Did you mean enabling repeating dates in my data content type? I've reedited my date content type and added a new "Date and Time" field with repeating events enabled. However, it looks like my dates are not importing into my newly edited content type (it says nodes are created when importing, but are not displayed in calendar). Do you know what the issue is? I'm going to downgrade my version of Feeds to version 2.0-alpha8 to see if that fixes it.

coredumperror’s picture

If it's just the dates that aren't importing, then downgrading to Feeds 2.0-alpha8, and applying the patch here, should fix your problem. The most recent dev releases of Feeds are not compatible with Date iCal, as they have made significant changes in how they implement Date importing. The patch is required because of a separate bug in 2.0-alpha8 which breaks date imports.

ucscholar’s picture

It's working now (still need to fix some minor issues on my end). Thank you again for the help.

delty’s picture

Hi,
I have applied this patch to Feeds 2.0-alpha8 but am seeing the repeat date's time being set to the current time (time created) instead of the time from the feed entry. As far as I can tell I have the content type's date field set correctly, and the non-repeating entries' times are being set correctly. I'm also using Date iCal 7.x-3.2+5-dev (2014-Aug-25.) Any idea what might be wrong here?
Thanks!

coredumperror’s picture

Hmmm, sounds like a possible bug in Date iCal or Feeds. Once I have some free time (I'm in super crunch mode at work right now), I'll take a look to try and see what's up.

In the mean time, I'd suggest rebuilding your feed importer from scratch. The "turning it off and then on again" approach often works wonders for Feeds importers.

delty’s picture

Hi Coredumperror,

I would never have thought that deleting and re-creating the feeds importer would have worked since in theory the importer should be exactly the same as before, but it fixed the issue! Thank you for the suggestion, I really appreciate it!

coredumperror’s picture

Yeah, Feeds importers can be a bit... fragile. That might be Date iCal's fault, or it might be Feeds' fault. I'm really not sure.

Hopefully, once Feeds' big overhaul is complete and they release a new recommended version, and I get a chance to update Date iCal to work with it, that kind of problem will go away.

delty’s picture

Yeah, I posted over on Feeds about the status of their overhaul and they aren't expecting anything anytime soon, so this will work for the time being. Thanks again!

computerbarry’s picture

Hi all, wondering if my issue is related, any help or guidance much appreciated.

I've set a number of events in my Google Calendar to repeat for a number of weeks, though when my ical feed importer runs, only the first occurrence updates and no repeating events are showing. Tried everything, just can't figure out what needs updating/changing for this to work and show the repeated events?

The only other solution is to set the repeat within Drupal itself, though for me, this is not suitable and only adds extra dates to the event and not a new event listing for each week.

Has anybody found what's causing this, possible solution?

Date: 7.x-2.7
Date ical : 7.x-3.2
Feeds: 7.x-2.0-alpha8+44-dev
Feed Import: 7.x-2.0-alpha8+44-dev
Job Scheduler: 7.x-2.0-alpha3

Thanks, Barry

coredumperror’s picture

Have you got the Date Repeat module installed? It comes with Date, and make it possible to store repeating dates. You also then need to map the RRULE from your iCal feed into the "Date: Repeat Rule" target, in your Feeds importer settings.

computerbarry’s picture

StatusFileSize
new56.17 KB

Yes should've mentioned sorry, as shown below.

Date Repeat API: 7.x-2.7
Date Repeat Field: 7.x-2.7

Everything works for normal events, its only now I'm trying to import the repeated events.

I also have the mappings setup.

Source: Date: Start (DTSTART)
Target: Event Date and Time: Start (field_event_date_and_time:start)

Source:Date: End (DTEND)
Target: Event Date and Time: End (field_event_date_and_time:end)

Source:Date: Repeat Rule (RRULE)
Target: Event Date and Time: Repeat Rule (field_event_date_and_time:rrule)

I've attached a screenshot of the full mapping I have.

What do you think, can you spot the problem?

Thanks, Barry

mglaman’s picture

I'd like to confirm #8.

Using alpha8 + patch provides smooth iCal imports and proper repeat rules. Tested with: Drupal generate iCal feeds (ones generated by our Drupal product), Google iCal (Drupal Media and Core Mentoring feeds), and iCal feeds generated by our main product.

computerbarry’s picture

Ok thanks.
So you're saying if I add the patch everything will work?

I had major issues in the past getting things setup, it was only when I added the latest feeds module that everything worked.

Cheers, Barry

mglaman’s picture

My setup is..

This gets the repeat rules to properly be respected.

coredumperror’s picture

You'll definitely need to use Feeds alpha8, with the patch from here, as mglaman said.

If that doesn't help, please attach to this issue the iCal feed that you're trying to import, and which is failing in regards to repeating dates. I'll need it to be able to debug your issue, as your importer seems to be properly configured. So I can't be sure what's wrong without looking at the feed itself.

computerbarry’s picture

Ok cool!

Will I be ok keeping the modules I have and just add the patch?

Date: 7.x-2.7
Date ical : 7.x-3.2
Feeds: 7.x-2.0-alpha8+44-dev

This will be my first patch so I'll need to do this manually as I don't have GIT setup.
Basically replace the - code with the + code?

Thanks, Barry

megachriz’s picture

Status: Active » Needs review
StatusFileSize
new1.25 KB

@computerbarry and others
The date repeat rule won't work with the latest Feeds dev at the moment because of the following API change in Feeds: https://www.drupal.org/node/2301995
The patch on Feeds that is mentioned here only has effect if you are using Feeds 7.x-2.0-alpha8 (and not the latest dev).

Attached is a patch that could get the repeat rule from working again with the latest Feeds dev, though it isn't a pretty solution. I also didn't test if it actually works, as I don't use the repeat rule myself.

mglaman’s picture

MegaChriz - that looks about right, I noticed the RRULE was in an array, so keying [0] looks to make sense. I'm just in prototyping stage so I can't test right now, but will once I begin.

Computerbarry:

If you're on Mac or Linux..

  1. cd to your Date iCal directory
  2. curl -O https://www.drupal.org/files/issues/feeds-date_import_fix.patch (or wget on linux)
  3. patch -p1 < feeds-date_import_fix.patch

If you're on Windows, then just do the "-" means remove, "+" means add. Or ping me via my D.o. contact form and I'll email you back my zipped patched module.

computerbarry’s picture

Ok exciting stuff!
I'm on mac though I think I prefer changing the code directly right now.

Thanks guys and cheers Chris, as you know all the problems we had sometime back.

I'll use Chris's patch then, give this a try and get back shortly with the outcome :)

Barry

megachriz’s picture

StatusFileSize
new845 bytes

This is one is slightly prettier, but should have the same effect as the patch in #23.

I'm still concerned about not being able to remove the repeat rule later on (an empty repeat rule is ignored). Don't know if that makes sense.

@computerbarry
Yeah, that was exactly why I decided to drop a patch here, even if it may be not be completely right yet.

computerbarry’s picture

Yeah, that was exactly why I decided to drop a patch here, even if it may be not be completely right yet.

Good work Chris! I've just tested everything using #23. Working very well :)
I've changed an event many times in the google calendar and reimported the ical just for testing, every time the events update from single to multiple dates. No errors.

Single event shows:
Saturday, 27 September, 2014 - 20:00

Repeated event shows:
Repeats every week every Saturday 3 times.
Saturday, 27 September, 2014 - 20:00
Saturday, 4 October, 2014 - 20:00
Saturday, 11 October, 2014 - 20:00

One issue for me is that the event only shows for the first date (Saturday, 27 September, 2014) it doesn't show as a new event for the repeating dates? If that makes sense.

I'd prefer to some how duplicate the event so it shows for each date and not just show a list of dates. Imagine if we have the same event running 100 times a year, you can see the problem and amount of dates listed with that event.

This is a big step forward for me and no doubt many other users of the ical import repeater, though very cautious about using this on a live site. Is this going to cause problems when we decide to update to the latest modules? Will everything be fixed in the future releases, nothing to worry about?

Thanks, Barry

coredumperror’s picture

I'd really like to be able to say this won't be a problem, but because of the way Feeds has changed since their original alpha8 release, you'll simply need to stay on the patched alpha8, even if they release a new version, until Date iCal can be made to work with their new release (whenever that ultimately comes out). I'll do my best to update Date iCal as soon as possible after Feeds' next release, though.

As for the repeating dates, I'm afraid that Date iCal does not support converting events with RRULEs into multiple separate nodes. I'd like to be able to do that, some day, because of the limitations imposed by the way the Date Repeat module was implemented. But that would be a fairly complicated, if not impossible task (I don't know if Feeds supports creating multiple nodes from a single source object), so that feature is not going to be coming any time in the immediate future.

computerbarry’s picture

... you'll simply need to stay on the patched alpha8, even if they release a new version, until Date iCal can be made to work with their new release (whenever that ultimately comes out).

Not the best news.

I'll do my best to update Date iCal as soon as possible after Feeds' next release, though.

Sounds good, thanks! I'll have to keep a close watch on the latest releases and updates.

... that feature is not going to be coming any time in the immediate future.

Big blow for me, this kind of defeats the object for what I'm trying to do at the moment. As things stand, once the first occurrence of the event has passed, nobody will be able to see it? I'll have to rethink the repeating event setup all together and maybe manually duplicate the event node/entity myself within Drupal and turn off the repeated events within Google's Calendar.

As you say, could be some time before this fully works.
Bit of a shame really, was hoping to get things up and running.

Thanks again for all the input and information :)

Barry

coredumperror’s picture

People should still be able to see an event after the first occurrence has passed. The Calendar module that acts as a sister to Date does take repeating dates into account, and shows them on the calendar as if they were multiple separate nodes. Are you seeing behavior that's different from that?

computerbarry’s picture

I'm not using the Calendar module.
I have a EFQ running which displays the events based on the date, once the event has passed their then classed as past events and not shown.

Example:

$query->fieldCondition('field_event_date_and_time', 'value', date("Y-m-d"), '>'); // end date after today

I then loop through the nodes and display inside my custom markup.
Can you see the problem?

Though not a major issue, just would of been nice if everything was updated automatically. I'll just need to add repeating events manually as mentioned above.

Cheers, Barry

coredumperror’s picture

To get the values for the repeating dates, you need to retrieve the multi-value dates from the field. I can't recall exactly how to do it, but the API should have something about a "delta" parameter that lets you set which of the multiple values you want to retrieve. If you compare against the highest delta value'd date, rather than the lowest (which is the default), you should get the behavior you want.

computerbarry’s picture

To get the values for the repeating dates, you need to retrieve the multi-value dates from the field.

I did think maybe this could be possible, just didn't know how, and thanks for the relevant information :)

Looks like a bit of hard coding to get things setup. I'll have to dig a bit deeper into this and maybe head over to the coding section once I get an understand of what is needed. Your information gives me a good starting point, thank you!

Thanks again for all the assistance, been a busy night, much appreciated.

Barry

vaccinemedia’s picture

Not sure if this is in the right place but I'm having an issue with importing events with repeating date rules from another Drupal website using feeds. The date is being exported as JSON and is therefore being imported by using the JSONPath parser. The start dates and end dates are all comma separated in the feed so I'm using feeds tamper to explode on them to import the multiple dates. However, the RRULE is blank after the import.

Has it ever been possible to import repeating dates using anything other than iCal parser? I need to be able to import more fields such as images, related events etc which iCal won't handle. I'm using alpha8 of feeds patched as mentioned above.

coredumperror’s picture

I'm afraid that Date iCal does not support importing feeds of any format besides iCal.

megachriz’s picture

@vaccinemedia
The Feeds mapping API does not depend on the parser, so you should be able to use any parser. Date iCal provides the mapping target "Field Name: Repeat Rule". Please check what the value to import looks like after parsing. I've created an experimental module to help with this: Feeds import preview.
By looking at the code of Date iCal, the value to import should look like four strings separated by pipes, which represents in this order RRULE, RDATE, EXRULE, and EXDATE.
If you use the latest dev version of Feeds or applied the patch from #2093651: Simplify target callbacks., you will need to apply the patch from #26 on Date iCal.

vaccinemedia’s picture

@MegaChriz thanks for the heads up on this and for pointing me in the right direction. I'm using feeds alpha8 with no patches (the patch linked to doesn't apply correctly using PHP Storm and places a couple of lines in completely the wrong place).

I wasn't too sure what RDATE and EXDATE were in the scheme of things until I added exclude and include dates in my repeat rules and then they started appearing in the DB and views data export as separate rules separated by a return character / new line.

To make the repeat rules import I simply took your advice and used a rewrite tamper on the date field repeat rule of [name_of_date_field_rrule]||| and it started working. There's extra return characters at the end of the rules because of the empty pipes but this doesn't break the import and the rules still appear as they should with or with our excluded or included dates.

I should also add that I updated the start and end dates to be a single value (instead of a comma separated list) in the JSON export and removed the now unnessary explode on commas tampers on the start and end dates as simply having the correct repeating rules creates the multiple date values at the point of being added by the feeds importer :)

Ideally the code could be improved so that the RRULE, RDATE, EXRULE, and EXDATE fields are individually exportable in the view and also treated individually in the feeds importer but that's not relevant to this thread ;)

megachriz’s picture

Status: Needs review » Closed (duplicate)

I see that #2206109: Repeat rule no longer being imported. deals with the exact same issue, so I'm closing this a duplicate since the other issue is older.