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 CiviEvent (Moderator: Yashodha Chaku) »
  • Event registration CRM_Core_Error
Pages: [1]

Author Topic: Event registration CRM_Core_Error  (Read 3218 times)

jvernon

  • Guest
Event registration CRM_Core_Error
April 13, 2010, 12:40:53 pm
I've set up an event where it is possible to register multiple participants. I tested the registration by entering 2 participants and saying I'll pay later. I enter both participants' info. When I continue beyond the summary page I receive the following error message. Any ideas on what the problem is?

Sorry. A non-recoverable error has occurred.

DB Error: constraint violation

Database Error Code: Cannot add or update a child row: a foreign key constraint fails (`civicrm/civicrm_value_bingham_cup_2010_12`, CONSTRAINT `FK_civicrm_value_bingham_cup_2010_12_entity_id` FOREIGN KEY (`entity_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE), 1452

Return to home page.

Error Details:


Array
(
    [callback] => Array
        (
           
  • => CRM_Core_Error
  • [1] => handle
            )

       
Code: [Select]
=> -3
    [message] => DB Error: constraint violation
    [mode] => 16
    [debug_info] => INSERT INTO civicrm_value_bingham_cup_2010_12  ( i_am_a_playing_in_the_2010_bingh_50,i_will_have_appropriate_insuranc_52,exact_legal_name_displayed_on_go_51,room_sharing_54,entity_id ) VALUES ( 0,0,'','',310 ) ON DUPLICATE KEY UPDATE i_am_a_playing_in_the_2010_bingh_50 = 0,i_will_have_appropriate_insuranc_52 = 0,exact_legal_name_displayed_on_go_51 = '',room_sharing_54 = '' [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`civicrm/civicrm_value_bingham_cup_2010_12`, CONSTRAINT `FK_civicrm_value_bingham_cup_2010_12_entity_id` FOREIGN KEY (`entity_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)]
    [type] => DB_Error
    [user_info] => INSERT INTO civicrm_value_bingham_cup_2010_12  ( i_am_a_playing_in_the_2010_bingh_50,i_will_have_appropriate_insuranc_52,exact_legal_name_displayed_on_go_51,room_sharing_54,entity_id ) VALUES ( 0,0,'','',310 ) ON DUPLICATE KEY UPDATE i_am_a_playing_in_the_2010_bingh_50 = 0,i_will_have_appropriate_insuranc_52 = 0,exact_legal_name_displayed_on_go_51 = '',room_sharing_54 = '' [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`civicrm/civicrm_value_bingham_cup_2010_12`, CONSTRAINT `FK_civicrm_value_bingham_cup_2010_12_entity_id` FOREIGN KEY (`entity_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)]
    [to_string] => [db_error: message="DB Error: constraint violation" code=-3 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_value_bingham_cup_2010_12  ( i_am_a_playing_in_the_2010_bingh_50,i_will_have_appropriate_insuranc_52,exact_legal_name_displayed_on_go_51,room_sharing_54,entity_id ) VALUES ( 0,0,'','',310 ) ON DUPLICATE KEY UPDATE i_am_a_playing_in_the_2010_bingh_50 = 0,i_will_have_appropriate_insuranc_52 = 0,exact_legal_name_displayed_on_go_51 = '',room_sharing_54 = '' [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`civicrm/civicrm_value_bingham_cup_2010_12`, CONSTRAINT `FK_civicrm_value_bingham_cup_2010_12_entity_id` FOREIGN KEY (`entity_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)]"]


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: Event registration CRM_Core_Error
April 13, 2010, 10:09:34 pm

1. if you are on 2.1 you might want to consider upgrading to 3.1.3 (or 3.1.4 in the next day or so)

2. what object does the custom group extend?

3. Did you change that via the UI or the DB recently

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

jvernon

  • Guest
Re: Event registration CRM_Core_Error
April 14, 2010, 10:40:05 am
We are on the most recent version of CiviCRM. There is no custom group.

The custom profiles we are using in the registration consist of individual, participant and contact fields. Does this help? Do you need more information?

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: Event registration CRM_Core_Error
April 14, 2010, 10:43:29 am

you might want to ask your developer/consultant/integrator to take a look. the error is from a custom group. Your other option might be to delete the custom group and start with a clean slate

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

jvernon

  • Guest
Re: Event registration CRM_Core_Error
April 14, 2010, 03:20:31 pm
I have a profile that consists of 6 fields. 4 are participant fields; 2 are individual fields. Is there a problem with using this profile in the event definition.


xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Event registration CRM_Core_Error
April 14, 2010, 04:35:06 pm
Try disabling the participant fields. Used to have problems when you mix participant fields and contact fields (you can still use the pre for the contact and post for the participant fields).

What are the custom fields you use ? Can you try reproducing on demo.civicrm.org ?

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

jvernon

  • Guest
Re: Event registration CRM_Core_Error
April 14, 2010, 07:43:14 pm
Thank you. I managed to overcome the problem by

1. creating a custom data group, where Used for is "Event name" and the value of event name is the name of the event that the group was created for
2. creating a corresponding profile, x
2. in the event definition, I added this profile x as Include profile (top of page) and the profile containing individual attributes (first name, last name etc) as Include profile (top of page)

