You are here

function webform_workflow_webform_submission_insert in Webform Workflow 7

Implements hook_webform_submission_insert().

File

./webform_workflow.module, line 444
A simple workflow module for webforms.

Code

function webform_workflow_webform_submission_insert($node, $submission) {

  // Set new (non-draft) submissions to the default state.
  if (webform_workflow_is_enabled($node) && !$submission->is_draft && !empty($node->webform_workflow->data['new_gets_first_state']) && !webform_workflow_state_load_by_submission($submission)->wsid) {
    $state = webform_workflow_state_get_default($node);
    if (!$state) {
      return;
    }
    $notify = !empty($node->webform_workflow->data['new_triggers_notification']);
    webform_workflow_transition($submission, $state, t('Set automatically on initial submission'), NULL, $notify, FALSE);
  }
}