Repeatable: Always
Steps to repeat:
1. Create a multi-page webform that has Save Draft capability.
2. Create a rule that fires "After a webform has been saved as draft"
3. Test the rule by saving multiple drafts. It will fire the first time that the user saves a draft, but not again after that.
4. Create a rule that fires "After a webform submission has been updated"
5. Repeat #3 and you'll see that the Save Draft rule first on the first saved draft and the Submission Updated rule fires on subsequent drafts.
Expected Results:
The Save Draft rule to fire on each saved draft, not just the first one. The Submission Updated rule not to fire at all when the user save drafts -- to only fire when the user hits the Submit button at the end.
Comments
Comment #1
woop_light CreditAttribution: woop_light commentedGreat module by the way!
Comment #2
guignonv CreditAttribution: guignonv commentedI had a similar issue and I think the problem comes from a bad copy-paste in the source code of "webform_rules.module" in "webform_rules_rules_invoke_event" function. Around line 132, you got:
----------
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;
case 'submit':
rules_invoke_event('webform_rules_insert', $user, $node, $data, $form_id);
break;
case 'update':
rules_invoke_event('webform_rules_update', $user, $node, $data, $form_id);
break;
case 'delete':
rules_invoke_event('webform_rules_delete', $user, $node, $data, $form_id);
break;
}
----------
If you noticed, it seems that 'submit' and 'insert' case labels have been swapped. IMHO, it should be:
----------
switch ($op) {
case 'submit':
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;
case 'insert':
rules_invoke_event('webform_rules_insert', $user, $node, $data, $form_id);
break;
case 'update':
rules_invoke_event('webform_rules_update', $user, $node, $data, $form_id);
break;
case 'delete':
rules_invoke_event('webform_rules_delete', $user, $node, $data, $form_id);
break;
}
----------
Apologizes: I should provide a patch and also test that but I'm running out of time and I just got enough for a copy & paste. I'll try to come back with something more convenient.
Comment #3
guignonv CreditAttribution: guignonv commentedI finally did it there:
https://www.drupal.org/node/1964590#comment-9143817
Maybe this bug should be also marked as duplicate of #1964590?
Comment #4
guignonv CreditAttribution: guignonv commented