I'm working on a module that stores additional data that is collected with a webform. The only thing is, I'd like it to be able to store the reference to the submission id, so that it can be loaded in again later.

As it stands now, the webform module captures the $sid for new submissions but doesn't store it with the $form_values, where other modules could make use of it.

It appears that there are additional checks which test the presence of $form_values['details']['sid'] to determine whether or not it is a new submission, so I figured it would be less disruptive to simply create a new entry for it.

I've attached a patch which should accomplish this.

CommentFileSizeAuthor
#1 webform_save_sid.patch1.78 KBquicksketch
save_sid.patch563 bytesmandclu
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

FileSize
1.78 KB

Rather than putting the sid in a new place, I'd prefer to update the sid stored in the details array with the new value. Then set an additional property 'is_new' to say whether this is an insert or an update. This mirrors the approach taken by node insert/update and keeps the sid in a single location. What do you think?

marcingy’s picture

Version: 6.x-2.0-beta2 » 5.x-2.0-beta2
Status: Needs review » Reviewed & tested by the community

Patch in #1 tested. Works correctly. RTBC. Correct version to 5.x-2.0-beta2

quicksketch’s picture

@surge_martin Want to give it a second review or should I go ahead and commit? Just wanting to make sure it'll work in your use-case. No offense marcingy. :D

Morbus Iff’s picture

quicksketch: we're all one big happy family - marcingy, surge_martin, and I are working on the same project :)

quicksketch’s picture

Status: Reviewed & tested by the community » Fixed

Ported to 6.x and committed to both versions.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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