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 Import (Moderator: Yashodha Chaku) »
  • civicrm contact Import
Pages: [1]

Author Topic: civicrm contact Import  (Read 2552 times)

jtattersall

  • I post occasionally
  • **
  • Posts: 33
  • Karma: 0
  • CiviCRM version: 4.5
  • CMS version: drupal 7
  • MySQL version: 5.1.70-cll
  • PHP version: 5.3.26
civicrm contact Import
March 17, 2014, 04:33:15 pm
Every Time I try and import contact this error happens


Sorry but we are not able to provide this at the moment.
DB Error: constraint violation
Return to home page.

Preview (step 3 of 4)

The information below previews the results of importing your data in CiviCRM. Review the totals to ensure that they represent your expected results.

Click 'Import Now' if you are ready to proceed.


Total Rows   25   Total number of rows in the imported data.
Valid Rows   25   Total rows to be imported.
Column Names   Import Data (row 1)   Import Data (row 2)   Matching CiviCRM Field
Internal Contact ID   2   3   - do not import -
Contact Type   Individual   Individual   - do not import -
Contact Subtype         Contact Subtype
Do Not Email         Do Not Email
Do Not Phone         Do Not Phone
Do Not Mail         Do Not Mail
Do Not Sms         Do Not Sms
Do Not Trade         Do Not Trade
No Bulk Emails (User Opt Out)         No Bulk Emails (User Opt Out)
Legal Identifier         Legal Identifier
External Identifier         External Identifier
Sort Name   admin@members.fss-shop.com   Admin, FSS   - do not import -
Display Name   admin@members.fss-shop.com   FSS Admin   - do not import -
Nickname         Nickname
Legal Name         - do not import -
Image Url         Image Url
Preferred Communication Method         Preferred Communication Method
Preferred Language   en_US   en_US   Preferred Language
Preferred Mail Format   Both   Both   - do not import -
Contact Hash   924cb963b1107115871c0ff50a723318   641e806756ba4b5a975b7f83c407807a   - do not import -
Source of Contact Data         Source of Contact Data
First Name      FSS   First Name
Middle Name         Middle Name
Last Name      Admin   Last Name
Individual Prefix         Individual Prefix
Individual Suffix         Individual Suffix
Job Title         Job Title
Gender         Gender
Birth Date         Birth Date
Is Deceased         Is Deceased
Deceased Date         Deceased Date
Household Name         - do not import -
Organization Name         - do not import -
Sic Code         - do not import -
Unique ID (OpenID)         Unique ID (OpenID)
Current Employer ID         - do not import -
Contact is in Trash         - do not import -
Current Employer         - do not import -
Location Type         - do not import -
Street Address         Home -Street Address
Street Number         Home -Street Address
Street Number Suffix         Home -Street Address
Street Name         Home -Street Address
Street Unit         Home -Street Address
Supplemental Address 1         Home -Supplemental Address 1
Supplemental Address 2         Home -Supplemental Address 2
City         Home -City
Postal Code Suffix         Home -Postal Code Suffix
Postal Code         Home -Postal Code
Geo Code 1         Home -Geo Code 1
Geo Code 2         Home -Geo Code 2
Address Name         Home -Street Address
Master Address Belongs To         Home -Master Address Belongs To
County         - do not import -
State         Home -State
Country         Home -Country
Phone         Home -Phone -Phone
Phone Extension         Home -Phone Extension
Email   admin@members.fss-shop.com   fss@fsservers.co.uk   Home -Email (match to contact)
On Hold         - do not import -
Use for Bulk Mail         Do Not Mail
Signature Text         Home -Signature Text
Signature Html         Home -Signature Html
IM Provider         Home -Yahoo -IM Screen Name
IM Screen Name         Home -Yahoo -IM Screen Name
OpenID         Home -OpenID
World Region         - do not import -
Website         Home -Website
Group(s)         - do not import -
Tag(s)         - do not import -
Note(s)         Note
Phone Type         Home -Phone -Phone
IM Service Provider         Home -Yahoo -IM Screen Name

JonGold

  • Ask me questions
  • ****
  • Posts: 638
  • Karma: 81
    • Palante Technology
  • CiviCRM version: 4.1 to the latest
  • CMS version: Drupal 6-7, Wordpress 4.0+
  • PHP version: PHP 5.3-5.5
Re: civicrm contact Import
March 17, 2014, 07:16:29 pm
That sounds like an import bug.  Unfortunate, but usually can be worked around if not fixed outright.

