<?
include($DOCUMENT_ROOT.'/helpdesk/include/database.php');
include($DOCUMENT_ROOT.'/helpdesk/include/new_user.php');
session_start();
if ($valid != "yes") {
header("Location: /helpdesk/login.php");
exit;
}
$head = "View/Modify Request";
$bttm_menu = " <a class=bttm_menu href='/helpdesk/scripts/main_adminmenu.php'>Main Menu</a> |
<a class=bttm_menu href='/helpdesk/scripts/request/view_requests.php'>View Requests</a> |
<a class=bttm_menu href='/helpdesk/scripts/request/select_user.php'>Create Request</a> |
<a class=bttm_menu href='/helpdesk/scripts/request/search_request.php'>Search for a Request</a> |
<a class=bttm_menu href='/helpdesk/logout.php'>Log Out</a> |
";
if ($submit) {
//Do the Checks
if (!$assn_id) { $msg[] = "- Assigned to."; $err = "1";}
if (!$get_prio_id) { $msg[] = "- Priority."; $err = "1";}
if (!$get_status_id) { $msg[] = "- Status."; $err = "1";}
if (!$get_type_id) { $msg[] = "- Type."; $err = "1";}
if (!$log_summary) { $msg[] = "- Summary."; $err = "1";}
if (!$prob_desc) { $msg[] = "- Problem Description."; $err = "1";}
if (!$contact_by) { $msg[] = "- Contact Method."; $err = "1";}
if ($contact_by) {
if ($contact_by == '1') { if (!$email) { $msg[] = "- Selected Contact Method does not contain a value."; $err = "1";} }
if ($contact_by == '2') { if (!$work_num) { $msg[] = "- Selected Contact Method does not contain a value."; $err = "1";} }
if ($contact_by == '3') { if (!$fax) { $msg[] = "- Selected Contact Method does not contain a value."; $err = "1";} }
if ($contact_by == '4') { if (!$mobile_num) { $msg[] = "- Selected Contact Method does not contain a value."; $err = "1";} }
}
if ($err == "1") {
$warning_temp = implode('<br> ', $msg);
}
//Now to validate the fields:
if (!$err) {
user_getname($user_id,$conn);
$log_name = $genout;
user_getname($assn_id,$conn);
$ass_name = $genout;
calc_response($start_datetime_yay,$get_prio_id,$conn);
$sql = "UPDATE requests
SET
request_used = 'yes',
user_name = '$users_name',
work_num = '$work_num',
email = '$email',
fax = '$fax',
mobile_num = '$mobile_num',
contact_by = '$contact_by',
modified_by_name = '$name',
modified_by_id = '$user_id',
assigned_to_name = '$ass_name',
assigned_to_id = '$assn_id',
respond_bytime = '$plus_datetime2',
call_prio = '$get_prio_id',
call_type = '$get_type_id',
call_state = '$get_status_id',
linked_logs = '$linked',
log_summary = '$log_summary',
prob_desc = '$prob_desc',
intern_anal = '$intern_anal',
contact_history = '$contact_history',
solution = '$solution'
WHERE request_id = '$request_id'
";
//echo $sql;
$result = mysql_query($sql,$conn) or die(mysql_errno().":2 ".mysql_error());
$warning = "<td class=success>** Request saved to database. ";
}
}
$sql = "SELECT * FROM requests WHERE request_id = '$select_requestid'";
$result = mysql_query($sql,$conn) or die(mysql_errno().":2 ".mysql_error());
while ($row = mysql_fetch_array($result)) {
$request_id = $row['request_id'];
$users_name = $row['user_name'];
$seluser_id = $row['seluser_id'];
$work_num = $row['work_num'];
$email = $row['email'];
$fax = $row['fax'];
$mobile_num = $row['mobile_num'];
$contact_by = $row['contact_by'];
$logged_by_name = $row['logged_by_name'];
$logged_by_id = $row['logged_by_id'];
$assigned_to_name = $row['assigned_to_name'];
$assn_id = $row['assigned_to_id'];
$modified_by_name = $row['modified_by_name'];
$modified_by_id = $row['modified_by_id'];
$start_datetime = $row['start_datetime'];
$respond_bytime = $row['respond_bytime'];
$get_prio_id = $row['call_prio'];
$get_type_id = $row['call_type'];
$get_status_id = $row['call_state'];
$linked_logs = $row['linked_logs'];
$log_summary = $row['log_summary'];
$prob_desc = $row['prob_desc'];
$intern_anal = $row['intern_anal'];
$contact_history = $row['contact_history'];
$solution = $row['solution'];
$fin_datetime = $row['fin_datetime'];
$closed_by = $row['closed_by'];
$time_spent = $row['time_spent'];
$request_closed = $row['request_closed'];
}
respond_within($respond_bytime,$conn);
convert_date($respond_bytime);
$respond_date = $output_date;
convert_date($start_datetime);
$start_datetime2 = $output_date;
//Selects all helpdesk support users and adds them to a drop down list
$sql = "SELECT user_id, f_name, l_name, per_id FROM help_users WHERE per_id=1 OR per_id=2 OR per_id=3";
$result = mysql_query($sql,$conn) or die(mysql_errno().":2 ".mysql_error());
$select_beg = "<select name=assn_id>";
if (!$assn_id) {
$select_start = "<option value=''>=Select an Option=</option>";
}
while ($row = mysql_fetch_array($result)) {
$sup_id = $row['user_id'];
$sup_fname = $row['f_name'];
$sup_lname = $row['l_name'];
$sup_name = "$sup_fname $sup_lname";
if ($sup_id == $assn_id) {
$select_start = "<option value='$sup_id'>$sup_name</option>";
} else {
$select2 .= "<option value='$sup_id'>$sup_name</option>";
}
}
$assn_select = $select_beg.$select_start.$select2.'</select>';
user_getDropMenu('prio_name','prio_name','get_prio_id','priorities',$conn,$get_prio_id,'no');
$prio_select = $select;
user_getDropMenu('status_name','status_name','get_status_id','log_status',$conn,$get_status_id,'no');
$status_select = $select;
user_getDropMenu('type_name','type_name','get_type_id','request_type',$conn,$get_type_id,'no');
$type_select = $select;
//This sections checks the radio button on from previous submit
if ($contact_by) {
if ($contact_by == "1") { $on1 = "checked=on"; }
if ($contact_by == "2") { $on2 = "checked=on"; }
if ($contact_by == "3") { $on3 = "checked=on"; }
if ($contact_by == "4") { $on4 = "checked=on"; }
}
$bottom = "
<h1>View/Modify Request</h1>
<em class=greentext>*</em> Please select prefered user contact method.<br>
<em class=redtext>*</em> Required fields.<br>
<form method=get action='$phpself'>
<table cellspacing=4 border=0>
<tr><td class=user nowrap>Request No.:<td width=210 align=left>$request_id
<td class=user nowrap>Logged By:<td width=210>$logged_by_name
<tr><td class=user nowrap>Users Name:<td align=left>$users_name
<td class=user nowrap>Modified By:<td width=210>$modified_by_name
<tr><td class=user nowrap>E-Mail:<td align=left><input type=text name=email value='$email' size=20><input $on1 type=radio name=contact_by value=1><em class=greentext>*</em>
<td class=user nowrap>Fax No.:<td width=210><input type=text name=fax value='$fax' size=15><input $on3 type=radio name=contact_by value=3><em class=greentext>*</em>
<tr><td class=user nowrap>Ext No.:<td width=210><input type=text name=work_num value='$work_num' size=15><input $on2 type=radio name=contact_by value=2><em class=greentext>*</em>
<td class=user nowrap>Mobile No.:<td align=left><input type=text name=mobile_num value='$mobile_num' size=15><input $on4 type=radio name=contact_by value=4><em class=greentext>*</em>
<tr><td class=pass nowrap>Assigned To:<td align=left>$assn_select<em class=redtext>*</em>
<td class=pass nowrap>Priority:<td width=210>$prio_select<em class=redtext>*</em>
<tr><td class=pass nowrap>Time & Date Started:<td align=left>$start_datetime2
<td class=pass nowrap>Status:<td width=210>$status_select<em class=redtext>*</em>
<tr><td class=pass nowrap>Respond by Time & Date:<td align=left colspan=3><b>$elapsed</b> $respond_date
<tr><td class=other nowrap>Summary:<td align=left><input type=text name=log_summary value='$log_summary' size=30 maxlength=30><em class=redtext>*</em>
<td class=other nowrap>Type of problem:<td width=210>$type_select<em class=redtext>*</em>
<tr><td class=other nowrap>Linked Requests:<td align=left><input type=text name=linked value='$linked' size=25>
<tr><td class=other nowrap valign=top>Problem Description:<td align=left colspan=3><textarea name=prob_desc cols=60 rows=5 wrap=virtual>$prob_desc</textarea><em class=redtext>*</em>
<tr><td class=other nowrap valign=top>Internal Analysis:<td align=left colspan=3><textarea name=intern_anal cols=60 rows=5 wrap=virtual>$intern_anal</textarea>
<tr><td class=other nowrap valign=top>Contact History:<td align=left colspan=3><textarea name=contact_history cols=60 rows=5 wrap=virtual>$contact_history</textarea>
<tr><td class=other nowrap valign=top>Solution:<td align=left colspan=3><textarea name=solution cols=60 rows=5 wrap=virtual>$solution</textarea>
<input type=hidden name=users_name value='$users_name'>
<input type=hidden name=start_datetime_yay value='$start_datetime'>
<input type=hidden name=select_userid value='$select_userid'>
<input type=hidden name=select_requestid value='$select_requestid'>
<input type=hidden name=request_id value='$request_id'>
</table>
<br>
<input type=submit name=submit value='Add Request'>
</form>
";
if ($warning_temp) {
$warning .= "<td class=warning>** Please fill in the following Values:<br><br>$warning_temp";
}
include($DOCUMENT_ROOT.'/helpdesk/include/template.inc.php');
?>