if ($customFieldID &&
!array_key_exists($customFieldID, $addressCustomFields)
) {
+ // @todo - this can probably go....
if ($customFields[$customFieldID]['data_type'] == 'Boolean') {
if (empty($val) && !is_numeric($val) && $this->isFillDuplicates()) {
//retain earlier value when Import mode is `Fill`
}
}
}
- if (in_array($key, ['nick_name', 'job_title', 'middle_name', 'birth_date', 'gender_id', 'current_employer', 'prefix_id', 'suffix_id'])
- && ($value == '' || !isset($value)) &&
- ($session->get('authSrc') & (CRM_Core_Permission::AUTH_SRC_CHECKSUM + CRM_Core_Permission::AUTH_SRC_LOGIN)) == 0 ||
- ($key === 'current_employer' && empty($params['current_employer']))) {
- // CRM-10128: if auth source is not checksum / login && $value is blank, do not fill $data with empty value
- // to avoid update with empty values
+ // Why only these fields...?
+ if ($value === '' && in_array($key, ['nick_name', 'job_title', 'middle_name', 'birth_date', 'gender_id', 'current_employer', 'prefix_id', 'suffix_id'], TRUE)
+ ) {
+ // CRM-10128: if $value is blank, do not fill $data with empty value
continue;
}
else {
[$originalValues, $result] = $this->setUpBaseContact([
'external_identifier' => '',
'email' => NULL,
+ 'birth_date' => '2008-01-07',
]);
- $updateValues = ['id' => $result['id'], 'email' => 'bill@example.com'];
- // This is some deep weirdness - this sets a flag for updatingBlankLocinfo - allowing input to be blanked
- // (which IS a good thing but it's pretty weird & all to do with legacy profile stuff).
- CRM_Core_Session::singleton()->set('authSrc', CRM_Core_Permission::AUTH_SRC_CHECKSUM);
+ $updateValues = ['id' => (int) $result['id'], 'email' => 'bill@example.com', 'birth_date' => ''];
$this->runImport($updateValues, CRM_Import_Parser::DUPLICATE_UPDATE, CRM_Import_Parser::VALID);
$originalValues['id'] = $result['id'];
$this->callAPISuccessGetSingle('Email', ['contact_id' => $originalValues['id'], 'is_primary' => 1]);