To troubleshoot this, go to Administer menu -> System Settings -> Debugging and Error Handling.  Turn on "enable debugging" and "display backtrace", then run the import again.  Next time, your error message should have a lot more info.  Post that here and we can try to figure out the issue from there.

Jon
Sign up to StackExchange and get free expert CiviCRM advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

jtattersall

  • I post occasionally
  • **
  • Posts: 33
  • Karma: 0
  • CiviCRM version: 4.5
  • CMS version: drupal 7
  • MySQL version: 5.1.70-cll
  • PHP version: 5.3.26
Re: civicrm contact Import
March 19, 2014, 07:39:44 am
backTrace

#0 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm/CRM/Core/Error.php(149): CRM_Core_Error::backtrace()
#1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
#2 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
#3 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm/packages/DB.php(969): PEAR_Error->PEAR_Error("DB Error: constraint violation", -3, 16, (Array:2), "INSERT INTO civicrm_address (contact_id , location_type_id , is_primary , is_...")
#4 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-3, 16, (Array:2), "INSERT INTO civicrm_address (contact_id , location_type_id , is_primary , is_...")
#5 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -3, NULL, NULL, "INSERT INTO civicrm_address (contact_id , location_type_id , is_primary , is_...", "DB_Error", TRUE)
#6 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/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 (`fs...")
#7 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm/packages/DB/mysql.php(327): DB_mysql->mysqlRaiseError()
#8 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("INSERT INTO civicrm_address (contact_id , location_type_id , is_primary , is_...")
#9 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm/packages/DB/DataObject.php(2421): DB_common->query("INSERT INTO civicrm_address (contact_id , location_type_id , is_primary , is_...")
#10 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm/packages/DB/DataObject.php(1055): DB_DataObject->_query("INSERT INTO civicrm_address (contact_id , location_type_id , is_primary , is_...")
#11 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm/CRM/Core/DAO.php(277): DB_DataObject->insert()
#12 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm/CRM/Core/BAO/Address.php(162): CRM_Core_DAO->save()
#13 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm/CRM/Core/BAO/Address.php(126): CRM_Core_BAO_Address::add((Array:13), TRUE)
#14 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm/CRM/Core/BAO/Location.php(69): CRM_Core_BAO_Address::create((Array:19), TRUE, NULL)
#15 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm/CRM/Contact/BAO/Contact.php(352): CRM_Core_BAO_Location::create((Array:19), TRUE)
#16 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm/CRM/Contact/BAO/Contact.php(1775): CRM_Contact_BAO_Contact::create((Array:19))
#17 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm/CRM/Contact/Import/Parser/Contact.php(1672): CRM_Contact_BAO_Contact::createProfileContact((Array:7), (Array:34), NULL, NULL, NULL, "Individual")
#18 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm/CRM/Contact/Import/Parser/Contact.php(680): CRM_Contact_Import_Parser_Contact->createContact((Array:7), (Array:34), "1", NULL, TRUE, "")
#19 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm/CRM/Contact/Import/Parser.php(208): CRM_Contact_Import_Parser_Contact->import("1", (Array:76), NULL)
#20 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm/CRM/Contact/Import/ImportJob.php(276): CRM_Contact_Import_Parser->run("civicrm_import_job_3d38adaa0a153152afe5a3cbbba95ebb", (Array:73), 8, 1, "_id", "_status", "1", "90f12c56df36f3c35ac27397aec92fe4", 25, NULL, 30, NULL, "")
#21 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm/CRM/Contact/Import/Form/Preview.php(282): CRM_Contact_Import_ImportJob->runImport(Object(CRM_Contact_Import_Form_Preview))
#22 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm/CRM/Core/Form.php(261): CRM_Contact_Import_Form_Preview->postProcess()
#23 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm/CRM/Core/StateMachine.php(160): CRM_Core_Form->mainProcess()
#24 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm/CRM/Core/QuickForm/Action/Next.php(60): CRM_Core_StateMachine->perform(Object(CRM_Contact_Import_Form_Preview), "next", "Next")
#25 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Next->perform(Object(CRM_Contact_Import_Form_Preview), "next")
#26 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Contact_Import_Form_Preview), "next")
#27 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm/CRM/Core/Controller.php(345): HTML_QuickForm_Page->handle("next")
#28 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php(323): CRM_Core_Controller->run((Array:3), NULL)
#29 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php(72): CRM_Core_Invoke::runItem((Array:13))
#30 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))
#31 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm.php(116): CRM_Core_Invoke::invoke((Array:3))
#32 /home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm.php(40): civicrm_invoke()
#33 /home/fssshop0/public_html/tmd/libraries/cms/component/helper.php(351): require_once("/home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm.php")
#34 /home/fssshop0/public_html/tmd/libraries/cms/component/helper.php(331): JComponentHelper::executeComponent("/home/fssshop0/public_html/tmd/administrator/components/com_civicrm/civicrm.php")
#35 /home/fssshop0/public_html/tmd/libraries/cms/application/administrator.php(98): JComponentHelper::renderComponent("com_civicrm")
#36 /home/fssshop0/public_html/tmd/libraries/cms/application/administrator.php(143): JApplicationAdministrator->dispatch()
#37 /home/fssshop0/public_html/tmd/libraries/cms/application/cms.php(264): JApplicationAdministrator->doExecute()
#38 /home/fssshop0/public_html/tmd/administrator/index.php(42): JApplicationCms->execute()
#39 {main}
Sorry but we are not able to provide this at the moment.
DB Error: constraint violation
Error Details
Database Error Code: Cannot add or update a child row: a foreign key constraint fails (`fssshop0_tmd`.`civicrm_address`, CONSTRAINT `FK_civicrm_address_master_id` FOREIGN KEY (`master_id`) REFERENCES `civicrm_address` (`id`) ON DELETE SET NULL), 1452
Additional Details:
Array
(
    [callback] => Array
        (
           
  • => CRM_Core_Error
  • [1] => handle
            )

       
Code: [Select]
=> -3
    [message] => DB Error: constraint violation
    [mode] => 16
    [debug_info] => INSERT INTO civicrm_address (contact_id , location_type_id , is_primary , is_billing , street_address , supplemental_address_1 , city , postal_code , country_id , manual_geo_code , master_id ) VALUES ( 10 ,  1 ,  1 ,  0 , '68, Kincardine Road,' , 'Manchester' , 'Greater Manchester,' , 'M13 9SY' ,  1228 ,  0 ,  0 )  [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`fssshop0_tmd`.`civicrm_address`, CONSTRAINT `FK_civicrm_address_master_id` FOREIGN KEY (`master_id`) REFERENCES `civicrm_address` (`id`) ON DELETE SET NULL)]
    [type] => DB_Error
    [user_info] => INSERT INTO civicrm_address (contact_id , location_type_id , is_primary , is_billing , street_address , supplemental_address_1 , city , postal_code , country_id , manual_geo_code , master_id ) VALUES ( 10 ,  1 ,  1 ,  0 , '68, Kincardine Road,' , 'Manchester' , 'Greater Manchester,' , 'M13 9SY' ,  1228 ,  0 ,  0 )  [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`fssshop0_tmd`.`civicrm_address`, CONSTRAINT `FK_civicrm_address_master_id` FOREIGN KEY (`master_id`) REFERENCES `civicrm_address` (`id`) ON DELETE SET NULL)]
    [to_string] => [db_error: message="DB Error: constraint violation" code=-3 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_address (contact_id , location_type_id , is_primary , is_billing , street_address , supplemental_address_1 , city , postal_code , country_id , manual_geo_code , master_id ) VALUES ( 10 ,  1 ,  1 ,  0 , '68, Kincardine Road,' , 'Manchester' , 'Greater Manchester,' , 'M13 9SY' ,  1228 ,  0 ,  0 )  [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`fssshop0_tmd`.`civicrm_address`, CONSTRAINT `FK_civicrm_address_master_id` FOREIGN KEY (`master_id`) REFERENCES `civicrm_address` (`id`) ON DELETE SET NULL)]"]
)

