* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by SugarCRM".
 ********************************************************************************/
/*********************************************************************************
 * Description:  TODO: To be written.
 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
 * All Rights Reserved.
 * Contributor(s): ______________________________________..
 ********************************************************************************/
require_once 'modules/Contacts/ContactOpportunityRelationship.php';
$focus = new ContactOpportunityRelationship();
$focus->retrieve($_REQUEST['record']);
foreach ($focus->column_fields as $field) {
    safe_map($field, $focus, true);
}
foreach ($focus->additional_column_fields as $field) {
    safe_map($field, $focus, true);
}
// send them to the edit screen.
if (isset($_REQUEST['record']) && $_REQUEST['record'] != "") {
    $recordID = $_REQUEST['record'];
}
$focus->save();
$recordID = $focus->id;
Log::debug("Saved record with id of " . $recordID);
$header_URL = "Location: index.php?action={$_REQUEST['return_action']}&module={$_REQUEST['return_module']}&record={$_REQUEST['return_id']}";
Log::debug("about to post header URL of: {$header_URL}");
header($header_URL);
global $mod_strings;
global $sugar_version, $sugar_config;
$focus = new SecurityGroupUserRelationship();
if (isset($_REQUEST['record'])) {
    $focus->retrieve($_REQUEST['record']);
}
if (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
    $focus->id = "";
}
// Prepopulate either side of the relationship if passed in.
safe_map('user_name', $focus);
safe_map('user_id', $focus);
safe_map('securitygroup_name', $focus);
safe_map('securitygroup_id', $focus);
safe_map('noninheritable', $focus);
safe_map('primary_group', $focus);
$theme_path = "themes/" . $theme . "/";
$image_path = $theme_path . "images/";
require_once $theme_path . 'layout_utils.php';
$GLOBALS['log']->info("SecurityGroup User relationship");
$json = getJSONobj();
require_once 'include/QuickSearchDefaults.php';
$qsd = new QuickSearchDefaults();
$sqs_objects = array('user_name' => $qsd->getQSParent());
$sqs_objects['user_name']['populate_list'] = array('user_name', 'user_id');
$quicksearch_js = $qsd->getQSScripts();
$quicksearch_js .= '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '</script>';
echo $quicksearch_js;
$xtpl = new XTemplate('modules/SecurityGroups/SecurityGroupUserRelationshipEdit.html');
$xtpl->assign("MOD", $mod_strings);
$xtpl->assign("APP", $app_strings);
global $app_list_strings;
global $mod_strings;
global $sugar_version, $sugar_config;
$focus = new ContactOpportunityRelationship();
if (isset($_REQUEST['record'])) {
    $focus->retrieve($_REQUEST['record']);
}
if (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
    $focus->id = "";
}
// Prepopulate either side of the relationship if passed in.
safe_map('opportunity_name', $focus);
safe_map('opportunity_id', $focus);
safe_map('contact_name', $focus);
safe_map('contact_id', $focus);
safe_map('contact_role', $focus);
$GLOBALS['log']->info("Contact opportunity relationship");
$json = getJSONobj();
require_once 'include/QuickSearchDefaults.php';
$qsd = new QuickSearchDefaults();
$sqs_objects = array('opportunity_name' => $qsd->getQSParent());
$sqs_objects['opportunity_name']['populate_list'] = array('opportunity_name', 'opportunity_id');
$quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '</script>';
echo $quicksearch_js;
$xtpl = new XTemplate('modules/Contacts/ContactOpportunityRelationshipEdit.html');
$xtpl->assign("MOD", $mod_strings);
$xtpl->assign("APP", $app_strings);
$xtpl->assign("RETURN_URL", "&return_module={$currentModule}&return_action=DetailView&return_id={$focus->id}");
$xtpl->assign("RETURN_MODULE", $_REQUEST['return_module']);
$xtpl->assign("RETURN_ACTION", $_REQUEST['return_action']);
$xtpl->assign("RETURN_ID", $_REQUEST['return_id']);
global $app_list_strings;
global $mod_strings;
global $sugar_version, $sugar_config;
$focus = new SecurityGroupUserRelationship();
if (isset($_REQUEST['record'])) {
    $focus->retrieve($_REQUEST['record']);
}
if (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
    $focus->id = "";
}
// Prepopulate either side of the relationship if passed in.
safe_map('user_name', $focus);
safe_map('user_id', $focus);
safe_map('securitygroup_name', $focus);
safe_map('securitygroup_id', $focus);
safe_map('noninheritable', $focus);
$theme_path = "themes/" . $theme . "/";
$image_path = $theme_path . "images/";
require_once $theme_path . 'layout_utils.php';
$GLOBALS['log']->info("SecurityGroup User relationship");
$json = getJSONobj();
require_once 'include/QuickSearchDefaults.php';
$qsd = new QuickSearchDefaults();
$sqs_objects = array('user_name' => $qsd->getQSParent());
$sqs_objects['user_name']['populate_list'] = array('user_name', 'user_id');
$quicksearch_js = $qsd->getQSScripts();
$quicksearch_js .= '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '</script>';
echo $quicksearch_js;
$xtpl = new XTemplate('modules/SecurityGroups/SecurityGroupUserRelationshipEdit.html');
$xtpl->assign("MOD", $mod_strings);
$xtpl->assign("APP", $app_strings);