Create a Webform with two components: a page break followed by something else. Set the Webform to save draft when changing pages. When the form is submitted, it will have advanced by two serial numbers.

Why: webform_submission_create() is getting called when the advancing to the next page, but nothing is saved because of the call to return a few lines later ("If there is no data to be saved..."). So, webform_submission_create() is called again on submit. Each time webform_submission_create() is called, the serial number advances.

Comments

liam morland’s picture

Here are two possible solutions:

One causes empty submissions to be saved. I don't think the inefficiency is a problem anymore due to changes in webform_get_submissions().

The other assigns the serial number at the same time that the sid is assigned and makes it NULL in webform_submission_create(). I suppose this means that the serial number token would be NULL on a preview page, but maybe that is OK since that token is not certain to be correct anyway.

This might also be fixable in webform_client_form_submit() by having it so that an equivalent to the "If there is no data to be saved..." return statement is called before webform_submission_create().

liam morland’s picture

Status: Active » Needs review
danchadwick’s picture

Version: 7.x-4.x-dev » 8.x-4.x-dev
Status: Needs review » Fixed
StatusFileSize
new2.93 KB
new2.93 KB

Excellent. I also remove the $do_update parameter, as it is no longer needed. Yeah!

Committed to 7.x-4.x and 8.x

  • DanChadwick committed e885e47 on 7.x-4.x
    Issue #2358317 by Liam Morland: Fixed Serial numbers can be skipped if...
  • DanChadwick committed 678d817 on 8.x-4.x
    Issue #2358317 by Liam Morland: Fixed Serial numbers can be skipped if...
danchadwick’s picture

Status: Fixed » Closed (fixed)

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

danchadwick’s picture

Version: 8.x-4.x-dev » 7.x-4.x-dev