Details
-
Type:
Bug
-
Status: Done/Fixed
-
Priority:
Major
-
Resolution: Cannot Reproduce
-
Affects Version/s: 4.2.0
-
Fix Version/s: Unscheduled
-
Component/s: Core CiviCRM
-
Labels:None
-
Documentation Required?:None
-
Funding Source:Needs Funding
Description
I have set up an address custom field called 'status' with multi-select fields "Current" "Returned" and "Invalid".
When I try to import a CSV file with the status field I get the following error.
The CSV file is very simple--just two columns: The external ID and the address status field.
All address statuses in this file are either "Current" or "Returned".
The error and backtrace:
/home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Core/Error.php, backtrace, 148
, handle,
/home/mobikefed/www/www/sites/all/modules/civicrm/packages/PEAR.php, call_user_func, 931
/home/mobikefed/www/www/sites/all/modules/civicrm/packages/DB.php, PEAR_Error, 968
/home/mobikefed/www/www/sites/all/modules/civicrm/packages/PEAR.php, DB_Error, 564
/home/mobikefed/www/www/sites/all/modules/civicrm/packages/DB/common.php, raiseError, 1903
/home/mobikefed/www/www/sites/all/modules/civicrm/packages/DB/mysql.php, raiseError, 898
/home/mobikefed/www/www/sites/all/modules/civicrm/packages/DB/mysql.php, mysqlRaiseError, 327
/home/mobikefed/www/www/sites/all/modules/civicrm/packages/DB/common.php, simpleQuery, 1216
/home/mobikefed/www/www/sites/all/modules/civicrm/packages/DB/DataObject.php, query, 2421
/home/mobikefed/www/www/sites/all/modules/civicrm/packages/DB/DataObject.php, _query, 1613
/home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Core/DAO.php, query, 155
/home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Core/DAO.php, query, 888
/home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Core/BAO/CustomValueTable.php, executeQuery, 236
/home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Core/BAO/CustomValueTable.php, create, 340
/home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Contact/BAO/Contact.php, store, 386
/home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Contact/BAO/Contact.php, create, 1647
/home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Import/Parser/Contact.php, createProfileContact, 1691
/home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Import/Parser/Contact.php, createContact, 587
/home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Import/Parser.php, import, 358
/home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Import/ImportJob.php, run, 275
/home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Import/Form/Preview.php, runImport, 289
/home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Core/Form.php, postProcess, 246
/home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Core/StateMachine.php, mainProcess, 159
/home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Next.php, perform, 60
/home/mobikefed/www/www/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php, perform, 203
/home/mobikefed/www/www/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php, handle, 103
/home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Core/Controller.php, handle, 289
/home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Core/Invoke.php, run, 228
/home/mobikefed/www/www/sites/all/modules/civicrm/drupal/civicrm.module, invoke, 382
, civicrm_invoke,
/home/mobikefed/www/www/includes/menu.inc, call_user_func_array, 349
/home/mobikefed/www/www/index.php, menu_execute_active_handler, 17
Sorry but we are not able to provide this at the moment.
DB Error: constraint violation
---------------
In the watchdog I find these entries that all seem to be associated with this error. In order of receipt:
http://mobikefed.org/civicrm/import/contact?_qf_Preview_display=true&qfKey=7262241f378639d404ad7d7369464537_7260
Message Invalid argument supplied for foreach() in /home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Import/Parser/Contact.php on line 1978.
Severity error:
http://mobikefed.org/civicrm/import/contact?_qf_Preview_display=true&qfKey=7262241f378639d404ad7d7369464537_7260
Message explode() expects parameter 2 to be string, array given in /home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Import/Parser/Contact.php on line 1974.
Severity error
$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_value_address_status_27 ( status_138,entity_id ) VALUES ( '',4014 ) ON DUPLICATE KEY UPDATE status_138 = '' [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`mobikefed_civicrm`.`civicrm_value_address_status_27`, CONSTRAINT `FK_civicrm_value_address_status_27_entity_id` FOREIGN KEY (`entity_id`) REFERENCES `civicrm_address` (`id`) ON DELETE CASCADE)]
[type] => DB_Error
[user_info] => INSERT INTO civicrm_value_address_status_27 ( status_138,entity_id ) VALUES ( '',4014 ) ON DUPLICATE KEY UPDATE status_138 = '' [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`mobikefed_civicrm`.`civicrm_value_address_status_27`, CONSTRAINT `FK_civicrm_value_address_status_27_entity_id` FOREIGN KEY (`entity_id`) REFERENCES `civicrm_address` (`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_address_status_27 ( status_138,entity_id ) VALUES ( '',4014 ) ON DUPLICATE KEY UPDATE status_138 = '' [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`mobikefed_civicrm`.`civicrm_value_address_status_27`, CONSTRAINT `FK_civicrm_value_address_status_27_entity_id` FOREIGN KEY (`entity_id`) REFERENCES `civicrm_address` (`id`) ON DELETE CASCADE)]"]
)
------
http://mobikefed.org/civicrm/import/contact?_qf_Preview_display=true&qfKey=7262241f378639d404ad7d7369464537_7260
Message $backTrace = /home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Core/Error.php, backtrace, 196 , handle, /home/mobikefed/www/www/sites/all/modules/civicrm/packages/PEAR.php, call_user_func, 931 /home/mobikefed/www/www/sites/all/modules/civicrm/packages/DB.php, PEAR_Error, 968 /home/mobikefed/www/www/sites/all/modules/civicrm/packages/PEAR.php, DB_Error, 564 /home/mobikefed/www/www/sites/all/modules/civicrm/packages/DB/common.php, raiseError, 1903 /home/mobikefed/www/www/sites/all/modules/civicrm/packages/DB/mysql.php, raiseError, 898 /home/mobikefed/www/www/sites/all/modules/civicrm/packages/DB/mysql.php, mysqlRaiseError, 327 /home/mobikefed/www/www/sites/all/modules/civicrm/packages/DB/common.php, simpleQuery, 1216 /home/mobikefed/www/www/sites/all/modules/civicrm/packages/DB/DataObject.php, query, 2421 /home/mobikefed/www/www/sites/all/modules/civicrm/packages/DB/DataObject.php, _query, 1613 /home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Core/DAO.php, query, 155 /home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Core/DAO.php, query, 888 /home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Core/BAO/CustomValueTable.php, executeQuery, 236 /home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Core/BAO/CustomValueTable.php, create, 340 /home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Contact/BAO/Contact.php, store, 386 /home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Contact/BAO/Contact.php, create, 1647 /home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Import/Parser/Contact.php, createProfileContact, 1691 /home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Import/Parser/Contact.php, createContact, 587 /home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Import/Parser.php, import, 358 /home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Import/ImportJob.php, run, 275 /home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Import/Form/Preview.php, runImport, 289 /home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Core/Form.php, postProcess, 246 /home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Core/StateMachine.php, mainProcess, 159 /home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Next.php, perform, 60 /home/mobikefed/www/www/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php, perform, 203 /home/mobikefed/www/www/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php, handle, 103 /home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Core/Controller.php, handle, 289 /home/mobikefed/www/www/sites/all/modules/civicrm/CRM/Core/Invoke.php, run, 228 /home/mobikefed/www/www/sites/all/modules/civicrm/drupal/civicrm.module, invoke, 382 , civicrm_invoke, /home/mobikefed/www/www/includes/menu.inc, call_user_func_array, 349 /home/mobikefed/www/www/index.php, menu_execute_active_handler, 17
Severity debug