is

switch ($op) {
    case 'insert':
      if ($is_draft) {
        rules_invoke_event('webform_rules_submit_as_draft', $user, $node, $data, $form_id);
      }
      else {
        rules_invoke_event('webform_rules_submit', $user, $node, $data, $form_id);
      }
      break;>

should be:

 switch ($op) {
    case 'insert':
      if ($is_draft) {
        rules_invoke_event('webform_rules_submit_as_draft', $user, $node, $data, $form_id);
      }
      else {
        rules_invoke_event('webform_rules_insert', $user, $node, $data, $form_id); //_insert instead of _submit
      }
      break;
CommentFileSizeAuthor
#5 rules-fire-1848302-5.patch1.03 KBjason.bell

Comments

stborchert’s picture

Version: 7.x-1.4 » 7.x-1.x-dev
Status: Active » Fixed

Uh, thats a very nasty bug (and it has been there very long without anyone noticing it :( ).
From a first sight the change is very easy but if I'm changing as you suggested (which equals the original intention behind this code) nearly all sites using Webform Rules will break :(

Op "insert" is called if the webform is submitted (and the submission is saved) so I need to invoke "webform_rules_submit". Changing this now to "webform_rules_insert" will cause all installations to change their rules to react on the correct event.
So I decided to do the following:

  • rename the event webform_rules_insert to "After a submission draft has been submitted"
  • invoke webform_rules_insert in function "webform_rules_client_form_submit" (called after submitting the form while viewing a submission draft)
  • invoke webform_rules_submit when adding a non-draft submission (matches old behavior)

Hopefully this will not affect as many installations as changing the calls to the (logically) correct ones.

Committed to 7.x and 6.x (new release will follow within the next days).

Status: Fixed » Closed (fixed)

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

bmiller146’s picture

I don't see a new build for 6.X since Feb 13, 2012. Did this fix ever get included in the 6.x code per comment #1?

andirez’s picture

It appears that it was not, just stumbled upon this error and thankfully I found this post and was able to quickly fix the code as instructed above. My rule gets called now upon webform submission.

jason.bell’s picture

Issue summary: View changes
StatusFileSize
new1.03 KB

Running Webform Rules 7.x-1.6 and rules are not firing on submission.
There is no -dev release available to download from the project page, so here is patch for those who stumble across it.