You are here

function _webform_submission_serial_next_value_used in Webform 7.4

Returns the next submission serial number to be used.

This is based on the submissions in the database.

Parameters

int $nid: The Node ID of the Webform.

Return value

int The largest serial number used by a submission plus 1 for the specified node or 1 when there are no submissions.

2 calls to _webform_submission_serial_next_value_used()
webform_configure_form_submit in includes/webform.pages.inc
Submit handler for webform_configure_form().
_webform_submission_serial_next_value in ./webform.module
Returns the next serial number for a given node and increments it.

File

./webform.module, line 5418
This module provides a simple way to create forms and questionnaires.

Code

function _webform_submission_serial_next_value_used($nid) {
  $max_serial = db_select('webform_submissions');
  $max_serial
    ->addExpression('MAX(serial)');
  $max_serial = $max_serial
    ->condition('nid', $nid)
    ->execute()
    ->fetchField();

  // $max_serial will be a numeric string or NULL.
  return $max_serial + 1;
}