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