JonGold

  • Ask me questions
  • ****
  • Posts: 638
  • Karma: 81
    • Palante Technology
  • CiviCRM version: 4.1 to the latest
  • CMS version: Drupal 6-7, Wordpress 4.0+
  • PHP version: PHP 5.3-5.5
Re: civicrm contact Import
March 19, 2014, 08:07:29 am
Hi there jtattersall,

If I'm interpreting this correctly, you're trying to import info into the master_id field, aka "Master Address Belongs To". To successfully import an address such that it uses address sharing, you must know the CiviCRM ID of the person whose master address it is.  As such, it's not a very easy field to use, but there's not really another practical way to implement it.

My guess is one of the following:
* you're trying to import something other than the CiviCRM ID into the "Master Address Belongs to" field.
* You are using the field correctly, but on one or more of the records, you have an ID of "0".  If you intend to show that the address doesn't have a master address, you must instead leave the field blank rather than put in a zero.

I hope this helped!
Jon
Sign up to StackExchange and get free expert CiviCRM advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

jtattersall

  • I post occasionally
  • **
  • Posts: 33
  • Karma: 0
  • CiviCRM version: 4.5
  • CMS version: drupal 7
  • MySQL version: 5.1.70-cll
  • PHP version: 5.3.26
Re: civicrm contact Import
March 19, 2014, 09:58:39 am
i have ran it a again


