foreach ($fields as $field => $specs) {
$resetFKTo = NULL;
$fieldName = $field;
- if (!empty($specs['uniquename'])) {
- $fieldName = $specs['uniquename'];
- }
if ($field == 'currency' || $field == 'id' || $field == strtolower($entityName) . '_id'
|| in_array($field, $entityValuesThatDoNotWork)
) {
$entity[$fieldName] = (string) $entity2['id'];
}
else {
- $uniqueName = CRM_Utils_Array::value('uniqueName', $specs, $fieldName);
if (!empty($entity[$fieldName])) {
- $resetFKTo = array($fieldName => $entity[$fieldName], $uniqueName => $entity[$fieldName]);
+ $resetFKTo = array($fieldName => $entity[$fieldName]);
}
- $entity[$fieldName] = (string) empty($entity2[$field]) ? CRM_Utils_Array::value($uniqueName, $entity2) : $entity2[$field];
+ $entity[$fieldName] = (string) empty($entity2[$field]) ? '' : $entity2[$field];
//todo - there isn't always something set here - & our checking on unset values is limited
if (empty($entity[$field])) {
unset($entity[$field]);
$entity['contribution_type_id'] = $updateParams['financial_type_id'];
}
- if (!empty($specs['uniqueName'])) {
- $entity[$specs['uniqueName']] = $entity[$specs['name']];
- }
-
$update = $this->callAPISuccess($entityName, 'create', $updateParams);
$checkParams = array(
'id' => $entity['id'],