CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • FALSE ALARM - Bug with regards to changing email address in 4.1.2
Pages: [1]

Author Topic: FALSE ALARM - Bug with regards to changing email address in 4.1.2  (Read 989 times)

NASACT

  • I post frequently
  • ***
  • Posts: 289
  • Karma: 9
    • National Association of State Auditors, Comptrollers and Treasurers
  • CiviCRM version: 4.2.2
  • CMS version: Drupal 7
  • MySQL version: 5.1.58 (ubuntu)
  • PHP version: 5.3.5
FALSE ALARM - Bug with regards to changing email address in 4.1.2
June 06, 2012, 12:58:45 pm
I have tried with 3 different browsers and changing the email address in an existing contact record results in the following error.

Error
Error messagePDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'name': INSERT INTO {users} (uid, mail, created) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => 73 [:db_insert_placeholder_1] => firstname.lastname@someplace.gov [:db_insert_placeholder_2] => 1339012572 ) in drupal_write_record() (line 7013 of /home/government/www/services/includes/common.inc).

Reloading the page submits the update correctly.  I flushed site cache and browser cache to be sure it wasn't old form data or temp files.  Anyone else have the same issue?  I haven't tried in the sandbox but I can if need be.

Thanks.
« Last Edit: June 08, 2012, 10:59:20 am by NASACT »
-AJ
My GChat - azon21@gmail.com -  This is where you can find me most days!

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Bug with regards to changing email address in 4.1.2
June 07, 2012, 12:27:23 am
Hi,

This is most probably because you have two accounts with the same email (and drupal doesn't like it).

Please edit your post and replace the email by myname@example.org if it's a real one (spammers don't need help :)
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

NASACT

  • I post frequently
  • ***
  • Posts: 289
  • Karma: 9
    • National Association of State Auditors, Comptrollers and Treasurers
  • CiviCRM version: 4.2.2
  • CMS version: Drupal 7
  • MySQL version: 5.1.58 (ubuntu)
  • PHP version: 5.3.5
Re: Bug with regards to changing email address in 4.1.2
June 07, 2012, 06:26:38 am
I double verified that I do not have duplicate emails. This happens with every contact not specific ones.
-AJ
My GChat - azon21@gmail.com -  This is where you can find me most days!

NASACT

  • I post frequently
  • ***
  • Posts: 289
  • Karma: 9
    • National Association of State Auditors, Comptrollers and Treasurers
  • CiviCRM version: 4.2.2
  • CMS version: Drupal 7
  • MySQL version: 5.1.58 (ubuntu)
  • PHP version: 5.3.5
Re: Bug with regards to changing email address in 4.1.2
June 07, 2012, 06:29:43 am
I could not reproduce this error in the demo site.  Going back to investigate further.
-AJ
My GChat - azon21@gmail.com -  This is where you can find me most days!

NASACT

  • I post frequently
  • ***
  • Posts: 289
  • Karma: 9
    • National Association of State Auditors, Comptrollers and Treasurers
  • CiviCRM version: 4.2.2
  • CMS version: Drupal 7
  • MySQL version: 5.1.58 (ubuntu)
  • PHP version: 5.3.5
Re: Bug with regards to changing email address in 4.1.2
June 07, 2012, 06:38:29 am
No possible duplicates were found using IndividualStrict rule.
No possible duplicates were found using IndividualComplete rule.
No possible duplicates were found using IndividualFuzzy rule.

Cache has been cleared and menu has been rebuilt successfully.

Still having same issue.

What's strange is that pushing the browser back button and hitting cancel on the record sends you to summary page but shows the email address change that I get the error from.

Checking some other things just in case it is from another module.
-AJ
My GChat - azon21@gmail.com -  This is where you can find me most days!

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Bug with regards to changing email address in 4.1.2
June 07, 2012, 06:47:19 am
The problem & error message that you have is with the CMS (the user table), not on civicrm side.

I don't know why it's an insert & not an update, it looks like your user table (on drupal) is out of sync with your contact table.

I'm afraid can't help you more than that. You will have to dig into the code if no one else got an idea.
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

NASACT

  • I post frequently
  • ***
  • Posts: 289
  • Karma: 9
    • National Association of State Auditors, Comptrollers and Treasurers
  • CiviCRM version: 4.2.2
  • CMS version: Drupal 7
  • MySQL version: 5.1.58 (ubuntu)
  • PHP version: 5.3.5
Re: Bug with regards to changing email address in 4.1.2
June 07, 2012, 06:57:52 am
Okay, I will look into that. Running the latest for both so not sure how that happened.
-AJ
My GChat - azon21@gmail.com -  This is where you can find me most days!

