hi. it seems that this module is not compatible with webform 7.x-4.x. it simply doesn't return a serial

CommentFileSizeAuthor
#6 1909430-webform4-6.patch6.21 KBcafuego

Comments

GeertWil’s picture

Are there any intentions to port this useful module to webform 7.4?
In 7.4. no serials are created.

liam morland’s picture

Title: incompatible with webform 7.4 » Incompatible with Webform 4
cafuego’s picture

Yeees, I see the problem. Webform 4 assigns data differently in its hook_webform_submission_presave() and that format isn't compatible with the way the v3 module did things.

If you've already saved data, I might need to have an update hook that unbreaks the (now incorrect) data that was saved with serial 1.x on webform 4. If that broken data remains, the module will keep failing and always save a 0. Luckily the value is computed, so I can at calculate correct values at any time.

Quick fix if you do NOT yet have serial data in a webform 4.x table:

diff --git a/components/serial.inc b/components/serial.inc
index 918b31e..47dedba 100644
--- a/components/serial.inc
+++ b/components/serial.inc
@@ -189,7 +189,7 @@ function webform_serial_webform_submission_presave($node, &$submission) {
         $current = (int)$component['extra']['initial'] - $increment;
       }
 
-      $submission->data[$cid]['value'] = array(0 => $current + $increment);
+      $submission->data[$cid][0] = ($current + $increment);
     }
   }
 }

Alternatively, wait for the 7.x-4.x-dev package.

liam morland’s picture

Instead of a completely new branch, you might be able to fix it with version detection, as was done in Webform Tokens. See #1717934: Support Webform 4.x.

cafuego’s picture

Assigned: Unassigned » cafuego

Guessing at a version and hoping it will keep working is pretty yuck. I can probably get away with it for now, but I opened #1941396: API version to hopefully just solve that particular problem once and for all.

cafuego’s picture

Status: Active » Needs review
StatusFileSize
new6.21 KB

Attached is a patch that should solve the problem *and* fix up data was that saved in the incorrect 3.x format if you're on 4.x Please give it a try.

liam morland’s picture

Issue summary: View changes
Status: Needs review » Fixed

This fix does not correct information previously submitted incorrectly. With these changes 7.x-1.x is compatible with both Webform 3 and Webform 4.

http://drupalcode.org/project/webform_serial.git/commitdiff/f0f7daa
http://drupalcode.org/project/webform_serial.git/commitdiff/02f2b13

liam morland’s picture

Assigned: cafuego » Unassigned
liam morland’s picture

Improved Webform version checking so that it defaults for WF4 when working from git, which causes the version number to be absent.

http://drupalcode.org/project/webform_serial.git/commitdiff/4a610fd

Status: Fixed » Closed (fixed)

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