$contact->external_identifier = $externalId;
$errorMsg = NULL;
if (!$contact->find(TRUE)) {
- $errorMsg = $contactId ? ts("Soft Credit ContactID - $contactId doesn't exist. Row was skipped.") : ts("Provided Soft Credit External Identifier - $externalIddoesn't exist. Row was skipped.");
+ $field = $contactId ? ts('Contact ID') : ts('External ID');
+ $errorMsg = ts("Soft Credit %1 - %2 doesn't exist. Row was skipped.",
+ array(1 => $field, 2 => $contactId ? $contactId : $externalId));
}
if ($errorMsg) {
$valid = CRM_Core_BAO_CustomValue::typecheck(CRM_Utils_Array::value('type', $value),
CRM_Utils_Array::value('value', $value)
);
- if (!$valid) {
+ if (!$valid && $value['is_required']) {
return civicrm_api3_create_error('Invalid value for custom field \'' .
CRM_Utils_Array::value('name', $custom) . '\''
);