NASACT

  • I post frequently
  • ***
  • Posts: 289
  • Karma: 9
    • National Association of State Auditors, Comptrollers and Treasurers
  • CiviCRM version: 4.2.2
  • CMS version: Drupal 7
  • MySQL version: 5.1.58 (ubuntu)
  • PHP version: 5.3.5
Re: Bug with regards to changing email address in 4.1.2
June 07, 2012, 07:08:18 am
I only have one drupal user account and so I checked it. Do you think this error is the result of not having a user account for each contact?  I wouldn't think that was the case but it would explain why drupal is trying to insert instead of update.
-AJ
My GChat - azon21@gmail.com -  This is where you can find me most days!

NASACT

  • I post frequently
  • ***
  • Posts: 289
  • Karma: 9
    • National Association of State Auditors, Comptrollers and Treasurers
  • CiviCRM version: 4.2.2
  • CMS version: Drupal 7
  • MySQL version: 5.1.58 (ubuntu)
  • PHP version: 5.3.5
Re: Bug with regards to changing email address in 4.1.2
June 07, 2012, 07:17:59 am
Code that is executing when error is returning 

// Build the SQL.
  if (empty($primary_keys)) {
    // We are doing an insert.
    $options = array('return' => Database::RETURN_INSERT_ID);
    if (isset($serial) && isset($fields[$serial])) {
      // If the serial column has been explicitly set with an ID, then we don't
      // require the database to return the last insert id.
      if ($fields[$serial]) {
        $options['return'] = Database::RETURN_AFFECTED;
      }
      // If a serial column does exist with no value (i.e. 0) then remove it as
      // the database will insert the correct value for us.
      else {
        unset($fields[$serial]);
      }
    }
    $query = db_insert($table, $options)->fields($fields);
    $return = SAVED_NEW;
  }
  else {
    $query = db_update($table)->fields($fields);
    foreach ($primary_keys as $key) {
      $query->condition($key, $object->$key);
    }
    $return = SAVED_UPDATED;
  }
-AJ
My GChat - azon21@gmail.com -  This is where you can find me most days!

NASACT

  • I post frequently
  • ***
  • Posts: 289
  • Karma: 9
    • National Association of State Auditors, Comptrollers and Treasurers
  • CiviCRM version: 4.2.2
  • CMS version: Drupal 7
  • MySQL version: 5.1.58 (ubuntu)
  • PHP version: 5.3.5
Re: Bug with regards to changing email address in 4.1.2
June 07, 2012, 07:20:39 am
Wait I might know the root cause.  If we dumped all user accounts from previous drupal install but brought CiviCRM over and had already performed the user to contact sync would this create values that ultimately need to be deleted from a table so that this flushes the connections until user accounts are recreated?
-AJ
My GChat - azon21@gmail.com -  This is where you can find me most days!

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Bug with regards to changing email address in 4.1.2
June 07, 2012, 08:13:16 am
Ah!

Yes, you have incorrect items in the table that links drupal users & civicrm contacts. THat's civicrm_uf_join from the top of my head. You need to delete the entries where the drupal user doesn't exist
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

NASACT

  • I post frequently
  • ***
  • Posts: 289
  • Karma: 9
    • National Association of State Auditors, Comptrollers and Treasurers
  • CiviCRM version: 4.2.2
  • CMS version: Drupal 7
  • MySQL version: 5.1.58 (ubuntu)
  • PHP version: 5.3.5
Re: Bug with regards to changing email address in 4.1.2
June 07, 2012, 08:33:23 am
I checked that table but I don't see any related information.  I can easily fix this by creating user accounts and running sync right?
-AJ
My GChat - azon21@gmail.com -  This is where you can find me most days!

NASACT

  • I post frequently
  • ***
  • Posts: 289
  • Karma: 9
    • National Association of State Auditors, Comptrollers and Treasurers
  • CiviCRM version: 4.2.2
  • CMS version: Drupal 7
  • MySQL version: 5.1.58 (ubuntu)
  • PHP version: 5.3.5
Re: Bug with regards to changing email address in 4.1.2
June 07, 2012, 08:38:29 am
I think I found the table "civicrm_uf_match"?
-AJ
My GChat - azon21@gmail.com -  This is where you can find me most days!

NASACT

  • I post frequently
  • ***
  • Posts: 289
  • Karma: 9
    • National Association of State Auditors, Comptrollers and Treasurers
  • CiviCRM version: 4.2.2
  • CMS version: Drupal 7
  • MySQL version: 5.1.58 (ubuntu)
  • PHP version: 5.3.5
Re: Bug with regards to changing email address in 4.1.2
June 07, 2012, 10:08:23 am
Yep that was the table. all errors are gone. Stupid me and the migration :).
-AJ
My GChat - azon21@gmail.com -  This is where you can find me most days!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • FALSE ALARM - Bug with regards to changing email address in 4.1.2

This forum was archived on 2017-11-26.