6

I would like users to be able to mass update recurring date rules possibly using VBO and Rule sets.

For example: user would like to add "exclude date = 01/01/2012" recurring date rule for all selected nodes' dates where date is a new field added to a content type.

How to do this ?

---=EDIT=---

I have already build a basic Rule with the following code:

{ "rules_change_end_date_for_selected_content" : {
    "LABEL" : "Change end date for selected content(s) (Test rule)",
    "PLUGIN" : "rule",
    "REQUIRES" : [ "rules" ],
    "USES VARIABLES" : {
      "node" : { "label" : "Content", "type" : "node" },
      "event_end_date" : { "label" : "Event End Date", "type" : "date" }
    },
    "IF" : [
      { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_event_date" } },
      { "node_is_of_type" : { "node" : [ "node" ], "type" : { "value" : { "event" : "event" } } } }
    ],
    "DO" : [
      { "data_set" : {
          "data" : [ "node:field-event-date:0:value2" ],
          "value" : [ "event-end-date" ]
        }
      },
      { "entity_save" : { "data" : [ "node" ] } }
    ]
  }
}

What should I put instead of node:field-event-date:0:value2 to modify the date rule end date ( not the first date enddate). I would like to change the date until this node repeats but I cannot see tokens for the date repeating rule.

1

3 Answers 3

1

This sounds like it will need a custom module, However have you tried the bulk update module?, you could extend this and adapt it for dates, I do not have any code examples, as it does sound quite complex.

1
  • This probably require patch to Date module date.tokens.inc to allow rrule tokens. Please see drupal.org/node/1613842
    – LLub
    Commented Jun 2, 2012 at 8:42
1

Take a look at the Date Repeat Entity module. Module features, see item 2 specifically for your needs:

  • Attach unique content to each date in a recurring series
  • Update current, future or all recurring dates
  • Delete current, future or all recurring dates
  • Configuration per bundle (content type)
  • Provides warnings when updates may affect referenced content
  • Includes hooks for additional control of what gets repeated and when

I personally just started using this module, it's fantastic.

0

In your case, the crucial part of a working rule is a Rules Action to perform a Loop (to replace your first Rules Action to "Set a data value"). If you're not familiar with such loops, then I strongly recommend to have a look at the tutorial titled "Lists and loops".

In your case, you should use (at least) have a Rules Action to create a loop related to your node:field-event-date field (as shown in the rule included in your question). After you do, you should iterate over each item in that list. And for each iteration you should then perform a Rules Action to "Set a data value for the list item being processed in the loop", and set that value to your Rules Component parameter event_end_date.

Done

PS: Refer to my answer to "How to set multiple values to an unlimited Term Refence field with Rules" for some sample rules that are like a variation of your question here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.