I have a webform that I initially set up with a custom To address, but then wanted to change this to a form component. Upon editing the webform and attempting to save this change, I get the following errors and the change is not saved:

The website encountered an unexpected error. Please try again later.

Status message
Email settings updated.

Error message
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '21-1' for key 'PRIMARY': UPDATE {webform_emails} SET nid=:db_update_placeholder_0, email=:db_update_placeholder_1, subject=:db_update_placeholder_2, from_name=:db_update_placeholder_3, from_address=:db_update_placeholder_4, template=:db_update_placeholder_5, excluded_components=:db_update_placeholder_6, html=:db_update_placeholder_7, attachments=:db_update_placeholder_8 WHERE (eid = :db_condition_placeholder_0) ; Array ( [:db_update_placeholder_0] => 21 [:db_update_placeholder_1] => 12 [:db_update_placeholder_2] => Your custom Drupal theming request [:db_update_placeholder_3] => default [:db_update_placeholder_4] => default [:db_update_placeholder_5] => Thanks for submitting your project request! It was received on %date. We will get back to you within 1-2 business days with a quote or further questions. [:db_update_placeholder_6] => 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 [:db_update_placeholder_7] => 0 [:db_update_placeholder_8] => 0 [:db_condition_placeholder_0] => 1 ) in drupal_write_record() (line 6468 of /home/clients/websites/w_d7tnt/public_html/d7tnt/includes/common.inc).

CommentFileSizeAuthor
#3 webform_email_edit-d7.patch673 bytesquicksketch

Comments

stephthegeek’s picture

I also received the same error when deleting the E-mail To action, although it did actually delete it. This is not occurring on two subsequent E-mail To edits.

murias’s picture

I have encountered the exact same error. Might be a slight difference here in that any field being changed on under the emails tab causes this error. This error appears for all WebForms I have created. The changes made do stick.

@stephthegeek... did you happen to come up with a solution?

If anyone needs more information to clear this issue, more than happy to give.

Cheers
Murias

quicksketch’s picture

Title: Error when attempting to change E-mail to address » Error when attempting to edit e-mail settings for a Webform node
Status: Active » Fixed
StatusFileSize
new673 bytes

Thanks, I've confirmed this problem and it looks like it was a simple error in our D7 port. This simple patch fixes our call to drupal_write_record() and makes it so that you can edit e-mail settings again. Committed to the D7 branch.

Status: Fixed » Closed (fixed)

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

jazzdrive3’s picture

Version: 7.x-3.4-beta1 » 7.x-3.13
Status: Closed (fixed) » Active

It seems there is a similar error I've come across when doing something different. Exact same error codes, but I'm trying to edit the Form Settings page and change the redirect URL to a custom one.

Same problem with drupal_write_record() just in a different place, perhaps?

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'AFCamgPBJIpPkXGS-i9kU1wrFAPqvexDtUATatPcd8M' for key 2: INSERT INTO {redirect} (hash, type, uid, source, source_options, redirect, redirect_options, language, status_code, count, access) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10); Array ( [:db_insert_placeholder_0] => AFCamgPBJIpPkXGS-i9kU1wrFAPqvexDtUATatPcd8M [:db_insert_placeholder_1] => redirect [:db_insert_placeholder_2] => 1 [:db_insert_placeholder_3] => contact-us [:db_insert_placeholder_4] => a:0:{} [:db_insert_placeholder_5] => node/3 [:db_insert_placeholder_6] => a:0:{} [:db_insert_placeholder_7] => und [:db_insert_placeholder_8] => 0 [:db_insert_placeholder_9] => 0 [:db_insert_placeholder_10] => 0 ) in drupal_write_record() (line 6868 of /home/webgroup/public_html/includes/common.inc).

quicksketch’s picture

Status: Active » Closed (fixed)

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'AFCamgPBJIpPkXGS-i9kU1wrFAPqvexDtUATatPcd8M' for key 2: INSERT INTO {redirect}

Note that you're inserting into a "redirect" table. You should file your question in whatever module has provided this table, not Webform.