Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Duplicate
-
Affects Version/s: 4.2.0
-
Fix Version/s: 4.3.0
-
Component/s: Core CiviCRM
-
Labels:
Description
When importing contacts, if a boolean or date custom field is included, and that field is empty, the import of the entire record is silently skipped without giving any error message or indication of a problem.
Looking at /CRM/Import/Parser/Contact.php there are two causes of this problem:
1. There is a validation step and an import step. Recent changes in the import step have left it out of sync with the validation step. So empty date/boolean custom fields pass the validation step but then cause the import step to choke.
2. Errors on the import step are just ignored and not displayed or logged anywhere. This makes it difficult to troubleshoot errors that happen.
Here is the solution to the first problem:
In /CRM/Import/Parser/Contact.php around line 1164, make this addition:
/* validate the data against the CF type */
//For date & boolean custom fields, empty values are not allowed
if ($value=="") {
if (($customFields[$customFieldID]['data_type']) == 'Date' OR ($customFields[$customFieldID]['data_type'] == 'Boolean'))
} else
/* end date & boolean custom fields addition */
if ($value) {
if ($customFields[$customFieldID]['data_type'] == 'Date') {
if (CRM_Utils_Date::convertToDefaultDate($params, $dateType, $key))
else {