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 | $pendingby = $_POST['pendingby']; |
||
| 25 | $pendingdate = $_POST['pendingdate']; |
||
| 26 | $resolvedby = $_POST['resolvedby']; |
||
| 27 | $resolveddate = $_POST['resolveddate']; |
||
| 28 | $closedby = $_POST['closedby']; |
||
| 29 | $closeddate = $_POST['closeddate']; |
||
| 30 | $changes = 'Re-assigned the ticket.'; |
||
| 31 | if ($ticketstatus == 'Pending') { |
||
| 32 | $pendingby = $user['username']; |
||
| 33 | $pendingdate = strtotime(now); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 34 | $changes = 'Change Status to Pending.'; |
||
| 35 | } |
||
| 36 | if ($ticketstatus == 'Resolved') { |
||
| 37 | $resolvedby = $user['username']; |
||
| 38 | $resolveddate = strtotime(now); |
||
| 39 | $changes = 'Change Status to Resolved.'; |
||
| 40 | } |
||
| 41 | if ($ticketstatus == 'Closed') { |
||
| 42 | $closedby = $user['username']; |
||
| 43 | $closeddate = strtotime(now); |
||
| 44 | $changes = 'Change Status to Closed.'; |
||
| 45 | } |
||
| 46 | $tickets->update_ticket($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate); |
||
| 47 | $tickets->log_tickets($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate, $changes, $changeby); |
||
| 48 | if ($user['level'] == 'Admin') { |
||
| 49 | header('Location: ticketlist.php'); |
||
| 50 | } else { |
||
| 51 | header('Location: myticketbyassignee.php'); |
||
| 52 | } |
||
| 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{font-size:12px;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 | <link rel="stylesheet" href="css/jquery-ui.css" /> |
||
| 67 | <script type="text/javascript" src="js/jquery.js"></script> |
||
| 68 | <script src="js/jquery-ui.js"></script> |
||
| 69 | <script type="text/javascript"> |
||
| 70 | $(document).ready(function(){
|
||
| 71 | $("#reporteddate").datepicker
|
||
| 72 | ({dateFormat:"dd-M-yy",changeMonth:true,changeYear:true,});
|
||
| 73 | }); |
||
| 74 | </script> |
||
| 75 | <script type="text/javascript"> |
||
| 76 | function cekData() |
||
| 77 | { if (ticketform.idassignee.value == "")
|
||
| 78 | { alert("Please choose assign to!");
|
||
| 79 | ticketform.idassignee.focus(); |
||
| 80 | return false; |
||
| 81 | } |
||
| 82 | if (ticketform.problemsummary.value == "") |
||
| 83 | { alert("Problem summary must be filled!");
|
||
| 84 | ticketform.problemsummary.focus(); |
||
| 85 | return false; |
||
| 86 | } |
||
| 87 | if (ticketform.problemdetail.value == "") |
||
| 88 | { alert("Problem detail must be filled!");
|
||
| 89 | ticketform.problemdetail.focus(); |
||
| 90 | return false; |
||
| 91 | } |
||
| 92 | if (ticketform.reportedby.value == "") |
||
| 93 | { alert("Reported By must be filled!");
|
||
| 94 | ticketform.reportedby.focus(); |
||
| 95 | return false; |
||
| 96 | } |
||
| 97 | var filter = new RegExp( |
||
| 98 | "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + |
||
| 99 | "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$");
|
||
| 100 | if (!filter.test(ticketform.email.value) && ticketform.email.value != "") |
||
| 101 | { alert("Please enter a valid email address!");
|
||
| 102 | ticketform.email.focus(); |
||
| 103 | return false; |
||
| 104 | } |
||
| 105 | if (ticketform.ticketstatus.value == "Closed") |
||
| 106 | { if(ticketform.oldticketstatus.value != "Resolved")
|
||
| 107 | { alert("You must set status to resolved before closed!");
|
||
| 108 | ticketform.ticketstatus.focus(); |
||
| 109 | return false; |
||
| 110 | } |
||
| 111 | } |
||
| 112 | else |
||
| 113 | return true; |
||
| 114 | } |
||
| 115 | </script> |
||
| 116 | </head> |
||
| 117 | <body> |
||
| 118 | <div class="breadcrumb"> >> Home >> Update Ticket</div> |
||
| 119 | <hr/> |
||
| 120 | <form name="ticketform" method="post" action="" onsubmit="return cekData();"> |
||
| 121 | <fieldset style="display: inline-block;"> |
||
| 122 | <?php echo '<legend> Ticket No: '.$ticket['ticketnumber'].'</legend>'; ?> |
||
| 123 | <div class="breadcrumb">*) Field Required</div> |
||
| 124 | <!--<table class="formtable"> |
||
| 125 | <tr> |
||
| 126 | <td width="120"> Customer </td><td> : </td> |
||
| 127 | <td> |
||
| 128 | <?php |
||
| 129 | $customer = $customers->customer_data($ticket['idcustomer']); |
||
| 130 | echo $customer['namacustomer']; |
||
| 131 | ?> </td> |
||
| 132 | </tr> |
||
| 133 | <tr> |
||
| 134 | <td> Customer Product</td><td> : </td> |
||
| 135 | <td> <?php echo $customer['customerproduct']; ?> </td> |
||
| 136 | </tr> |
||
| 137 | <tr> |
||
| 138 | <td> Warranty Period</td><td> : </td> |
||
| 139 | <td> |
||
| 140 | <?php |
||
| 141 | $project = $projects->get_project_customer($customer['idcustomer']); |
||
| 142 | echo $project['warrantyperiod'].' Year'; |
||
| 143 | ?> </td> |
||
| 144 | </tr> |
||
| 145 | <tr> |
||
| 146 | <td> Contract Period</td><td> : </td> |
||
| 147 | <td> |
||
| 148 | <?php |
||
| 149 | echo $project['contractperiod'].' Month'; |
||
| 150 | ?> |
||
| 151 | </td> |
||
| 152 | </tr> |
||
| 153 | </table>--> |
||
| 154 | <br/> |
||
| 155 | <table class="formtable"> |
||
| 156 | <tr> |
||
| 157 | <td width="120">Ticket No:</td><td> : </td> |
||
| 158 | <td><?php echo $ticket['ticketnumber']; ?> |
||
| 159 | <input type="hidden" size='20' name='ticketnumber' value=""> |
||
| 160 | </td> |
||
| 161 | </tr> |
||
| 162 | <tr> |
||
| 163 | <td> Reported Date*</td><td> : </td> |
||
| 164 | <td><input type="text" id="reporteddate" name="reporteddate" readonly="readonly" value="<?php echo date('d-M-Y', $ticket['reporteddate']); ?>"></td>
|
||
| 165 | </tr> |
||
| 166 | <tr> |
||
| 167 | <td> Reported By* </td><td> : </td> |
||
| 168 | <td> <input type='text' size='50' name='reportedby' maxlength="50" value='<?php echo $ticket['reportedby']; ?>'> </td> |
||
| 169 | </tr> |
||
| 170 | <tr> |
||
| 171 | <td> Urgency (SLA)*</td><td> : </td> |
||
| 172 | <td><select name="sla"> |
||
| 173 | <?php |
||
| 174 | $sladata = $slas->sla_data($ticket['sla']); |
||
| 175 | echo '<option value="'.$ticket['sla'].'" selected="selected">'.$sladata['namasla'].'</option>'; |
||
| 176 | $sla = $slas->get_sla(); |
||
| 177 | foreach ($sla as $slaval) { |
||
| 178 | echo '<option value="'.$slaval['slaid'].'">'.$slaval['namasla'].'</option>'; |
||
| 179 | } |
||
| 180 | ?> |
||
| 181 | </select> |
||
| 182 | </td> |
||
| 183 | </tr> |
||
| 184 | <tr> |
||
| 185 | <td> Type</td><td> : </td> |
||
| 186 | <td> |
||
| 187 | <?php |
||
| 188 | //$pro = $slas->get_sla(); |
||
| 189 | echo $ticket['pro']; |
||
| 190 | |||
| 191 | ?> |
||
| 192 | |||
| 193 | </td> |
||
| 194 | </tr> |
||
| 195 | <tr> |
||
| 196 | <tr> |
||
| 197 | <td> Problem Summary* </td><td> : </td> |
||
| 198 | <td> <input type="text" size="60" name="problemsummary" maxlength="60" value='<?php echo $ticket['problemsummary']; ?>'> </td> |
||
| 199 | </tr> |
||
| 200 | <tr valign="top"> |
||
| 201 | <td> Problem Detail* </td><td> : </td> |
||
| 202 | <td> <textarea name="problemdetail" rows="3" cols="38"><?php echo $ticket['problemdetail']; ?></textarea> </td> |
||
| 203 | </tr> |
||
| 204 | <tr> |
||
| 205 | <td> Telephone </td><td> : </td> |
||
| 206 | <td> <input type='text' size='20' name='telp' maxlength="20" value='<?php echo $ticket['telp']; ?>'> </td> |
||
| 207 | </tr> |
||
| 208 | <tr> |
||
| 209 | <td> Email </td><td> : </td> |
||
| 210 | <td> <input type='text' size='50' name='email' maxlength="50" value='<?php echo $ticket['email']; ?>'> </td> |
||
| 211 | </tr> |
||
| 212 | </table> |
||
| 213 | <br/> |
||
| 214 | <table class="formtable"> |
||
| 215 | <tr> |
||
| 216 | <td width="120"> Assign to* </td><td> : </td> |
||
| 217 | <td> <select name="idassignee"> |
||
| 218 | <?php |
||
| 219 | $userassignee = $users->userdata($ticket['assignee']); |
||
| 220 | echo '<option value='.$ticket['assignee'].' selected="selected">'.$userassignee['fullname'].'</option>'; |
||
| 221 | $listusers = $users->get_users(); |
||
| 222 | foreach ($listusers as $user) { |
||
| 223 | echo '<option value='.$user['id'].'>'.$user['fullname'].'</option>'; |
||
| 224 | } |
||
| 225 | ?> |
||
| 226 | </select> </td> |
||
| 227 | </tr> |
||
| 228 | <tr> |
||
| 229 | <td> Status* </td><td> : </td> |
||
| 230 | <td> <input type="hidden" name="oldticketstatus" value="<?php echo $ticket['ticketstatus']; ?>"> |
||
| 231 | <select name="ticketstatus"> |
||
| 232 | <?php |
||
| 233 | echo '<option value='.$ticket['ticketstatus'].' selected="selected">'.$ticket['ticketstatus'].'</option>'; |
||
| 234 | ?> |
||
| 235 | <option value="Assigned"> Assigned </option> |
||
| 236 | <option value="Resolved"> Resolved </option> |
||
| 237 | <option value="Pending"> Pending </option> |
||
| 238 | <option value="Closed"> Closed </option> |
||
| 239 | </select> |
||
| 240 | </td> |
||
| 241 | </tr> |
||
| 242 | <tr valign="top"> |
||
| 243 | <td> Resolution* </td><td> : </td> |
||
| 244 | <td> <textarea name="resolution" rows="3" cols="38"><?php echo $ticket['resolution']; ?></textarea> </td> |
||
| 245 | </tr> |
||
| 246 | <tr> |
||
| 247 | <td> </td><td> </td> |
||
| 248 | <td> <input type="hidden" name="pendingby" value="<?php echo $ticket['pendingby']; ?>"> |
||
| 249 | <input type="hidden" name="pendingdate" value="<?php echo $ticket['pendingdate']; ?>"> |
||
| 250 | <input type="hidden" name="resolvedby" value="<?php echo $ticket['resolvedby']; ?>"> |
||
| 251 | <input type="hidden" name="resolveddate" value="<?php echo $ticket['resolveddate']; ?>"> |
||
| 252 | <input type="hidden" name="closedby" value="<?php echo $ticket['closedby']; ?>"> |
||
| 253 | <input type="hidden" name="closeddate" value="<?php echo $ticket['closeddate']; ?>"> |
||
| 254 | </td> |
||
| 255 | </tr> |
||
| 256 | <tr> |
||
| 257 | <td> </td> <td> </td> |
||
| 258 | <td> |
||
| 259 | <input type='submit' name='submit' value=' Submit '> |
||
| 260 | <input type='reset' name='reset' value=' Reset '> |
||
| 261 | </td> |
||
| 262 | </tr> |
||
| 263 | </table> |
||
| 264 | </fieldset> |
||
| 265 | </form> |
||
| 266 | <br/> |
||
| 267 | <fieldset style="display: inline-block;"> |
||
| 268 | <legend> Ticket Audit Trail</legend> |
||
| 269 | <table class="formtable"> |
||
| 270 | <tr bgcolor="#e0e0e0" ><td width="150">Updated On</td><td width="150">Updated By</td><td>Description</td></tr> |
||
| 271 | <?php |
||
| 272 | $list_log_tickets = $tickets->get_audit_trail($id); |
||
| 273 | foreach ($list_log_tickets as $log_ticket) { |
||
| 274 | $changed_by = $users->userdata($log_ticket['changeby']); |
||
| 275 | echo '<tr><td>'.date('d-M-Y H:i:s', $log_ticket['changedate']).'</td>'. |
||
| 276 | '<td>'.$changed_by['fullname'].'</td>'. |
||
| 277 | '<td>'.$log_ticket['changes'].'</td></tr>'; |
||
| 278 | } |
||
| 279 | ?> |
||
| 280 | </table> |
||
| 281 | </fieldset> |
||
| 282 | <br/><br/> |
||
| 283 | </body> |
||
| 284 | </html> |