I had the following functionality programmed. I will provide a patch in the next comment. I hope this can get into the main release, since I'm sure others would love this functionality.

Basically, for an event type system, I needed to create a form of a Holiday date on a node, that would auto repeat forever into the future.

However, choosing "Stop repeating - After: 99999 occurrences" wasn't optimal because it creates all the dates at once, and due to performance implications doesn't work when multiple users are doing this same action at the same time. So instead, the following patch provides a new option "Never" with a "PHP strtotime formatted" field.

If I were to add "1 month" into the field, after hitting save, it would add 1 month of occurrences. Every additional site cron run will pull the offset and keep the "1 month" value always current. So if a week has passed, it will pull any occurrences for that passed week that would be valid within that "1 month".

When testing out the patch, be sure to turn on Date caching.

Also, please note, that I am not very PHP savvy, which is why I had this programmed, so I would love any alterations to the patch.

Members fund testing for the Drupal project. Drupal Association Learn more


NWOM’s picture

Status: Active » Needs review
14.49 KB
FAILED: [[SimpleTest]]: [MySQL] Invalid patch format in date.stop_repeating_never.patch. View

Here is the patch based on the current dev shown on the project page (7.x-2.6+2-dev).

Status: Needs review » Needs work

The last submitted patch, date.stop_repeating_never.patch, failed testing.

Anonymous’s picture

Issue summary: View changes

Spelling and typos corrected.

shortspoken’s picture

Any news? Has anyone tested the patch?

cameronbprince’s picture

Here's a re-roll of the patch against the current version of date, but sadly it doesn't work. There are no errors, but when you create a date and then come back and edit it, the values that were entered don't appear to have been saved.

For now I'm going to just go with a high repeat count.

Road Kill’s picture

I am also looking for a feature like this it would be awesome if it makes into the next release.

vtcore’s picture

Priority: Normal » Major
Status: Needs work » Needs review
12.57 KB

Here is an updated patch. It's not tested thoroughly, but it seems to work.

laurelstreng’s picture

Applied the updated patch, and the 'Never' option appears, but I don't think it's working any more? Using the calendar module as well the node only appears once in the calendar even though it's been set to repeat & never stop repeating.

Using the latest Drupal 7.50

DamienMcKenna’s picture

Status: Needs review » Needs work

This needs minor improvements to adhere to the Drupal coding standards, specifically whitespace around brackets, comments before new functions, etc.

jmuzz’s picture

Status: Needs work » Needs review
12.93 KB

Cleaned it up, tweaked the help text, and added a default value that should have it working for most use cases.

Status: Needs review » Needs work

The last submitted patch, 9: date-stop_repeating_never-2076639-9.patch, failed testing.

DamienMcKenna’s picture

Status: Needs work » Needs review
12.52 KB

@jmuzz: When you create patches please make sure they are created correctly otherwise the testbot can't test them.

Here's #9 fixed up so it should apply cleanly.

Status: Needs review » Needs work

The last submitted patch, 11: date-n2076639-11.patch, failed testing.

jmuzz’s picture

Status: Needs work » Needs review
12.91 KB
572 bytes

My bad.

Not sure this will fix the test failure but it does fix my migration problem.

Status: Needs review » Needs work

The last submitted patch, 13: date-stop_repeating_never-2076639-13.patch, failed testing.

dsouza_rohan’s picture

dsouza_rohan’s picture

Status: Needs work » Needs review
dsouza_rohan’s picture

Adding credit comments

Aracon’s picture

Will this patch be added to the module? The function is really helpful for endless repeating events.

NWOM’s picture

@Aracon: The status is "Needs Review".

If you have tested #15, and it applies cleanly to "7.x-2.x-dev" HEAD of the module, you can mark it as "Reviewed by the Community". Only then will it have a chance of being committed.

aitala’s picture

Installed and tested. It seems to do the job.

Chris2’s picture

The patch in #15 works great for me. Would be awesome to get this in 7.x-2.11.

DamienMcKenna’s picture

Status: Needs review » Needs work

This needs a bit of work.

  • date_repeat_cron() should use the field API instead of a query.
  • Instead of using array_key_exists() just use isset().
  • Please don't hardcode 'und' anywhere, either use the constant LANGUAGE_NONE or actually use the entity's language.
  • I really don't like the queries in date_repeat_process_repeat_date_entity_never_field(), they seem really brittle and there might be problems with entity.
  • There are lots of small coding standards problems with the code.

It'd also be nice to have tests to confirm the functionality works as intended.

pyrello’s picture

@DamienMcKenna - As far as I can tell, the usage of array_key_exists in the patch in #15 is consistent with similar lines of code. While I agree with you that isset is the better option for checking whether the key exists, wouldn't it make sense to package code cleanup unrelated to this issue as a separate patch?