when trying to clone a webform in 3.x i get messages like
4 times
Warning: Table 'watchdog' was not locked with LOCK TABLES query: INSERT INTO watchdog (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (3, 'php', '%message in %file on line %line.', 'a:4:{s:6:\"%error\";s:12:\"user warning\";s:8:\"%message\";s:819:\"Duplicate entry '34608-1' for key 1\nquery: INSERT INTO webform_component (nid, cid, pid, form_key, name, type, value, extra, mandatory, weight) VALUES (34608, 1, 0, 'texttext', 'texttext', 'textfield', '', 'a:11:{s:8:\\"disabled\\";i:0;s:5:\\"width\\";s:0:\\"\\";s:9:\\"maxlength\\";s:0:\\"\\";s:12:\\"field_prefix\\";s:0:\\"\\";s:12:\\"field_suffix\\";s:0:\\"\\";s:11:\\ in /home/web/includes/database.mysqli.inc on line 128
and then an error message on the next regular page for each field of the form
user warning: Duplicate entry '34608-3' for key 1 query: INSERT INTO webform_component (nid, cid, pid, form_key, name, type, value, extra, mandatory, weight) VALUES (34608, 3, 0, 'your_name', 'Your Name', 'textfield', '%username', 'a:11:{s:8:\"disabled\";i:0;s:5:\"width\";s:0:\"\";s:9:\"maxlength\";s:0:\"\";s:12:\"field_prefix\";s:0:\"\";s:12:\"field_suffix\";s:0:\"\";s:11:\"description\";s:0:\"\";s:10:\"attributes\";a:0:{}s:6:\"unique\";i:0;s:21:\"conditional_component\";s:0:\"\";s:20:\"conditional_operator\";s:1:\"=\";s:18:\"conditional_values\";s:0:\"\";}', 1, 1) in /home/sites/swdx/web/sites/all/modules/webform/includes/webform.components.inc on line 635.
Finally the node was created, but surely without components and without any email setup.
I think this should be fixed in webform and not in node clone.
Comment | File | Size | Author |
---|---|---|---|
#19 | webform_clone_emails.patch | 4 KB | quicksketch |
#4 | webform_component_update_nid.patch | 695 bytes | quicksketch |
#3 | webform_clone_fix.patch | 708 bytes | quicksketch |
Comments
Comment #1
miro_dietikerBTW: there was not even a message about the emails. So it seems the emails wouldn't get cloned this way any more.
This might need an additional workaround then.
Comment #2
roball CreditAttribution: roball commentedOh damned - confirmed with beta 5. I get no warning or error message in the browser, and the dblog doesn't contain any indication of failure either, but the clone does not contain any component and has no e-mail setup.
In the webserver's error log, PHP warnings like this appear:
Comment #3
quicksketchThis looks like it was a regression introduced by #766780: hook_webform_component_insert() is called when form settings are saved. I got too carried away in a clean up and removed a line that (seemingly) had no purpose. Oddly I already even had a code comment saying that the segment of code was "Used with clone.module" but I seemed to overlook it. I've re-added this line with a more explicit comment so that I don't delete it again.
Comment #4
quicksketchI found another similar bug that occurs when doing a node_load(), changing a webform component, then doing a node_save(). This should prevent problems in the future with this API bug. It does not affect the normal usage of Webform though, since creating and editing a component normally does not use node_save() to save the changed component.
Comment #5
roball CreditAttribution: roball commentedThank you - with Webform 6.x-3.x-dev (2010-Apr-14) the "Form components" tab was populated again, which is of course the most important part to be cloned :-) There are also no problems with cloning the contents of the "Form settings" tab.
The only thing which still won't be cloned is the stuff in the "E-mails" tab, which is however not really that important.
Comment #6
miro_dietikerConfirm -dev to work properly for components.
Yes, still missing email notification setup to be cloned...
The clone module might should introduce something like a hook to let modules duplicate the extended node (content) itself. Webforms could then react on that and duplicate things that are out of scope of a regular node_load into the new node.
Comment #7
miro_dietikerIf we're adding a node translation using i18n, the components won't be copied in current -dev. Only the base form information is there. Is this a different issue and needs a different ticket?
Comment #8
quicksketchYes, please open a different issue. It seems that node cloning works alright right now in dev for at least components.
Comment #9
miro_dietikerAdded translation duplication implementation request:
#774206: Add webform components on translation.module duplication
Comment #10
roball CreditAttribution: roball commentedIs cloning of the E-mails settings being planned to be re-included in 6.x-3.0?
Comment #11
quicksketchYes, cloning including the e-mail settings will be added to 3.x shortly.
Comment #12
candelas CreditAttribution: candelas commentedthanks quicksketch
now i have to make it by hand but for transllation it will be great :)
Comment #13
roball CreditAttribution: roball commentedI would be happy to test the fix in 3.x immediately when it's committed.
Comment #14
wylbur CreditAttribution: wylbur commentedInstalled the 6.x-3.0-beta5 version today, and get errors that were very similar to the errors listed in comment #2. Rather than post them here, I can confirm that the problem was resolved by applying the patch in comment #3.
I also applied the patch in #4, but did this did not seem to have any effect either way - the patch in comment #3 worked with and without the patch in comment #4.
Thanks.
Comment #15
roball CreditAttribution: roball commentedYes, you should either go with the current 6.x-3.x-dev version or apply patch from #4 to beta5.
Comment #16
donquixote CreditAttribution: donquixote commentedsame problem here, subscribe.
Comment #17
miro_dietikerTo make the emails clone there's only needed to add:
webform.module ~@850
in function webform_node_insert
Don't forget to add this code also to the translation case...
Comment #18
roball CreditAttribution: roball commentedGreat - I think if you attach this fix as a patch, then quicksketch may consider to commit it so we have the fix in the next beta. Thanks.
Comment #19
quicksketchI've committed this patch which should include e-mails when nodes are cloned, edited, inserted, or deleted. Just like components, we need not only to do inserts, but also updates which are more complicated. While looking at emails I also found that we hadn't been removing email settings *at all*, meaning that an update function was also in order to clean up any orphaned e-mail settings.
Please review and reopen if there are any lingering problems. This patch has already been committed.
Comment #20
roball CreditAttribution: roball commentedThis now works fine in 6.x-3.0-beta6. Thanks!