DB Error: constraint violation
Error Details
Database Error Code: Cannot add or update a child row: a foreign key constraint fails (`fssshop0_qwe`.`civicrm_address`, CONSTRAINT `FK_civicrm_address_master_id` FOREIGN KEY (`master_id`) REFERENCES `civicrm_address` (`id`) ON DELETE SET NULL), 1452
Additional Details:
Array
(
    [callback] => Array
        (
           
  • => CRM_Core_Error
  • [1] => handle
            )

       
Code: [Select]
=> -3
    [message] => DB Error: constraint violation
    [mode] => 16
    [debug_info] => INSERT INTO civicrm_address (contact_id , location_type_id , is_primary , is_billing , street_address , supplemental_address_1 , city , postal_code , country_id , manual_geo_code , master_id ) VALUES ( 27 ,  1 ,  1 ,  0 , '68, Kincardine Road,' , 'Manchester' , 'Greater Manchester,' , 'M13 9SY' ,  1228 ,  0 ,  0 )  [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`fssshop0_qwe`.`civicrm_address`, CONSTRAINT `FK_civicrm_address_master_id` FOREIGN KEY (`master_id`) REFERENCES `civicrm_address` (`id`) ON DELETE SET NULL)]
    [type] => DB_Error
    [user_info] => INSERT INTO civicrm_address (contact_id , location_type_id , is_primary , is_billing , street_address , supplemental_address_1 , city , postal_code , country_id , manual_geo_code , master_id ) VALUES ( 27 ,  1 ,  1 ,  0 , '68, Kincardine Road,' , 'Manchester' , 'Greater Manchester,' , 'M13 9SY' ,  1228 ,  0 ,  0 )  [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`fssshop0_qwe`.`civicrm_address`, CONSTRAINT `FK_civicrm_address_master_id` FOREIGN KEY (`master_id`) REFERENCES `civicrm_address` (`id`) ON DELETE SET NULL)]
    [to_string] => [db_error: message="DB Error: constraint violation" code=-3 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_address (contact_id , location_type_id , is_primary , is_billing , street_address , supplemental_address_1 , city , postal_code , country_id , manual_geo_code , master_id ) VALUES ( 27 ,  1 ,  1 ,  0 , '68, Kincardine Road,' , 'Manchester' , 'Greater Manchester,' , 'M13 9SY' ,  1228 ,  0 ,  0 )  [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`fssshop0_qwe`.`civicrm_address`, CONSTRAINT `FK_civicrm_address_master_id` FOREIGN KEY (`master_id`) REFERENCES `civicrm_address` (`id`) ON DELETE SET NULL)]"]
)
Return to home page.

jtattersall

  • I post occasionally
  • **
  • Posts: 33
  • Karma: 0
  • CiviCRM version: 4.5
  • CMS version: drupal 7
  • MySQL version: 5.1.70-cll
  • PHP version: 5.3.26
Re: civicrm contact Import
March 19, 2014, 09:59:46 am
the data i am trying to import is form another civicrm installation

JonGold

  • Ask me questions
  • ****
  • Posts: 638
  • Karma: 81
    • Palante Technology
  • CiviCRM version: 4.1 to the latest
  • CMS version: Drupal 6-7, Wordpress 4.0+
  • PHP version: PHP 5.3-5.5
Re: civicrm contact Import
March 19, 2014, 10:14:48 am
Hi jtattersall,

Does the error still occur when you remove the master_id column from your CSV file?
Sign up to StackExchange and get free expert CiviCRM advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Import (Moderator: Yashodha Chaku) »
  • civicrm contact Import

This forum was archived on 2017-11-26.