On a webform configuration page, eg. node/443/webform/configure, the 'Next submission number' under the 'Advanced Settings' fieldset doesn't update between node submissions if Entity Cache is enabled.

This means that the form complains upon resubmission that The next submission number must be at least [#number] (greater than any existing serial number).

This problem only occurs when Entity Cache is enabled. Clearing the cache before loading the configuration page will cause the 'Next submission number' to display correctly.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DanChadwick’s picture

Priority: Major » Normal

It's going to be up to someone that uses Entity Cache to provide a patch this.

petednz’s picture

Title: 'Next sumbmission number' doesn't update with Entity Cache » 'Next submission number' doesn't update with Entity Cache

just taking out typo in title - fyi on the OP we disabled entity cache

petednz’s picture

And flagging that I just edited a(nother?) webform on same system and again got the warning that the submission ID needed to be higher - so not clear if the issue is that turning entity cache off is a sufficient solution for us, or if it is once we resave all webform settings, or something else.

DanChadwick’s picture

I suspect this has been fixed. The code now uses the higher of the serial number in the webform node or the highest serial number used + 1.
#2349081: Drush sql-sync and PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'xxx' for key 'nid_serial': INSERT INTO {webform_submissions}

Please re-open if this is not fixed in the latest dev and hopefully a patch. ;)

aaron.ferris’s picture

I've just come across this issue using 7.x-4.8 and entity cache. I believe the issue is the default value for the 'Next submission number' is using a cached value from the node object. I'm working on a patch that i'll add once it's done, pretty sure it fixes the issue seen here (at least it seems to for me).

I hope i'm OK in reopening this....

aaron.ferris’s picture

Version: 7.x-4.1 » 7.x-4.7
Status: Closed (duplicate) » Needs work
aaron.ferris’s picture

Version: 7.x-4.7 » 7.x-4.8
aaron.ferris’s picture

aaron.ferris’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 8: next-submission-number-non-cached-2333139-8.patch, failed testing.

DanChadwick’s picture

Status: Needs work » Fixed
FileSize
5.8 KB

There's a problem with #8. If you set the serial number to be much higher -- e.g. 100000, then edit the webform again, you'll lose that setting. It would be reset to the next highest number.

This patch:

  1. Removes the test around the 4 existing calls to reset the entity cache for the node so that the cache is reset for the node even if entitycache isn't installed. There is no reason to not do this if there is static caching as it would be stale too.
  2. Add a cache reset to the building of the form settings page and a node reload. This will ensure that the displayed value is the latest one at the time the form is first built.
  3. Removes the validation for the next serial.
  4. Replaces the validation with code which increases the next serial if it is too small, and gives a success message if it had to do so. In this way, and error is turned into a success. This handles the case where the next serial was increased by submissions during form editing.

I have tested this with and without entitycache. I am not using memcache, so additional testing would be helpful.

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

  • DanChadwick committed 8bf96fa on 7.x-4.x
    Issue #2333139 by DanChadwick: 'Next submission number' doesn't update...
aaron.ferris’s picture

Thanks Dan. Looks good with respect to the issue we were seeing.

Status: Fixed » Closed (fixed)

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