aepnat /
simhelpdesk
| 1 | <?php |
||
| 2 | require 'core/init.php'; |
||
| 3 | $general->logged_out_protect(); |
||
| 4 | $changeby = $_SESSION['loginid']; |
||
| 5 | $user = $users->userdata($_SESSION['loginid']); |
||
| 6 | $id = $_GET['id']; |
||
| 7 | $ticket = $tickets->ticket_data($id); |
||
| 8 | if ($ticket['ticketstatus'] == 'Closed') {
|
||
| 9 | header("Location: ticketread.php?id=$id");
|
||
| 10 | exit(); |
||
| 11 | } |
||
| 12 | if (isset($_POST['submit'])) {
|
||
| 13 | $sla = $_POST['sla']; |
||
| 14 | $reporteddate = strtotime($_POST['reporteddate']); |
||
| 15 | $reportedby = $_POST['reportedby']; |
||
| 16 | $telp = $_POST['telp']; |
||
| 17 | $email = $_POST['email']; |
||
| 18 | $problemsummary = $_POST['problemsummary']; |
||
| 19 | $problemdetail = $_POST['problemdetail']; |
||
| 20 | $assignee = $_POST['idassignee']; |
||
| 21 | $type = $_POST['pro']; |
||
| 22 | $ticketstatus = $_POST['ticketstatus']; |
||
| 23 | $resolution = $_POST['resolution']; |
||
| 24 | $comment = $_POST['comment']; |
||
| 25 | $processby = $_POST['processby']; |
||
| 26 | $processdate = $_POST['processdate']; |
||
| 27 | $pendingby = $_POST['pendingby']; |
||
| 28 | $pendingdate = $_POST['pendingdate']; |
||
| 29 | $resolvedby = $_POST['resolvedby']; |
||
| 30 | $resolveddate = $_POST['resolveddate']; |
||
| 31 | $closedby = $_POST['closedby']; |
||
| 32 | $closeddate = $_POST['closeddate']; |
||
| 33 | $changes = 'Re-assigned the ticket.'; |
||
| 34 | if ($ticketstatus == 'Process') {
|
||
| 35 | $processby = $user['username']; |
||
| 36 | $processdate = strtotime(now); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 37 | $changes = 'Change Status to Process'; |
||
| 38 | } |
||
| 39 | if ($ticketstatus == 'Pending') {
|
||
| 40 | $pendingby = $user['username']; |
||
| 41 | $pendingdate = strtotime(now); |
||
| 42 | $changes = 'Change Status to Pending.'; |
||
| 43 | } |
||
| 44 | if ($ticketstatus == 'Resolved') {
|
||
| 45 | $resolvedby = $user['username']; |
||
| 46 | $resolveddate = strtotime(now); |
||
| 47 | $changes = 'Change Status to Resolved.'; |
||
| 48 | } |
||
| 49 | if ($ticketstatus == 'Closed') {
|
||
| 50 | $closedby = $user['username']; |
||
| 51 | $closeddate = strtotime(now); |
||
| 52 | $changes = 'Change Status to Closed.'; |
||
| 53 | } |
||
| 54 | $tickets->update_ticket($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate, $processby, $processdate, $comment); |
||
| 55 | $tickets->log_tickets($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate, $changes, $changeby, $processby, $processdate, $comment); |
||
| 56 | if ($user['level'] == 'Admin') {
|
||
| 57 | header('Location: ticketlist.php');
|
||
| 58 | } else {
|
||
| 59 | header('Location: myticketbyassignee.php');
|
||
| 60 | } |
||
| 61 | } |
||
| 62 | ?> |
||
| 63 | <!DOCTYPE HTML> |
||
| 64 | <html> |
||
| 65 | <head> |
||
| 66 | <title>Update Ticket</title> |
||
| 67 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
||
| 68 | <link rel="stylesheet" href="css/style.css" /> |
||
| 69 | <style type="text/css"> |
||
| 70 | body{font-size:12px;background-image:url('images/corner.jpg');background-repeat:no-repeat;background-attachment:fixed;font-family: Arial, Helvetica, sans-serif;}
|
||
| 71 | .breadcrumb{font-size:12px;color:#0000A0;}
|
||
| 72 | .formtable {text-align:left; font-size:12px;color:#000000; background-color:#f0f0f0;padding:10px;width:600px; }
|
||
| 73 | .errormsg {font-size:10pt;color:#ff0000;text-align:left;}
|
||
| 74 | </style> |
||
| 75 | <link rel="stylesheet" href="css/jquery-ui.css" /> |
||
| 76 | <script type="text/javascript" src="js/jquery.js"></script> |
||
| 77 | <script src="js/jquery-ui.js"></script> |
||
| 78 | <script type="text/javascript"> |
||
| 79 | $(document).ready(function(){
|
||
| 80 | $("#reporteddate").datepicker
|
||
| 81 | ({dateFormat:"dd-M-yy",changeMonth:true,changeYear:true,});
|
||
| 82 | }); |
||
| 83 | </script> |
||
| 84 | <script type="text/javascript"> |
||
| 85 | function cekData() |
||
| 86 | { if (ticketform.idassignee.value == "")
|
||
| 87 | { alert("Please choose assign to!");
|
||
| 88 | ticketform.idassignee.focus(); |
||
| 89 | return false; |
||
| 90 | } |
||
| 91 | if (ticketform.problemsummary.value == "") |
||
| 92 | { alert("Problem summary must be filled!");
|
||
| 93 | ticketform.problemsummary.focus(); |
||
| 94 | return false; |
||
| 95 | } |
||
| 96 | if (ticketform.problemdetail.value == "") |
||
| 97 | { alert("Problem detail must be filled!");
|
||
| 98 | ticketform.problemdetail.focus(); |
||
| 99 | return false; |
||
| 100 | } |
||
| 101 | if (ticketform.reportedby.value == "") |
||
| 102 | { alert("Reported By must be filled!");
|
||
| 103 | ticketform.reportedby.focus(); |
||
| 104 | return false; |
||
| 105 | } |
||
| 106 | if (ticketform.ticketstatus.value == "Closed") |
||
| 107 | { if(ticketform.oldticketstatus.value != "Resolved")
|
||
| 108 | { alert("You must set status to resolved before closed!");
|
||
| 109 | ticketform.ticketstatus.focus(); |
||
| 110 | return false; |
||
| 111 | } |
||
| 112 | } |
||
| 113 | else |
||
| 114 | return true; |
||
| 115 | } |
||
| 116 | </script> |
||
| 117 | </head> |
||
| 118 | <body> |
||
| 119 | <div class="breadcrumb"> >> Home >> Update Ticket</div> |
||
| 120 | <hr/> |
||
| 121 | <form name="ticketform" method="post" action="" onsubmit="return cekData();"> |
||
| 122 | <fieldset style="display: inline-block;"> |
||
| 123 | <?php echo '<legend> Ticket No: '.$ticket['ticketnumber'].'</legend>'; ?> |
||
| 124 | <div class="breadcrumb">*) Field Required</div> |
||
| 125 | <br/> |
||
| 126 | <table class="formtable"> |
||
| 127 | <tr> |
||
| 128 | <td width="120">Ticket No:</td><td> : </td> |
||
| 129 | <td><?php echo $ticket['ticketnumber']; ?> |
||
| 130 | <input type="hidden" size='20' name='ticketnumber' value=""> |
||
| 131 | </td> |
||
| 132 | </tr> |
||
| 133 | <tr> |
||
| 134 | <td> Reported Date*</td><td> : </td> |
||
| 135 | <td><input type="text" id="reporteddate" name="reporteddate" readonly="readonly" value="<?php echo date('d-M-Y', $ticket['reporteddate']); ?>"></td>
|
||
| 136 | </tr> |
||
| 137 | <tr> |
||
| 138 | <td> Reported By* </td><td> : </td> |
||
| 139 | <td> <input type='text' size='50' name='reportedby' maxlength="50" value='<?php echo $ticket['reportedby']; ?>'> </td> |
||
| 140 | </tr> |
||
| 141 | <tr> |
||
| 142 | <td> Urgency (SLA)*</td><td> : </td> |
||
| 143 | <td><select name="sla"> |
||
| 144 | <?php |
||
| 145 | $sladata = $slas->sla_data($ticket['sla']); |
||
| 146 | echo '<option value="'.$ticket['sla'].'" selected="selected">'.$sladata['namasla'].'</option>'; |
||
| 147 | $sla = $slas->get_sla(); |
||
| 148 | foreach ($sla as $slaval) {
|
||
| 149 | echo '<option value="'.$slaval['slaid'].'">'.$slaval['namasla'].'</option>'; |
||
| 150 | } |
||
| 151 | ?> |
||
| 152 | </select> |
||
| 153 | </td> |
||
| 154 | </tr> |
||
| 155 | <tr> |
||
| 156 | <td> Type</td><td> : </td> |
||
| 157 | <td> |
||
| 158 | <?php |
||
| 159 | //$pro = $slas->get_sla(); |
||
| 160 | echo $ticket['pro']; |
||
| 161 | |||
| 162 | ?> |
||
| 163 | |||
| 164 | </td> |
||
| 165 | </tr> |
||
| 166 | <tr> |
||
| 167 | <tr> |
||
| 168 | <td> Problem Summary* </td><td> : </td> |
||
| 169 | <td> <input type="text" size="60" name="problemsummary" maxlength="60" value='<?php echo $ticket['problemsummary']; ?>'> </td> |
||
| 170 | </tr> |
||
| 171 | <tr valign="top"> |
||
| 172 | <td> Problem Detail* </td><td> : </td> |
||
| 173 | <td> <textarea name="problemdetail" rows="3" cols="38"><?php echo $ticket['problemdetail']; ?></textarea> </td> |
||
| 174 | </tr> |
||
| 175 | </table> |
||
| 176 | <br/> |
||
| 177 | <table class="formtable"> |
||
| 178 | <tr> |
||
| 179 | <td width="120"> Assign to* </td><td> : </td> |
||
| 180 | <td> <select name="idassignee"> |
||
| 181 | <?php |
||
| 182 | $userassignee = $users->userdata($ticket['assignee']); |
||
| 183 | echo '<option value='.$ticket['assignee'].' selected="selected">'.$userassignee['fullname'].'</option>'; |
||
| 184 | $listusers = $users->get_users(); |
||
| 185 | foreach ($listusers as $user) {
|
||
| 186 | echo '<option value='.$user['id'].'>'.$user['fullname'].'</option>'; |
||
| 187 | } |
||
| 188 | ?> |
||
| 189 | </select> </td> |
||
| 190 | </tr> |
||
| 191 | <tr> |
||
| 192 | <td> Status* </td><td> : </td> |
||
| 193 | <td> <input type="hidden" name="oldticketstatus" value="<?php echo $ticket['ticketstatus']; ?>"> |
||
| 194 | <select name="ticketstatus"> |
||
| 195 | <option value="Assigned" <?php echo ($ticket['ticketstatus'] == 'Assigned') ? 'selected="selected"' : '';?>>Assigned</option> |
||
| 196 | <option value="Process" <?php echo ($ticket['ticketstatus'] == 'Process') ? 'selected="selected"' : '';?>>Process</option> |
||
| 197 | <option value="Resolved" <?php echo ($ticket['ticketstatus'] == 'Resolved') ? 'selected="selected"' : '';?>>Resolved</option> |
||
| 198 | <option value="Pending" <?php echo ($ticket['ticketstatus'] == 'Pending') ? 'selected="selected"' : '';?>>Pending</option> |
||
| 199 | <option value="Closed" <?php echo ($ticket['ticketstatus'] == 'Closed') ? 'selected="selected"' : '';?>>Closed</option> |
||
| 200 | </select> |
||
| 201 | </td> |
||
| 202 | </tr> |
||
| 203 | <tr valign="top"> |
||
| 204 | <td> Resolution* </td><td> : </td> |
||
| 205 | <td> <textarea name="resolution" rows="3" cols="38" <?php echo ($user['level'] == 'User') ? 'readonly="readonly"' : '';?>><?php echo $ticket['resolution']; ?></textarea> </td> |
||
| 206 | </tr> |
||
| 207 | <tr valign="top"> |
||
| 208 | <td> Comment* </td><td> : </td> |
||
| 209 | <td> <textarea name="comment" rows="3" cols="38" <?php echo ($user['level'] != 'User') ? 'readonly="readonly"' : '';?>><?php echo $ticket['comment']; ?></textarea> </td> |
||
| 210 | </tr> |
||
| 211 | <tr> |
||
| 212 | <td> </td><td> </td> |
||
| 213 | <td> <input type="hidden" name="pendingby" value="<?php echo $ticket['pendingby']; ?>"> |
||
| 214 | <input type="hidden" name="pendingdate" value="<?php echo $ticket['pendingdate']; ?>"> |
||
| 215 | <input type="hidden" name="resolvedby" value="<?php echo $ticket['resolvedby']; ?>"> |
||
| 216 | <input type="hidden" name="resolveddate" value="<?php echo $ticket['resolveddate']; ?>"> |
||
| 217 | <input type="hidden" name="closedby" value="<?php echo $ticket['closedby']; ?>"> |
||
| 218 | <input type="hidden" name="closeddate" value="<?php echo $ticket['closeddate']; ?>"> |
||
| 219 | </td> |
||
| 220 | </tr> |
||
| 221 | <tr> |
||
| 222 | <td> </td> <td> </td> |
||
| 223 | <td> |
||
| 224 | <input type='submit' name='submit' value=' Submit '> |
||
| 225 | <input type='reset' name='reset' value=' Reset '> |
||
| 226 | </td> |
||
| 227 | </tr> |
||
| 228 | </table> |
||
| 229 | </fieldset> |
||
| 230 | </form> |
||
| 231 | <br/> |
||
| 232 | <fieldset style="display: inline-block;"> |
||
| 233 | <legend> Ticket Audit Trail</legend> |
||
| 234 | <table class="formtable"> |
||
| 235 | <tr bgcolor="#e0e0e0" ><td width="150">Updated On</td><td width="150">Updated By</td><td>Description</td></tr> |
||
| 236 | <?php |
||
| 237 | $list_log_tickets = $tickets->get_audit_trail($id); |
||
| 238 | foreach ($list_log_tickets as $log_ticket) {
|
||
| 239 | $changed_by = $users->userdata($log_ticket['changeby']); |
||
| 240 | echo '<tr><td>'.date('d-M-Y H:i:s', $log_ticket['changedate']).'</td>'.
|
||
| 241 | '<td>'.$changed_by['fullname'].'</td>'. |
||
| 242 | '<td>'.$log_ticket['changes'].'</td></tr>'; |
||
| 243 | } |
||
| 244 | ?> |
||
| 245 | </table> |
||
| 246 | </fieldset> |
||
| 247 | <br/><br/> |
||
| 248 | </body> |
||
| 249 | </html> |