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 »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • DB Error on registration (drupal) when matching user to an existing contact
Pages: [1]

Author Topic: DB Error on registration (drupal) when matching user to an existing contact  (Read 1259 times)

laborg

  • Guest
DB Error on registration (drupal) when matching user to an existing contact
November 04, 2008, 12:37:12 am
Hi!

I'm using Drupal 5.12 and Civicrm 2.0.6. (php 5.2, mysql 5). My problem is: When a user wants to register through the drupal registration page, including some fields from custom civicrm data, and the user is matched to an existing contact (previsous csv import) following error is thrown:

Code: [Select]
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -5
    [message] => DB Error: already exists
    [mode] => 16
    [debug_info] => INSERT INTO civicrm_value_1_mitgliedsdaten_1  SET `schwerpunkt` = '', domain_id = 1, entity_id = 168  [nativecode=1062 ** Duplicate entry '1-168' for key 2]
    [type] => DB_Error
    [user_info] => INSERT INTO civicrm_value_1_mitgliedsdaten_1  SET `schwerpunkt` = '', domain_id = 1, entity_id = 168  [nativecode=1062 ** Duplicate entry '1-168' for key 2]
    [to_string] => [db_error: message="DB Error: already exists" code=-5 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_value_1_mitgliedsdaten_1  SET `schwerpunkt` = '', domain_id = 1, entity_id = 168  [nativecode=1062 ** Duplicate entry '1-168' for key 2]"]
)


Okt 16 08:11:16  [info] $backTrace = /home/vhosts/ttt/drupal/sites/all/modules/civicrm/CRM/Core/Error.php, backtrace, 192
, handle,
/home/vhosts/ttt/drupal/sites/all/modules/civicrm/packages/PEAR.php, call_user_func, 901
/home/vhosts/ttt/drupal/sites/all/modules/civicrm/packages/DB.php, PEAR_Error, 888
/home/vhosts/ttt/drupal/sites/all/modules/civicrm/packages/PEAR.php, DB_Error, 563
/home/vhosts/ttt/drupal/sites/all/modules/civicrm/packages/DB/common.php, raiseError, 1849
/home/vhosts/ttt/drupal/sites/all/modules/civicrm/packages/DB/mysql.php, raiseError, 894
/home/vhosts/ttt/drupal/sites/all/modules/civicrm/packages/DB/mysql.php, mysqlRaiseError, 324
/home/vhosts/ttt/drupal/sites/all/modules/civicrm/packages/DB/common.php, simpleQuery, 1162
/home/vhosts/ttt/drupal/sites/all/modules/civicrm/packages/DB/DataObject.php, query, 2343
/home/vhosts/ttt/drupal/sites/all/modules/civicrm/packages/DB/DataObject.php, _query, 1566
/home/vhosts/ttt/drupal/sites/all/modules/civicrm/CRM/Core/DAO.php, query, 765
/home/vhosts/ttt/drupal/sites/all/modules/civicrm/CRM/Core/BAO/CustomValueTable.php, executeQuery, 144
/home/vhosts/ttt/drupal/sites/all/modules/civicrm/CRM/Core/BAO/CustomValueTable.php, create, 218
/home/vhosts/ttt/drupal/sites/all/modules/civicrm/CRM/Contact/BAO/Contact.php, store, 482
/home/vhosts/ttt/drupal/sites/all/modules/civicrm/CRM/Contact/BAO/Contact.php, create, 1790
/home/vhosts/ttt/drupal/sites/all/modules/civicrm/CRM/Profile/Form.php, createProfileContact, 534
/home/vhosts/ttt/drupal/sites/all/modules/civicrm/CRM/Profile/Form/Dynamic.php, postProcess, 131
/home/vhosts/ttt/drupal/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Submit.php, postProcess, 77
/home/vhosts/ttt/drupal/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php, perform, 195
/home/vhosts/ttt/drupal/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php, handle, 95
/home/vhosts/ttt/drupal/sites/all/modules/civicrm/CRM/Core/Controller.php, handle, 223
/home/vhosts/ttt/drupal/sites/all/modules/civicrm/CRM/Core/BAO/UFGroup.php, run, 485
/home/vhosts/ttt/drupal/sites/all/modules/civicrm/drupal/civicrm.module, getEditHTML, 490
/home/vhosts/ttt/drupal/sites/all/modules/civicrm/drupal/civicrm.module, civicrm_register_data, 409
/home/vhosts/ttt/drupal/modules/user/user.module, civicrm_user, 22
/home/vhosts/ttt/drupal/modules/user/user.module, user_module_invoke, 216
/home/vhosts/ttt/drupal/modules/user/user.module, user_save, 1274
, user_register_submit,
/home/vhosts/ttt/drupal/includes/form.inc, call_user_func_array, 430
/home/vhosts/ttt/drupal/includes/form.inc, drupal_submit_form, 258
/home/vhosts/ttt/drupal/includes/form.inc, drupal_process_form, 80
, drupal_get_form,
/home/vhosts/ttt/drupal/includes/menu.inc, call_user_func_array, 418
/home/vhosts/ttt/drupal/index.php, menu_execute_active_handler, 15

Has anyone got hints about what I can do or where to start?

Thanks in advance,
Gerhard[/code]

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: DB Error on registration (drupal) when matching user to an existing contact
November 04, 2008, 06:51:56 am

1. any chance u can upgrade and see if the behavior is the same?

2. if not, you might want to hack/debug: CRM/Core/BAO/CustomValueTable.php, function create and change / modify the INSERT INTO to a REPLACE INTO (check the mysql manual)

3. not sure why the code does not find the 'id' of the row. so there is a bug in there somewhere

lobo

A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

laborg

  • Guest
Re: DB Error on registration (drupal) when matching user to an existing contact
November 05, 2008, 09:47:17 am
Hi again!

I tried to narrow it down and found out following:

When a user registers, and the matching rule fits, the mentioned error occurs only when no option of the custom field "schwerpunkt" is chosen.

More info on my settings:
1) The custom field "schwerpunkt" is a multiple alphanumeric checkbox which is active, not required and searchable.
2) All other custom fields used on the same registration form don't suffer from this problem, but none of them have a fieldtype like "schwerpunkt".

How's civicrm handling a registration request without any checked checkboxes of a custom field compared to one with checked checkboxes? I know from pure html that when a form is submitted and a checkbox is not checked, the checkbox isn't available as a request parameter at all, but I can't imaging that civicrm wouldn't take care of this...

1000x thanks,
gerhard

superturboultra

  • Guest
Re: DB Error on registration (drupal) when matching user to an existing contact
January 14, 2009, 02:51:19 pm
Donald,

I successfully followed your instructions. Thank you, you saved me quite a bit of time debugging (or at the very least a grep or two).

Browsing other threads with similar issues, it seems to happen when you connect a drupal user to a civicrm contact, when there's a custom checkbox field, and the checkbox field is empty.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • DB Error on registration (drupal) when matching user to an existing contact

This forum was archived on 2017-11-26.