You are here

function pardot_submission_save in Pardot Integration 7

Same name and namespace in other branches
  1. 6 pardot.module \pardot_submission_save()

Helper function that save form submissions.

Parameters

object $submission: A submission object.

2 calls to pardot_submission_save()
pardot_page_build in ./pardot.module
Implements hook_page_build().
pardot_webform_submit in ./pardot.module
Form submission handler for pardot_form_alter().

File

./pardot.module, line 384
Pardot integration module.

Code

function pardot_submission_save($submission) {

  // Set some sane defaults for new submissions.
  if (!isset($submission->submitted)) {
    $submission->submitted = $_SERVER['REQUEST_TIME'];
  }
  if (!isset($submission->status)) {
    $submission->status = PARDOT_STATUS_NEW;
  }
  if (isset($submission->sid)) {
    drupal_write_record('pardot_submissions', $submission, array(
      'sid',
    ));
  }
  else {
    drupal_write_record('pardot_submissions', $submission);
  }
}