I tested this and it worked. Problem is, when I then look at settings on custom data x, I get the following warning. Any idea what I've done wrong?

warning: array_intersect() [function.array-intersect]: Argument #2 is not an array in /var/www/drupal/sites/all/modules/civicrm/CRM/Custom/Form/Group.php on line 309.

In addition, can you point me to examples of creating custom data groups where Used for is Participants, Participants (Event Name), Participants (Event Type), Participants (Role)? I'd like to know when to use one vs the other.

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: Event registration CRM_Core_Error
April 15, 2010, 08:53:08 am

1. can you try to reproduce the warning on the demo server

2. you might want to read the manual: http://en.flossmanuals.net/CiviCRM

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

joemaine

  • I post occasionally
  • **
  • Posts: 114
  • Karma: 3
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.14
  • MySQL version: 5.1
  • PHP version: 5.2
Re: Event registration CRM_Core_Error
April 22, 2010, 07:47:17 pm
...not sure if this is related or not, but in CiviEvent we've had random errors being thrown because of 'non-standard' characters being used in event description fields. Now we know to clean up the copy when an error occurs...and the errors go away. Perhaps yet another issue with CKEditor?
--
Joe

davej

  • Ask me questions
  • ****
  • Posts: 404
  • Karma: 21
Re: Event registration CRM_Core_Error
May 04, 2010, 05:19:08 am
Hi,

We've just seen a similar error in 3.1.3 when registering a participant for an event via New Event Registration:

Code: [Select]
INSERT INTO civicrm_value_pg_cert_exam_event_test_47  ( cluster_445,tutor_446,psychologist_447,module_1_result_448,entity_id )
 VALUES ( 'A','Random Tutor','Random Psychologist','Pass',64 )
 ON DUPLICATE KEY UPDATE cluster_445 = 'A',tutor_446 = 'Random Tutor',psychologist_447 = 'Random Psychologist',module_1_result_448 = 'Pass'
[nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`dyslexia_civicrm31/civicrm_value_pg_cert_exam_event_test_47`, CONSTRAINT `FK_civicrm_value_pg_cert_exam_event_bb3057a49f9990a5` FOREIGN KEY (`entity_id`) REFERENCES `civicrm_event` (`id`) ON )]

The problem is that the foreign key references civicrm_event whereas the custom group civicrm_value_pg_cert_exam_event_test_47 extends Participant:

Code: [Select]
mysql> select id, name, extends from civicrm_custom_group where id = 47;
+----+-------------------------+-------------+
| id | name                    | extends     |
+----+-------------------------+-------------+
| 47 | PG_Cert_Exam_event_Test | Participant |
+----+-------------------------+-------------+

The foreign key constraint was:

Code: [Select]
CONSTRAINT `FK_civicrm_value_pg_cert_exam_event_bb3057a49f9990a5` FOREIGN KEY (`entity_id`) REFERENCES `civicrm_event` (`id`) ON DELETE CASCADE

We worked around the problem by changing it to:

Code: [Select]
CONSTRAINT `FK_civicrm_value_pg_cert_exam_event_test_47_entity_id` FOREIGN KEY (`entity_id`) REFERENCES `civicrm_participant` (`id`) ON DELETE CASCADE

Looking at CRM::Core::BAO::SchemaHandler changeFKConstraint:

Code: [Select]
        $dropFKSql = "
ALTER TABLE {$tableName}
      DROP FOREIGN KEY `FK_{$tableName}_entity_id`;";

- the constraint name doesn't seem to match the format that we initially saw: FK_civicrm_value_pg_cert_exam_event_bb3057a49f9990a5 . Possibly a red herring, mentioning it in case it's relevant.

Further info from client:
"I believe that I set the custom data group up specifically for participant data. Although I may have originally set it up at Participants(event name) instead of  Participants(event type) in the initial dropdown options list then changed it later on."

Dave J
« Last Edit: May 04, 2010, 06:27:39 am by davej »

davej

  • Ask me questions
  • ****
  • Posts: 404
  • Karma: 21
Re: Event registration CRM_Core_Error
June 10, 2010, 07:34:46 am
Hi,

We've had another case, on another 3.1.3 site, of a table for a custom group having a foreign key constraint to the wrong table for entity_id.

Code: [Select]
mysql> select id, table_name, extends from civicrm_custom_group where id = 5;
+----+----------------------------+--------------+
| id | table_name                 | extends      |
+----+----------------------------+--------------+
|  5 | civicrm_value_eoi_review_5 | Organization |
+----+----------------------------+--------------+

Constraint was:
Code: [Select]
CONSTRAINT `FK_civicrm_value_eoi_review_5_entity_id` FOREIGN KEY (`entity_id`) REFERENCES `civicrm_activity` (`id`) ON DELETE CASCADE

Should be:
Code: [Select]
CONSTRAINT `FK_civicrm_value_eoi_review_5_entity_id` FOREIGN KEY (`entity_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE

There's a bug there somewhere. Unlike the case in my previous post above, there's no funny business going on with the FK name here.

Dave J

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Event registration CRM_Core_Error

This forum was archived on 2017-11-26.