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) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • including additional tables in "merge duplicates" process
Pages: [1]

Author Topic: including additional tables in "merge duplicates" process  (Read 998 times)

TwoMice

  • I post frequently
  • ***
  • Posts: 214
  • Karma: 16
    • Emphanos
  • CiviCRM version: Always current stable version
  • CMS version: Drupal 7
including additional tables in "merge duplicates" process
July 28, 2010, 07:47:11 am
Hi,

I'm running a custom module that adds some tables of its own to track additional data on CiviCRM contacts.  Naturally, these tables are not included when we merge duplicate contacts, leaving orphaned records in these tables.

Is there a way (or tips on how I could /make/ a way) to have these tables included in the dedupe/merge process?

Thanks,
TM
Please consider contributing to help improve CiviCRM with the Make it Happen! initiative.

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: including additional tables in "merge duplicates" process
July 28, 2010, 09:29:17 am
You could use one of the hooks, for example the postProcess hook? Are you familiar with the CiviCRM hooks? If not, check:
http://en.flossmanuals.net/CiviCRM/DevelopHooks
Erik
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

TwoMice

  • I post frequently
  • ***
  • Posts: 214
  • Karma: 16
    • Emphanos
  • CiviCRM version: Always current stable version
  • CMS version: Drupal 7
Re: including additional tables in "merge duplicates" process
July 28, 2010, 10:14:23 am
Hi Eric,

I didn't realize the _post hook would fire on dedupe, but I guess it makes sense. It would fire on the delete of the one contact, right?  But then, it would need to know the contact_id of both contacts, and I can't see how it would.

Seems like I would need a "merge" hook, which doesn't exist.

Or, there may be a way to use _postProcess hook when the merge duplicates form is submitted. Will have to look into that.

Thanks,
TM
Please consider contributing to help improve CiviCRM with the Make it Happen! initiative.

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: including additional tables in "merge duplicates" process
July 28, 2010, 10:42:12 am
Hi TM
I was thinking of the last: if the form was submitted. Let me know what you find out!
Erik
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

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: including additional tables in "merge duplicates" process
July 28, 2010, 07:23:57 pm

i suspect a merge hook or a "pre" postProcess hook (i.e. before the postProcess is executed) is needed here

the main issue is if u've used FK constraints to link your tables to the civicrm tables (specifically contact), which you should to follow good db design practices, the merge will throw an FK constraint error when trying to delete the contact.

twomice: wanna submit a patch to incorporate a merge hook. also document it on:

http://wiki.civicrm.org/confluence/display/CRMDOC32/CiviCRM+hook+specification#CiviCRMhookspecification-hookcivicrmalterMailParams

and create a test function in civitest.module.sample

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

TwoMice

  • I post frequently
  • ***
  • Posts: 214
  • Karma: 16
    • Emphanos
  • CiviCRM version: Always current stable version
  • CMS version: Drupal 7
Re: including additional tables in "merge duplicates" process
August 20, 2010, 02:14:36 pm
Hi Lobo,

The patch, including the hook and example implementation in civitest.module.sample, is written and included in this issue: http://issues.civicrm.org/jira/browse/CRM-6697

I'm happy to update the wiki docs, but should I wait until the patch is committed and/or released?

- TM
Please consider contributing to help improve CiviCRM with the Make it Happen! initiative.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • including additional tables in "merge duplicates" process

This forum was archived on 2017-11-26.