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 CiviMember (Moderator: Deepak Srivastava) »
  • DeDupe errors when Individuals have Membership (by relationship)
Pages: [1]

Author Topic: DeDupe errors when Individuals have Membership (by relationship)  (Read 577 times)

Laryn

  • I post frequently
  • ***
  • Posts: 192
  • Karma: 4
    • CEDC
  • CiviCRM version: 4.6.x
  • CMS version: Drupal 7
DeDupe errors when Individuals have Membership (by relationship)
June 17, 2014, 12:53:28 pm
I'm running into some dedupe errors when trying to merge contacts where the original contact has a membership that is granted by a relationship. Individuals with no membership and individuals who are the primary contacts for their memberships are not giving problems. In fact, if I take the duplicates and "flip" so that the original is listed as the duplicate and then I check all the boxes except memberships (which should be autogenerated anyway), it seems to work but adds a bunch of extra clicks for each dedupe.

This does not seem to happen on the demo server 4.4.x -- does anyone have advice on where I should start looking in our installation for the root cause of this?

Code: [Select]
$Fatal Error Details = Array (

[callback] => Array (
[0] => CRM_Core_Error
[1] => handle )
[code] => -3
[message] => DB Error: constraint violation
[mode] => 16
[debug_info] => INSERT INTO civicrm_membership (contact_id , status_id , owner_membership_id ) VALUES ( 12643 , 2 , 674 )
[nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`db_civicrm`.`civicrm_membership`, CONSTRAINT `FK_civicrm_membership_membership_type_id` FOREIGN KEY (`membership_type_id`) REFERENCES `civicrm_membership_type` (`id`) ON DELETE CASCADE)]
[type] => DB_Error
[user_info] => INSERT INTO civicrm_membership (contact_id , status_id , owner_membership_id ) VALUES ( 12643 , 2 , 674 )
[nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`db_civicrm`.`civicrm_membership`, CONSTRAINT `FK_civicrm_membership_membership_type_id` FOREIGN KEY (`membership_type_id`) REFERENCES `civicrm_membership_type` (`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_membership (contact_id , status_id , owner_membership_id ) VALUES ( 12643 , 2 , 674 )
[nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`db_civicrm`.`civicrm_membership`, CONSTRAINT `FK_civicrm_membership_membership_type_id` FOREIGN KEY (`membership_type_id`) REFERENCES `civicrm_membership_type` (`id`) ON DELETE CASCADE)]"] )

Code: [Select]
$backTrace = #0
[/sites/all/modules/civicrm/CRM/Core/Error.php(197): CRM_Core_Error::backtrace("backTrace", TRUE) #1
[internal function](): CRM_Core_Error::handle(Object(DB_Error)) #2
[/sites/all/modules/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error)) #3
[/sites/all/modules/civicrm/packages/DB.php(969): PEAR_Error->PEAR_Error("DB Error: constraint violation", -3, 16, (Array:2), "INSERT INTO civicrm_membership (contact_id , status_id , owner_membership_id ...") #4
[/sites/all/modules/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-3, 16, (Array:2), "INSERT INTO civicrm_membership (contact_id , status_id , owner_membership_id ...") #5
[/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -3, NULL, NULL, "INSERT INTO civicrm_membership (contact_id , status_id , owner_membership_id ...", "DB_Error", TRUE) #6
[/sites/all/modules/civicrm/packages/DB/mysql.php(898): DB_common->raiseError(-3, NULL, NULL, NULL, "1452 ** Cannot add or update a child row: a foreign key constraint fails (`cl...") #7
[/sites/all/modules/civicrm/packages/DB/mysql.php(327): DB_mysql->mysqlRaiseError() #8
[/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("INSERT INTO civicrm_membership (contact_id , status_id , owner_membership_id ...") #9
[/sites/all/modules/civicrm/packages/DB/DataObject.php(2421): DB_common->query("INSERT INTO civicrm_membership (contact_id , status_id , owner_membership_id ...") #10
[/sites/all/modules/civicrm/packages/DB/DataObject.php(1055): DB_DataObject->_query("INSERT INTO civicrm_membership (contact_id , status_id , owner_membership_id ...") #11
[/sites/all/modules/civicrm/CRM/Core/DAO.php(278): DB_DataObject->insert() #12
[/sites/all/modules/civicrm/CRM/Member/BAO/Membership.php(93): CRM_Core_DAO->save() #13
[/sites/all/modules/civicrm/CRM/Member/BAO/Membership.php(289): CRM_Member_BAO_Membership::add((Array:7), (Array:0)) #14
[/sites/all/modules/civicrm/CRM/Member/BAO/Membership.php(2123): CRM_Member_BAO_Membership::create((Array:7), (Array:0)) #15
[/sites/all/modules/civicrm/CRM/Member/BAO/Membership.php(380): CRM_Member_BAO_Membership::createRelatedMemberships((Array:7), Object(CRM_Member_BAO_Membership)) #16
[/sites/all/modules/civicrm/CRM/Member/BAO/Membership.php(2123): CRM_Member_BAO_Membership::create((Array:7), (Array:2)) #17
[/sites/all/modules/civicrm/CRM/Dedupe/Merger.php(1576): CRM_Member_BAO_Membership::createRelatedMemberships((Array:7), Object(CRM_Member_DAO_Membership)) #18
[/sites/all/modules/civicrm/CRM/Dedupe/Merger.php(509): CRM_Dedupe_Merger::addMembershipToRealtedContacts(5817) #19
[/sites/all/modules/civicrm/CRM/Dedupe/Merger.php(1309): CRM_Dedupe_Merger::moveContactBelongings("5817", "91687") #20
[/sites/all/modules/civicrm/CRM/Contact/Form/Merge.php(326): CRM_Dedupe_Merger::moveAllBelongings("5817", "91687", (Array:19)) #21
[/sites/all/modules/civicrm/CRM/Core/Form.php(261): CRM_Contact_Form_Merge->postProcess() #22
[/sites/all/modules/civicrm/CRM/Core/StateMachine.php(160): CRM_Core_Form->mainProcess() #23
[/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Next.php(60): CRM_Core_StateMachine->perform(Object(CRM_Contact_Form_Merge), "next", "Next") #24
[/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Next->perform(Object(CRM_Contact_Form_Merge), "next") #25
[/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Contact_Form_Merge), "next") #26
[/sites/all/modules/civicrm/CRM/Core/Controller.php(339): HTML_QuickForm_Page->handle("next") #27
[/sites/all/modules/civicrm/CRM/Utils/Wrapper.php(117): CRM_Core_Controller->run() #28
[/sites/all/modules/civicrm/CRM/Core/Invoke.php(297): CRM_Utils_Wrapper->run("CRM_Contact_Form_Merge", "Merge Contact", NULL) #29
[/sites/all/modules/civicrm/CRM/Core/Invoke.php(72): CRM_Core_Invoke::runItem((Array:13)) #30
[/sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3)) #31
[/sites/all/modules/civicrm/drupal/civicrm.module(456): CRM_Core_Invoke::invoke((Array:3)) #32
[internal function](): civicrm_invoke("contact", "merge") #33
[/includes/menu.inc(517): call_user_func_array("civicrm_invoke", (Array:2)) #34
[/index.php(21): menu_execute_active_handler() #35 {main}

CiviCRM 4.4.5
Drupal 7
CEDC...social justice by design

*Get support on the new CiviCRM help site. /laryn

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMember (Moderator: Deepak Srivastava) »
  • DeDupe errors when Individuals have Membership (by relationship)

This forum was archived on 2017-11-26.