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) »
  • Empty relationships created when importing contacts
Pages: [1]

Author Topic: Empty relationships created when importing contacts  (Read 1420 times)

bwaindwain

  • I post occasionally
  • **
  • Posts: 30
  • Karma: 1
Empty relationships created when importing contacts
March 26, 2010, 03:16:10 pm
Importing contacts with a relationship (child of, spouse of... etc) always creates the 2nd contact, even if it's blank. For example, if the imported csv is:

Code: [Select]
Lastname, Firstname, Spouse of Lastname, Spouse of Firstname
Adams, Alex, Adams, Anne
Adams, Bert, ,

then CiviCRM import will create 4 contacts: Alex Adams will have a spouse Anne Adams, but Bert Adams will have spouse of <blank>.

Seems like CiviCRM import process should NOT create these empty relationships. I've tried putting "null" or "none" in the field, but it still creates the relationship.




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: Empty relationships created when importing contacts
March 26, 2010, 03:22:19 pm

agreed, this is definitely incorrect behavior and should be fixed

Would be great if you could fix the code to do the needful.

Most of the import code that creates the related contacts is in:
CRM/Import/Parser/Contact.php (search for relationship)

Please file an issue and hopefully a patch with it

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

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Empty relationships created when importing contacts
March 26, 2010, 08:57:37 pm
isn't it pretty straightforward to just sort your csv so you only do the 'relationship' for those that have them? ie do 2 imports - one with relationships and one without?
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Empty relationships created when importing contacts
March 27, 2010, 02:22:21 am
ha - now i am laughin on other side of my face on this.  :-\

Did an import but all i was importing was the External Ids of the two contacts ie the second contact was a 'xxx of' the first and both were matchin on Ext ID.

So what happens is if it doesn't find a matching Ext ID it creates a new contact and builds the relationship and we end up with a load of contacts with NO email and NO first or last names.

And no Error report.
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Empty relationships created when importing contacts

This forum was archived on 2017-11-26.