// -------------------------------------------------------------------- // wo_new.php -- Adds a new work order. // // Created: 12/31/15 DLB // -------------------------------------------------------------------- require_once "../maindef.php"; $loc = rmabs(__FILE__); session_start(); log_page(); CheckLogin(); $timer = new timer(); $error_msg = ""; $success_msg = ""; $userid = GetUserID(); $username = GetUserName(); $userIPT = GetUserIPT($userid); $doform = false; $link_to_view = false; $picid = 0; $param_list = array(array("FieldName" => "Title", "FieldType" => "Text", "Caption" => "Title of New Work Order"), array("FieldName" => "Project", "FieldType" => "Selection", "Selection" => $WOProjects, "Caption" => "Project"), array("FieldName" => "DateNeedBy", "FieldType" => "Date", "Caption" => "Date Needed"), array("FieldName" => "Priority", "FieldType" => "Selection", "Selection" => $WOPriorities, "Caption" => "Priority"), array("FieldName" => "Requestor", "FieldType" => "Selection", "Selection" => $WOIPTeams, "Caption" => "Requesting IPT"), array("FieldName" => "Receiver", "FieldType" => "Selection", "Selection" => $WOIPTeams, "Caption" => "Receiving IPT"), array("FieldName" => "Description", "FieldType" => "TextArea", "Rows" => 10, "Columns" => 72, "Caption" => "Describe Work")); if ($_SERVER["REQUEST_METHOD"] == "GET") { // Set up defaults... $data["Priority"] = $WOPriorities[0]; $data["Requestor"] = $userIPT; $data["Receiver"] = $userIPT; $data["DateNeedBy"] = date('Y-m-d', time() + 5 * 24 * 3600); PopulateParamList($param_list, $data); $doform = true; goto GenerateHtml; } if ($_SERVER["REQUEST_METHOD"] == "POST") {
DieWithMsg($loc, "Bad team id given in URL."); } $IPT = $WOIPTeams[$teamid]; $_SESSION["InBoxTeam"] = $IPT; // Save it away for next time. } else { if (isset($_SESSION["InBoxTeam"])) { $IPT = $_SESSION["InBoxTeam"]; } else { $IPT = getUserIPT($userid); } } } // We now have the IPT team we are going to use. If it matches the user's IPT // team, the messaging is changes somewhat. if ($IPT == GetUserIPT($userid)) { $isuser = true; } $iptsearch = $IPT; if (empty($iptsearch)) { $iptsearch = "WILL NOT MATCH"; } if (!empty($_GET["Assigned"])) { $pagetitle = "Assigned Work Orders"; if ($isuser) { $pagetext = "These are work orders for your team that you have already assigned."; } else { $pagetext = "These are work orders that have already been assigned."; } $tabledata = array(); $sql = 'Select * FROM ActiveWorkOrders WHERE Receiver = "' . $iptsearch . '" AND Assigned = 1 AND Closed = 0 Limit ' . $nlimit;