if (!empty($_POST[$prefix . 'start_meridiem'])) { $_POST[$prefix . 'time_start'] = $timedate->merge_time_meridiem($_POST[$prefix . 'time_start'], $timedate->get_time_format(), $_POST[$prefix . 'start_meridiem']); } if (isset($_POST[$prefix . 'time_due']) && !empty($_POST[$prefix . 'time_due'])) { $_POST[$prefix . 'date_due'] = $_POST[$prefix . 'date_due'] . ' ' . $_POST[$prefix . 'time_due']; } if (isset($_POST[$prefix . 'time_start']) && !empty($_POST[$prefix . 'time_start'])) { $_POST[$prefix . 'date_start'] = $_POST[$prefix . 'date_start'] . ' ' . $_POST[$prefix . 'time_start']; } require_once 'include/formbase.php'; $focus = populateFromPost('', $focus); if (!$focus->ACLAccess('Save')) { ACLController::displayNoAccess(true); sugar_cleanup(true); } if (isCloseAndCreateNewPressed()) { $focus->status = 'Completed'; } if (!isset($_POST['date_due_flag'])) { $focus->date_due_flag = 0; } if (!isset($_POST['date_start_flag'])) { $focus->date_start_flag = 0; } if ($focus->date_due_flag != 'off' && $focus->date_due_flag != 1) { $focus->date_due = ''; $focus->time_due = ''; } //if only the time is passed in, without a date, then string length will be 7 if (isset($_REQUEST['date_due']) && strlen(trim($_REQUEST['date_due'])) < 8) { //no date set, so clear out field, and set the rest flag to true
/** * Builds a redirect URL based on a Form SugarCRM. * * @param string $return_id (optional) The record id to redirect to. * @param string $return_module (optional) The module to redirect to. * @param array $additionalFlags (optional) Additional flags to sent to the URL. * * @return string The url built from the current $_REQUEST information. */ function buildRedirectURL($return_id = '', $return_module = '', array $additionalFlags = array()) { if (isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "") { $return_module = $_REQUEST['return_module']; } if (isset($_REQUEST['return_action']) && $_REQUEST['return_action'] != "") { //if we are doing a "Close and Create New" if (isCloseAndCreateNewPressed()) { $return_action = "EditView"; $isDuplicate = "true"; $status = ""; // Meeting Integration if (isset($_REQUEST['meetingIntegrationFlag']) && $_REQUEST['meetingIntegrationFlag'] == 1) { $additionalFlags['meetingIntegrationShowForm'] = '1'; } // END Meeting Integration } else { if (isset($_REQUEST['action']) && $_REQUEST['action'] == "Save" && $_REQUEST['return_module'] != 'Activities' && $_REQUEST['return_module'] != 'WorkFlow' && $_REQUEST['return_module'] != 'Home' && $_REQUEST['return_module'] != 'Forecasts' && $_REQUEST['return_module'] != 'Calendar' && $_REQUEST['return_module'] != 'MailMerge' && $_REQUEST['return_module'] != 'TeamNotices') { $return_action = 'DetailView'; } elseif ($_REQUEST['return_module'] == 'Activities' || $_REQUEST['return_module'] == 'Calendar') { $return_module = $_REQUEST['module']; $return_action = $_REQUEST['return_action']; // wp: return action needs to be set for one-click close in task list } else { // if we "Cancel", we go back to the list view. $return_action = $_REQUEST['return_action']; } } } else { $return_action = "DetailView"; } if (isset($_REQUEST['return_id']) && $_REQUEST['return_id'] != "") { $return_id = $_REQUEST['return_id']; } $add = http_build_query($additionalFlags); if (!isset($isDuplicate) || !$isDuplicate) { $url = "index.php?action={$return_action}&module={$return_module}&record={$return_id}&return_module={$return_module}&return_action={$return_action}{$add}"; if (isset($_REQUEST['offset']) && empty($_REQUEST['duplicateSave'])) { $url .= "&offset=" . $_REQUEST['offset']; } } else { $standard = "action={$return_action}&module={$return_module}&record={$return_id}&isDuplicate=true&return_module={$return_module}&return_action={$return_action}&status={$status}"; $url = "index.php?{$standard}{$add}"; } return $url; }
function handleRedirect($return_id = '', $return_module = '') { if (isset($_REQUEST['return_url']) && $_REQUEST['return_url'] != "") { header("Location: " . $_REQUEST['return_url']); exit; } if (isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "") { $return_module = $_REQUEST['return_module']; } else { $return_module = $return_module; } if (isset($_REQUEST['return_action']) && $_REQUEST['return_action'] != "") { //if we are doing a "Close and Create New" if (isCloseAndCreateNewPressed()) { $return_action = "EditView"; $isDuplicate = "true"; $status = ""; // Meeting Integration if (isset($_REQUEST['meetingIntegrationFlag']) && $_REQUEST['meetingIntegrationFlag'] == 1) { $additionalFlags = array('meetingIntegrationShowForm' => '1'); } // END Meeting Integration } else { if ($_REQUEST['action'] == "Save" && $_REQUEST['return_module'] != 'Activities' && $_REQUEST['return_module'] != 'Home' && $_REQUEST['return_module'] != 'Forecasts' && $_REQUEST['return_module'] != 'Calendar' && $_REQUEST['return_module'] != 'MailMerge') { $return_action = 'DetailView'; } elseif ($_REQUEST['return_module'] == 'Activities' || $_REQUEST['return_module'] == 'Calendar') { $return_module = $_REQUEST['module']; $return_action = $_REQUEST['return_action']; // wp: return action needs to be set for one-click close in task list } else { // if we "Cancel", we go back to the list view. $return_action = $_REQUEST['return_action']; } } } else { $return_action = "DetailView"; } if (isset($_REQUEST['return_id']) && $_REQUEST['return_id'] != "") { $return_id = $_REQUEST['return_id']; } if (!isset($isDuplicate) || !$isDuplicate) { header("Location: index.php?action={$return_action}&module={$return_module}&record={$return_id}&return_module={$return_module}&return_action={$return_action}"); } else { $standard = "action={$return_action}&module={$return_module}&record={$return_id}&isDuplicate=true&return_module={$return_module}&return_action={$return_action}&status={$status}"; $add = ''; if (isset($additionalFlags) && !empty($additionalFlags)) { foreach ($additionalFlags as $k => $v) { if (!empty($add)) { $add .= "&"; } $add .= "{$k}={$v}"; } } if (!empty($add)) { $add = "&" . $add; } header("Location: index.php?{$standard}{$add}"); } exit; }
function buildRedirectURL($return_id = '', $return_module = '') { if (isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "") { $return_module = $_REQUEST['return_module']; } else { $return_module = $return_module; } if (isset($_REQUEST['return_action']) && $_REQUEST['return_action'] != "") { //if we are doing a "Close and Create New" if (isCloseAndCreateNewPressed()) { $return_action = "EditView"; $isDuplicate = "true"; $status = ""; // Meeting Integration if (isset($_REQUEST['meetingIntegrationFlag']) && $_REQUEST['meetingIntegrationFlag'] == 1) { $additionalFlags = array('meetingIntegrationShowForm' => '1'); } // END Meeting Integration } else { if (isset($_REQUEST['action']) && $_REQUEST['action'] == "Save" && $_REQUEST['return_module'] != 'Activities' && $_REQUEST['return_module'] != 'Home' && $_REQUEST['return_module'] != 'Forecasts' && $_REQUEST['return_module'] != 'Calendar' && $_REQUEST['return_module'] != 'MailMerge') { $return_action = 'DetailView'; } elseif ($_REQUEST['return_module'] == 'Activities' || $_REQUEST['return_module'] == 'Calendar') { $return_module = $_REQUEST['module']; $return_action = $_REQUEST['return_action']; // wp: return action needs to be set for one-click close in task list } else { // if we "Cancel", we go back to the list view. $return_action = $_REQUEST['return_action']; } } } else { $return_action = "DetailView"; } if (isset($_REQUEST['return_id']) && $_REQUEST['return_id'] != "") { $return_id = $_REQUEST['return_id']; } $add = ""; if (isset($additionalFlags) && !empty($additionalFlags)) { foreach ($additionalFlags as $k => $v) { $add .= "&{$k}={$v}"; } } if (!isset($isDuplicate) || !$isDuplicate) { $url = "index.php?action={$return_action}&module={$return_module}&record={$return_id}&return_module={$return_module}&return_action={$return_action}{$add}"; if (isset($_REQUEST['offset']) && empty($_REQUEST['duplicateSave'])) { $url .= "&offset=" . $_REQUEST['offset']; } if (!empty($_REQUEST['ajax_load'])) { $ajax_ret = array('content' => "<script>SUGAR.ajaxUI.loadContent('{$url}');</script>\n", 'menu' => array('module' => $return_module, 'label' => translate($return_module))); $json = getJSONobj(); echo $json->encode($ajax_ret); } else { return "Location: {$url}"; } } else { $standard = "action={$return_action}&module={$return_module}&record={$return_id}&isDuplicate=true&return_module={$return_module}&return_action={$return_action}&status={$status}"; $url = "index.php?{$standard}{$add}"; if (!empty($_REQUEST['ajax_load'])) { $ajax_ret = array('content' => "<script>SUGAR.ajaxUI.loadContent('{$url}');</script>\n", 'menu' => array('module' => $return_module, 'label' => translate($return_module))); $json = getJSONobj(); echo $json->encode($ajax_ret); } else { return "Location: {$url}"; } } }
function buildRedirectURL($return_id = '', $return_module = '') { if (isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "") { $return_module = $_REQUEST['return_module']; } else { $return_module = $return_module; } if (isset($_REQUEST['return_action']) && $_REQUEST['return_action'] != "") { //if we are doing a "Close and Create New" if (isCloseAndCreateNewPressed()) { $return_action = "EditView"; $isDuplicate = "true"; $status = ""; // Meeting Integration if (isset($_REQUEST['meetingIntegrationFlag']) && $_REQUEST['meetingIntegrationFlag'] == 1) { $additionalFlags = array('meetingIntegrationShowForm' => '1'); } // END Meeting Integration } else { if (isset($_REQUEST['action']) && $_REQUEST['action'] == "Save" && $_REQUEST['return_module'] != 'Activities' && $_REQUEST['return_module'] != 'Home' && $_REQUEST['return_module'] != 'Forecasts' && $_REQUEST['return_module'] != 'Calendar' && $_REQUEST['return_module'] != 'MailMerge') { $return_action = 'DetailView'; } elseif ($_REQUEST['return_module'] == 'Activities' || $_REQUEST['return_module'] == 'Calendar') { $return_module = $_REQUEST['module']; $return_action = $_REQUEST['return_action']; // wp: return action needs to be set for one-click close in task list } else { // if we "Cancel", we go back to the list view. $return_action = $_REQUEST['return_action']; } } } else { $return_action = "DetailView"; } if (isset($_REQUEST['return_id']) && $_REQUEST['return_id'] != "") { $return_id = $_REQUEST['return_id']; } if (!isset($isDuplicate) || !$isDuplicate) { //eggsurplus Bug 23816: maintain VCR after an edit/save. If it is a duplicate then don't worry about it. The offset is now worthless. $redirect_url = "Location: index.php?action={$return_action}&module={$return_module}&record={$return_id}&return_module={$return_module}&return_action={$return_action}"; if (isset($_REQUEST['offset']) && empty($_REQUEST['duplicateSave'])) { $redirect_url .= "&offset=" . $_REQUEST['offset']; } return $redirect_url; } else { $standard = "action={$return_action}&module={$return_module}&record={$return_id}&isDuplicate=true&return_module={$return_module}&return_action={$return_action}&status={$status}"; $add = ''; if (isset($additionalFlags) && !empty($additionalFlags)) { foreach ($additionalFlags as $k => $v) { if (!empty($add)) { $add .= "&"; } $add .= "{$k}={$v}"; } } if (!empty($add)) { $add = "&" . $add; } return "Location: index.php?{$standard}{$add}"; } }