$sfh = new SugarFieldHandler(); foreach ($focus->field_defs as $fieldName => $field) { if (isset($field['source']) && $field['source'] == 'custom_fields') { $type = !empty($field['custom_type']) ? $field['custom_type'] : $field['type']; $sf = $sfh->getSugarField($type); if ($sf != null) { $sf->save($focus, $_POST, $fieldName, $field, ''); } else { $GLOBALS['log']->fatal("Field '{$fieldName}' does not have a SugarField handler"); } } } require_once 'include/SugarFields/Fields/Teamset/SugarFieldTeamset.php'; $teamSetField = new SugarFieldTeamset('Teamset'); if (!$newUser && $teamSetField != null) { $teamSetField->save($focus, $_POST, 'team_name', ''); } $portal = array("user_name", "last_name", "status", "portal_only"); $group = array("user_name", "last_name", "status", "is_group"); if (isset($_POST['portal_only']) && ($_POST['portal_only'] == '1' || $focus->portal_only)) { foreach ($portal as $field) { if (isset($_POST[$field])) { $value = $_POST[$field]; $focus->{$field} = $value; } } } if (isset($_POST['is_group']) && ($_POST['is_group'] == '1' || $focus->is_group)) { foreach ($group as $field) { if (isset($_POST[$field])) { $value = $_POST[$field];
if ($properties['name'] == 'modified_user_link' || in_array($properties['name'], $exclude)) { continue; } if (isset($properties['duplicate_merge'])) { if ($properties['duplicate_merge'] == 'disabled' or $properties['duplicate_merge'] == 'false' or $properties['name'] == 'assigned_user_link') { continue; } } if ($name == 'accounts' && $focus->merge_bean->module_dir == 'Opportunities') { continue; } if ($name == 'teams') { require_once 'include/SugarFields/Fields/Teamset/SugarFieldTeamset.php'; $teamSetField = new SugarFieldTeamset('Teamset'); if ($teamSetField != null) { $teamSetField->save($focus->merge_bean, $_REQUEST, 'team_name', ''); $focus->merge_bean->teams->setSaved(FALSE); $focus->merge_bean->teams->save(); $focus->merge_bean->save(); } continue; } if ($mergesource->load_relationship($name)) { //check to see if loaded relationship is with email address $relName = $mergesource->{$name}->getRelatedModuleName(); if (!empty($relName) and strtolower($relName) == 'emailaddresses') { //handle email address merge handleEmailMerge($focus, $name, $mergesource->{$name}->get()); } else { $data = $mergesource->{$name}->get(); if (is_array($data)) {