@@ -6,58 +6,58 @@ discard block |
||
| 6 | 6 | $id = $_GET['id']; |
| 7 | 7 | $ticket = $tickets->ticket_data($id); |
| 8 | 8 | if ($ticket['ticketstatus'] == 'Closed') {
|
| 9 | - header("Location: ticketread.php?id=$id");
|
|
| 10 | - exit(); |
|
| 9 | + header("Location: ticketread.php?id=$id");
|
|
| 10 | + exit(); |
|
| 11 | 11 | } |
| 12 | 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); |
|
| 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 | 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 | - $comment = $_POST['comment']; |
|
| 29 | - $processby = $_POST['processby']; |
|
| 30 | - $processdate = $_POST['processdate']; |
|
| 31 | - $pendingby = $_POST['pendingby']; |
|
| 32 | - $pendingdate = $_POST['pendingdate']; |
|
| 33 | - $resolvedby = $_POST['resolvedby']; |
|
| 34 | - $resolveddate = $_POST['resolveddate']; |
|
| 35 | - $closedby = $_POST['closedby']; |
|
| 36 | - $closeddate = $_POST['closeddate']; |
|
| 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 | + $comment = $_POST['comment']; |
|
| 29 | + $processby = $_POST['processby']; |
|
| 30 | + $processdate = $_POST['processdate']; |
|
| 31 | + $pendingby = $_POST['pendingby']; |
|
| 32 | + $pendingdate = $_POST['pendingdate']; |
|
| 33 | + $resolvedby = $_POST['resolvedby']; |
|
| 34 | + $resolveddate = $_POST['resolveddate']; |
|
| 35 | + $closedby = $_POST['closedby']; |
|
| 36 | + $closeddate = $_POST['closeddate']; |
|
| 37 | 37 | $changes = 'Re-assigned the ticket.'; |
| 38 | 38 | if ($ticketstatus == 'Process') {
|
| 39 | 39 | $processby = $user['username']; |
| 40 | 40 | $processdate = strtotime(now); |
| 41 | 41 | $changes = 'Change Status to Process'; |
| 42 | 42 | } |
| 43 | - if ($ticketstatus == 'Pending') {
|
|
| 44 | - $pendingby = $user['username']; |
|
| 45 | - $pendingdate = strtotime(now); |
|
| 46 | - $changes = 'Change Status to Pending.'; |
|
| 47 | - } |
|
| 48 | - if ($ticketstatus == 'Resolved') {
|
|
| 49 | - $resolvedby = $user['username']; |
|
| 50 | - $resolveddate = strtotime(now); |
|
| 51 | - $changes = 'Change Status to Resolved.'; |
|
| 52 | - } |
|
| 53 | - if ($ticketstatus == 'Closed') {
|
|
| 54 | - $closedby = $user['username']; |
|
| 55 | - $closeddate = strtotime(now); |
|
| 56 | - $changes = 'Change Status to Closed.'; |
|
| 57 | - } |
|
| 58 | - $tickets->update_ticket($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate, $processby, $processdate, $comment); |
|
| 59 | - $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); |
|
| 60 | - header('Location: ticketlistuser.php');
|
|
| 43 | + if ($ticketstatus == 'Pending') {
|
|
| 44 | + $pendingby = $user['username']; |
|
| 45 | + $pendingdate = strtotime(now); |
|
| 46 | + $changes = 'Change Status to Pending.'; |
|
| 47 | + } |
|
| 48 | + if ($ticketstatus == 'Resolved') {
|
|
| 49 | + $resolvedby = $user['username']; |
|
| 50 | + $resolveddate = strtotime(now); |
|
| 51 | + $changes = 'Change Status to Resolved.'; |
|
| 52 | + } |
|
| 53 | + if ($ticketstatus == 'Closed') {
|
|
| 54 | + $closedby = $user['username']; |
|
| 55 | + $closeddate = strtotime(now); |
|
| 56 | + $changes = 'Change Status to Closed.'; |
|
| 57 | + } |
|
| 58 | + $tickets->update_ticket($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate, $processby, $processdate, $comment); |
|
| 59 | + $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); |
|
| 60 | + header('Location: ticketlistuser.php');
|
|
| 61 | 61 | } |
| 62 | 62 | ?> |
| 63 | 63 | <!DOCTYPE HTML> |
@@ -146,8 +146,8 @@ discard block |
||
| 146 | 146 | <td> <input type="hidden" name="oldticketstatus" value="<?php echo $ticket['ticketstatus']; ?>"> |
| 147 | 147 | <select name="ticketstatus"> |
| 148 | 148 | <?php |
| 149 | - echo '<option value='.$ticket['ticketstatus'].' selected="selected">'.$ticket['ticketstatus'].'</option>'; |
|
| 150 | - ?> |
|
| 149 | + echo '<option value='.$ticket['ticketstatus'].' selected="selected">'.$ticket['ticketstatus'].'</option>'; |
|
| 150 | + ?> |
|
| 151 | 151 | <option value="Assigned"> Assigned </option> |
| 152 | 152 | <option value="Resolved"> Resolved </option> |
| 153 | 153 | <option value="Pending"> Pending </option> |
@@ -189,14 +189,14 @@ discard block |
||
| 189 | 189 | <table class="formtable"> |
| 190 | 190 | <tr bgcolor="#e0e0e0" ><td width="150">Updated On</td><td width="150">Updated By</td><td>Description</td></tr> |
| 191 | 191 | <?php |
| 192 | - $list_log_tickets = $tickets->get_audit_trail($id); |
|
| 193 | - foreach ($list_log_tickets as $log_ticket) {
|
|
| 194 | - $changed_by = $users->userdata($log_ticket['changeby']); |
|
| 195 | - echo '<tr><td>'.date('d-M-Y H:i:s', $log_ticket['changedate']).'</td>'.
|
|
| 196 | - '<td>'.$changed_by['fullname'].'</td>'. |
|
| 197 | - '<td>'.$log_ticket['changes'].'</td></tr>'; |
|
| 198 | - } |
|
| 199 | - ?> |
|
| 192 | + $list_log_tickets = $tickets->get_audit_trail($id); |
|
| 193 | + foreach ($list_log_tickets as $log_ticket) {
|
|
| 194 | + $changed_by = $users->userdata($log_ticket['changeby']); |
|
| 195 | + echo '<tr><td>'.date('d-M-Y H:i:s', $log_ticket['changedate']).'</td>'.
|
|
| 196 | + '<td>'.$changed_by['fullname'].'</td>'. |
|
| 197 | + '<td>'.$log_ticket['changes'].'</td></tr>'; |
|
| 198 | + } |
|
| 199 | + ?> |
|
| 200 | 200 | </table> |
| 201 | 201 | </fieldset> |
| 202 | 202 | <br/><br/> |
@@ -157,11 +157,11 @@ |
||
| 157 | 157 | </tr> |
| 158 | 158 | <tr valign="top"> |
| 159 | 159 | <td> Resolution* </td><td> : </td> |
| 160 | - <td> <textarea name="resolution" rows="3" cols="38" <?php echo ($user['level'] == 'User') ? 'readonly="readonly"' : '';?>><?php echo $ticket['resolution']; ?></textarea> </td> |
|
| 160 | + <td> <textarea name="resolution" rows="3" cols="38" <?php echo ($user['level'] == 'User') ? 'readonly="readonly"' : ''; ?>><?php echo $ticket['resolution']; ?></textarea> </td> |
|
| 161 | 161 | </tr> |
| 162 | 162 | <tr valign="top"> |
| 163 | 163 | <td> Comment* </td><td> : </td> |
| 164 | - <td> <textarea name="comment" rows="3" cols="38" <?php echo ($user['level'] != 'User') ? 'readonly="readonly"' : '';?>><?php echo $ticket['comment']; ?></textarea> </td> |
|
| 164 | + <td> <textarea name="comment" rows="3" cols="38" <?php echo ($user['level'] != 'User') ? 'readonly="readonly"' : ''; ?>><?php echo $ticket['comment']; ?></textarea> </td> |
|
| 165 | 165 | </tr> |
| 166 | 166 | <tr> |
| 167 | 167 | <td> </td><td> </td> |
@@ -6,58 +6,58 @@ discard block |
||
| 6 | 6 | $id = $_GET['id']; |
| 7 | 7 | $ticket = $tickets->ticket_data($id); |
| 8 | 8 | if ($ticket['ticketstatus'] == 'Closed') {
|
| 9 | - header("Location: ticketread.php?id=$id");
|
|
| 10 | - exit(); |
|
| 9 | + header("Location: ticketread.php?id=$id");
|
|
| 10 | + exit(); |
|
| 11 | 11 | } |
| 12 | 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.'; |
|
| 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 | 34 | if ($ticketstatus == 'Process') {
|
| 35 | 35 | $processby = $user['username']; |
| 36 | 36 | $processdate = strtotime(now); |
| 37 | 37 | $changes = 'Change Status to Process'; |
| 38 | 38 | } |
| 39 | 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 | - } |
|
| 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 | 61 | } |
| 62 | 62 | ?> |
| 63 | 63 | <!DOCTYPE HTML> |
@@ -142,13 +142,13 @@ discard block |
||
| 142 | 142 | <td> Urgency (SLA)*</td><td> : </td> |
| 143 | 143 | <td><select name="sla"> |
| 144 | 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 | - ?> |
|
| 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 | 152 | </select> |
| 153 | 153 | </td> |
| 154 | 154 | </tr> |
@@ -156,10 +156,10 @@ discard block |
||
| 156 | 156 | <td> Type</td><td> : </td> |
| 157 | 157 | <td> |
| 158 | 158 | <?php |
| 159 | - //$pro = $slas->get_sla(); |
|
| 160 | - echo $ticket['pro']; |
|
| 159 | + //$pro = $slas->get_sla(); |
|
| 160 | + echo $ticket['pro']; |
|
| 161 | 161 | |
| 162 | - ?> |
|
| 162 | + ?> |
|
| 163 | 163 | |
| 164 | 164 | </td> |
| 165 | 165 | </tr> |
@@ -179,13 +179,13 @@ discard block |
||
| 179 | 179 | <td width="120"> Assign to* </td><td> : </td> |
| 180 | 180 | <td> <select name="idassignee"> |
| 181 | 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 | - ?> |
|
| 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 | 189 | </select> </td> |
| 190 | 190 | </tr> |
| 191 | 191 | <tr> |
@@ -234,14 +234,14 @@ discard block |
||
| 234 | 234 | <table class="formtable"> |
| 235 | 235 | <tr bgcolor="#e0e0e0" ><td width="150">Updated On</td><td width="150">Updated By</td><td>Description</td></tr> |
| 236 | 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 | - ?> |
|
| 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 | 245 | </table> |
| 246 | 246 | </fieldset> |
| 247 | 247 | <br/><br/> |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 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 | 56 | if ($user['level'] == 'Admin') {
|
| 57 | 57 | header('Location: ticketlist.php');
|
| 58 | - } else {
|
|
| 58 | + }else {
|
|
| 59 | 59 | header('Location: myticketbyassignee.php');
|
| 60 | 60 | } |
| 61 | 61 | } |
@@ -192,21 +192,21 @@ discard block |
||
| 192 | 192 | <td> Status* </td><td> : </td> |
| 193 | 193 | <td> <input type="hidden" name="oldticketstatus" value="<?php echo $ticket['ticketstatus']; ?>"> |
| 194 | 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> |
|
| 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 | 200 | </select> |
| 201 | 201 | </td> |
| 202 | 202 | </tr> |
| 203 | 203 | <tr valign="top"> |
| 204 | 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> |
|
| 205 | + <td> <textarea name="resolution" rows="3" cols="38" <?php echo ($user['level'] == 'User') ? 'readonly="readonly"' : ''; ?>><?php echo $ticket['resolution']; ?></textarea> </td> |
|
| 206 | 206 | </tr> |
| 207 | 207 | <tr valign="top"> |
| 208 | 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> |
|
| 209 | + <td> <textarea name="comment" rows="3" cols="38" <?php echo ($user['level'] != 'User') ? 'readonly="readonly"' : ''; ?>><?php echo $ticket['comment']; ?></textarea> </td> |
|
| 210 | 210 | </tr> |
| 211 | 211 | <tr> |
| 212 | 212 | <td> </td><td> </td> |
@@ -3,279 +3,279 @@ discard block |
||
| 3 | 3 | date_default_timezone_set('Asia/Jakarta'); |
| 4 | 4 | class Tickets |
| 5 | 5 | { |
| 6 | - private $db; |
|
| 7 | - |
|
| 8 | - public function __construct($database) |
|
| 9 | - { |
|
| 10 | - $this->db = $database; |
|
| 11 | - } |
|
| 12 | - |
|
| 13 | - public function add_ticket($ticketnumber, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $documentedby, $pro) |
|
| 14 | - { |
|
| 15 | - $current = time(); |
|
| 16 | - $querystring = 'INSERT INTO `tickets` (`ticketnumber`,`sla`,`reporteddate`, `reportedby`, `telp`, `email`, `problemsummary`,`problemdetail`,`ticketstatus`,`assignee`,`documentedby`,`documenteddate`,`pro`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'; |
|
| 17 | - $query = $this->db->prepare($querystring); |
|
| 18 | - $query->bindValue(1, $ticketnumber); |
|
| 19 | - $query->bindValue(2, $sla); |
|
| 20 | - $query->bindValue(3, $reporteddate); |
|
| 21 | - $query->bindValue(4, $reportedby); |
|
| 22 | - $query->bindValue(5, $telp); |
|
| 23 | - $query->bindValue(6, $email); |
|
| 24 | - $query->bindValue(7, $problemsummary); |
|
| 25 | - $query->bindValue(8, $problemdetail); |
|
| 26 | - $query->bindValue(9, $ticketstatus); |
|
| 27 | - $query->bindValue(10, $assignee); |
|
| 28 | - $query->bindValue(11, $documentedby); |
|
| 29 | - $query->bindValue(12, $current); |
|
| 30 | - $query->bindValue(13, $pro); |
|
| 31 | - |
|
| 32 | - try { |
|
| 33 | - $query->execute(); |
|
| 34 | - } catch (PDOException $e) { |
|
| 35 | - die($e->getMessage()); |
|
| 36 | - } |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - public function update_ticket($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate, $processby, $processdate, $comment) |
|
| 40 | - { |
|
| 41 | - $querystring = 'UPDATE `tickets` SET `sla` = ? , `reporteddate` = ? , `reportedby` = ? , `telp` = ? ,`email` = ? , `problemsummary` = ? , `problemdetail` = ? ,`ticketstatus` = ?, `assignee` = ? , `assigneddate` = ?, `pendingby` = ?,`pendingdate` = ?, `resolution` = ? ,`resolvedby` = ?,`resolveddate` = ?,`closedby` = ?,`closeddate` = ?, `processby` = ?, `processdate` = ?, `comment` = ? WHERE `id` = ?'; |
|
| 42 | - $query = $this->db->prepare($querystring); |
|
| 43 | - $query->bindValue(1, $sla); |
|
| 44 | - $query->bindValue(2, $reporteddate); |
|
| 45 | - $query->bindValue(3, $reportedby); |
|
| 46 | - $query->bindValue(4, $telp); |
|
| 47 | - $query->bindValue(5, $email); |
|
| 48 | - $query->bindValue(6, $problemsummary); |
|
| 49 | - $query->bindValue(7, $problemdetail); |
|
| 50 | - $query->bindValue(8, $ticketstatus); |
|
| 51 | - $query->bindValue(9, $assignee); |
|
| 52 | - $query->bindValue(10, $assigneddate); |
|
| 53 | - $query->bindValue(11, $pendingby); |
|
| 54 | - $query->bindValue(12, $pendingdate); |
|
| 55 | - $query->bindValue(13, $resolution); |
|
| 56 | - $query->bindValue(14, $resolvedby); |
|
| 57 | - $query->bindValue(15, $resolveddate); |
|
| 58 | - $query->bindValue(16, $closedby); |
|
| 59 | - $query->bindValue(17, $closeddate); |
|
| 60 | - $query->bindValue(18, $processby); |
|
| 61 | - $query->bindValue(19, $processdate); |
|
| 62 | - $query->bindValue(20, $comment); |
|
| 63 | - $query->bindValue(21, $id); |
|
| 64 | - |
|
| 65 | - try { |
|
| 66 | - $query->execute(); |
|
| 67 | - } catch (PDOException $e) { |
|
| 68 | - die($e->getMessage()); |
|
| 69 | - } |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - public function delete($id) |
|
| 73 | - { |
|
| 74 | - $sql = 'DELETE FROM `tickets` WHERE `id` = ?'; |
|
| 75 | - $query = $this->db->prepare($sql); |
|
| 76 | - $query->bindValue(1, $id); |
|
| 77 | - |
|
| 78 | - try { |
|
| 79 | - $query->execute(); |
|
| 80 | - } catch (PDOException $e) { |
|
| 81 | - die($e->getMessage()); |
|
| 82 | - } |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - public function ticket_data($id) |
|
| 86 | - { |
|
| 87 | - $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `id`= ?'); |
|
| 88 | - $query->bindValue(1, $id); |
|
| 89 | - |
|
| 90 | - try { |
|
| 91 | - $query->execute(); |
|
| 92 | - |
|
| 93 | - return $query->fetch(); |
|
| 94 | - } catch (PDOException $e) { |
|
| 95 | - die($e->getMessage()); |
|
| 96 | - } |
|
| 97 | - } |
|
| 98 | - |
|
| 99 | - public function get_tickets() |
|
| 100 | - { |
|
| 101 | - $query = $this->db->prepare('SELECT * FROM `tickets` ORDER BY `ticketnumber` DESC'); |
|
| 102 | - |
|
| 103 | - try { |
|
| 104 | - $query->execute(); |
|
| 105 | - } catch (PDOException $e) { |
|
| 106 | - die($e->getMessage()); |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - return $query->fetchAll(); |
|
| 110 | - } |
|
| 111 | - |
|
| 112 | - public function get_pro() |
|
| 113 | - { |
|
| 114 | - $query = $this->db->prepare('SELECT pro FROM `tickets`'); |
|
| 115 | - |
|
| 116 | - try { |
|
| 117 | - $query->execute(); |
|
| 118 | - } catch (PDOException $e) { |
|
| 119 | - die($e->getMessage()); |
|
| 120 | - } |
|
| 121 | - |
|
| 122 | - return $query->fetchAll(); |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - public function get_opened_tickets() |
|
| 126 | - { |
|
| 127 | - $query = $this->db->prepare("SELECT * FROM `tickets` WHERE `ticketstatus` <> 'Closed' ORDER BY `ticketnumber` DESC"); |
|
| 128 | - |
|
| 129 | - try { |
|
| 130 | - $query->execute(); |
|
| 131 | - } catch (PDOException $e) { |
|
| 132 | - die($e->getMessage()); |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - return $query->fetchAll(); |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - public function get_tickets_by_requester($userid) |
|
| 139 | - { |
|
| 140 | - $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `documentedby`= ? ORDER BY `ticketnumber` DESC'); |
|
| 141 | - $query->bindValue(1, $userid); |
|
| 142 | - |
|
| 143 | - try { |
|
| 144 | - $query->execute(); |
|
| 145 | - } catch (PDOException $e) { |
|
| 146 | - die($e->getMessage()); |
|
| 147 | - } |
|
| 148 | - |
|
| 149 | - return $query->fetchAll(); |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - public function get_tickets_by_assignee($userid) |
|
| 153 | - { |
|
| 154 | - $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `assignee`= ? ORDER BY `ticketnumber` DESC'); |
|
| 155 | - $query->bindValue(1, $userid); |
|
| 156 | - |
|
| 157 | - try { |
|
| 158 | - $query->execute(); |
|
| 159 | - } catch (PDOException $e) { |
|
| 160 | - die($e->getMessage()); |
|
| 161 | - } |
|
| 162 | - |
|
| 163 | - return $query->fetchAll(); |
|
| 164 | - } |
|
| 165 | - |
|
| 166 | - public function get_tickets_by_resolver($username) |
|
| 167 | - { |
|
| 168 | - $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `resolvedby`= ? ORDER BY `ticketnumber` DESC'); |
|
| 169 | - $query->bindValue(1, $username); |
|
| 170 | - |
|
| 171 | - try { |
|
| 172 | - $query->execute(); |
|
| 173 | - } catch (PDOException $e) { |
|
| 174 | - die($e->getMessage()); |
|
| 175 | - } |
|
| 176 | - |
|
| 177 | - return $query->fetchAll(); |
|
| 178 | - } |
|
| 179 | - |
|
| 180 | - public function get_tickets_by_resolver_not_closed($username) |
|
| 181 | - { |
|
| 182 | - $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `resolvedby`=? and `ticketstatus` <> ? ORDER BY `ticketnumber` DESC'); |
|
| 183 | - $query->bindValue(1, $username); |
|
| 184 | - $query->bindValue(2, 'Closed'); |
|
| 185 | - |
|
| 186 | - try { |
|
| 187 | - $query->execute(); |
|
| 188 | - } catch (PDOException $e) { |
|
| 189 | - die($e->getMessage()); |
|
| 190 | - } |
|
| 191 | - |
|
| 192 | - return $query->fetchAll(); |
|
| 193 | - } |
|
| 194 | - |
|
| 195 | - public function get_tickets_by_status($ticketstatus) |
|
| 196 | - { |
|
| 197 | - $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `ticketstatus`=? ORDER BY `ticketnumber` DESC'); |
|
| 198 | - $query->bindValue(1, $ticketstatus); |
|
| 199 | - |
|
| 200 | - try { |
|
| 201 | - $query->execute(); |
|
| 202 | - } catch (PDOException $e) { |
|
| 203 | - die($e->getMessage()); |
|
| 204 | - } |
|
| 205 | - |
|
| 206 | - return $query->fetchAll(); |
|
| 207 | - } |
|
| 208 | - |
|
| 209 | - public function search_closed_ticket($fromperiod, $toperiod) |
|
| 210 | - { |
|
| 211 | - $query = $this->db->prepare("SELECT * FROM `tickets` WHERE `documenteddate` >= ? AND `documenteddate` <= ? AND `ticketstatus` = 'Closed' ORDER BY `documenteddate` DESC"); |
|
| 212 | - $query->bindValue(1, $fromperiod); |
|
| 213 | - $query->bindValue(2, $toperiod); |
|
| 214 | - |
|
| 215 | - try { |
|
| 216 | - $query->execute(); |
|
| 217 | - } catch (PDOException $e) { |
|
| 218 | - die($e->getMessage()); |
|
| 219 | - } |
|
| 220 | - |
|
| 221 | - return $query->fetchAll(); |
|
| 222 | - } |
|
| 223 | - |
|
| 224 | - public function count_tickets_by_status() |
|
| 225 | - { |
|
| 226 | - $query = $this->db->prepare('SELECT ticketstatus, count(*) as total FROM `tickets` GROUP BY ticketstatus'); |
|
| 227 | - |
|
| 228 | - try { |
|
| 229 | - $query->execute(); |
|
| 230 | - } catch (PDOException $e) { |
|
| 231 | - die($e->getMessage()); |
|
| 232 | - } |
|
| 233 | - |
|
| 234 | - return $query->fetchAll(); |
|
| 235 | - } |
|
| 236 | - |
|
| 237 | - public function count_resolved_tickets_by_month() |
|
| 238 | - { |
|
| 239 | - $sql = "SELECT Month(FROM_UNIXTIME(`documenteddate`)) as Bulan, Count(*) as Total FROM `tickets` WHERE (`ticketstatus`='Resolved' OR `ticketstatus`='Closed') AND FROM_UNIXTIME(`documenteddate`) >= CURDATE() - INTERVAL 1 YEAR GROUP BY Month(FROM_UNIXTIME(`documenteddate`))"; |
|
| 240 | - $query = $this->db->prepare($sql); |
|
| 241 | - |
|
| 242 | - try { |
|
| 243 | - $query->execute(); |
|
| 244 | - } catch (PDOException $e) { |
|
| 245 | - die($e->getMessage()); |
|
| 246 | - } |
|
| 247 | - |
|
| 248 | - return $query->fetchAll(); |
|
| 249 | - } |
|
| 250 | - |
|
| 251 | - public function count_inprogress_tickets_by_month() |
|
| 252 | - { |
|
| 253 | - $sql = "SELECT Month(FROM_UNIXTIME(`documenteddate`)) as Bulan, Count(*) as Total FROM `tickets` WHERE (`ticketstatus`='Assigned' OR `ticketstatus`='Pending') AND FROM_UNIXTIME(`documenteddate`) >= CURDATE() - INTERVAL 1 YEAR GROUP BY Month(FROM_UNIXTIME(`documenteddate`))"; |
|
| 254 | - $query = $this->db->prepare($sql); |
|
| 255 | - |
|
| 256 | - try { |
|
| 257 | - $query->execute(); |
|
| 258 | - } catch (PDOException $e) { |
|
| 259 | - die($e->getMessage()); |
|
| 260 | - } |
|
| 261 | - |
|
| 262 | - return $query->fetchAll(); |
|
| 263 | - } |
|
| 264 | - |
|
| 265 | - public function get_last_ticket() |
|
| 266 | - { |
|
| 267 | - $query = $this->db->prepare('SELECT * FROM `tickets` ORDER BY id DESC LIMIT 1'); |
|
| 268 | - |
|
| 269 | - try { |
|
| 270 | - $query->execute(); |
|
| 271 | - |
|
| 272 | - return $query->fetch(); |
|
| 273 | - } catch (PDOException $e) { |
|
| 274 | - die($e->getMessage()); |
|
| 275 | - } |
|
| 276 | - } |
|
| 277 | - |
|
| 278 | - /* |
|
| 6 | + private $db; |
|
| 7 | + |
|
| 8 | + public function __construct($database) |
|
| 9 | + { |
|
| 10 | + $this->db = $database; |
|
| 11 | + } |
|
| 12 | + |
|
| 13 | + public function add_ticket($ticketnumber, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $documentedby, $pro) |
|
| 14 | + { |
|
| 15 | + $current = time(); |
|
| 16 | + $querystring = 'INSERT INTO `tickets` (`ticketnumber`,`sla`,`reporteddate`, `reportedby`, `telp`, `email`, `problemsummary`,`problemdetail`,`ticketstatus`,`assignee`,`documentedby`,`documenteddate`,`pro`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'; |
|
| 17 | + $query = $this->db->prepare($querystring); |
|
| 18 | + $query->bindValue(1, $ticketnumber); |
|
| 19 | + $query->bindValue(2, $sla); |
|
| 20 | + $query->bindValue(3, $reporteddate); |
|
| 21 | + $query->bindValue(4, $reportedby); |
|
| 22 | + $query->bindValue(5, $telp); |
|
| 23 | + $query->bindValue(6, $email); |
|
| 24 | + $query->bindValue(7, $problemsummary); |
|
| 25 | + $query->bindValue(8, $problemdetail); |
|
| 26 | + $query->bindValue(9, $ticketstatus); |
|
| 27 | + $query->bindValue(10, $assignee); |
|
| 28 | + $query->bindValue(11, $documentedby); |
|
| 29 | + $query->bindValue(12, $current); |
|
| 30 | + $query->bindValue(13, $pro); |
|
| 31 | + |
|
| 32 | + try { |
|
| 33 | + $query->execute(); |
|
| 34 | + } catch (PDOException $e) { |
|
| 35 | + die($e->getMessage()); |
|
| 36 | + } |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + public function update_ticket($id, $sla, $reporteddate, $reportedby, $telp, $email, $problemsummary, $problemdetail, $ticketstatus, $assignee, $assigneddate, $pendingby, $pendingdate, $resolution, $resolvedby, $resolveddate, $closedby, $closeddate, $processby, $processdate, $comment) |
|
| 40 | + { |
|
| 41 | + $querystring = 'UPDATE `tickets` SET `sla` = ? , `reporteddate` = ? , `reportedby` = ? , `telp` = ? ,`email` = ? , `problemsummary` = ? , `problemdetail` = ? ,`ticketstatus` = ?, `assignee` = ? , `assigneddate` = ?, `pendingby` = ?,`pendingdate` = ?, `resolution` = ? ,`resolvedby` = ?,`resolveddate` = ?,`closedby` = ?,`closeddate` = ?, `processby` = ?, `processdate` = ?, `comment` = ? WHERE `id` = ?'; |
|
| 42 | + $query = $this->db->prepare($querystring); |
|
| 43 | + $query->bindValue(1, $sla); |
|
| 44 | + $query->bindValue(2, $reporteddate); |
|
| 45 | + $query->bindValue(3, $reportedby); |
|
| 46 | + $query->bindValue(4, $telp); |
|
| 47 | + $query->bindValue(5, $email); |
|
| 48 | + $query->bindValue(6, $problemsummary); |
|
| 49 | + $query->bindValue(7, $problemdetail); |
|
| 50 | + $query->bindValue(8, $ticketstatus); |
|
| 51 | + $query->bindValue(9, $assignee); |
|
| 52 | + $query->bindValue(10, $assigneddate); |
|
| 53 | + $query->bindValue(11, $pendingby); |
|
| 54 | + $query->bindValue(12, $pendingdate); |
|
| 55 | + $query->bindValue(13, $resolution); |
|
| 56 | + $query->bindValue(14, $resolvedby); |
|
| 57 | + $query->bindValue(15, $resolveddate); |
|
| 58 | + $query->bindValue(16, $closedby); |
|
| 59 | + $query->bindValue(17, $closeddate); |
|
| 60 | + $query->bindValue(18, $processby); |
|
| 61 | + $query->bindValue(19, $processdate); |
|
| 62 | + $query->bindValue(20, $comment); |
|
| 63 | + $query->bindValue(21, $id); |
|
| 64 | + |
|
| 65 | + try { |
|
| 66 | + $query->execute(); |
|
| 67 | + } catch (PDOException $e) { |
|
| 68 | + die($e->getMessage()); |
|
| 69 | + } |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + public function delete($id) |
|
| 73 | + { |
|
| 74 | + $sql = 'DELETE FROM `tickets` WHERE `id` = ?'; |
|
| 75 | + $query = $this->db->prepare($sql); |
|
| 76 | + $query->bindValue(1, $id); |
|
| 77 | + |
|
| 78 | + try { |
|
| 79 | + $query->execute(); |
|
| 80 | + } catch (PDOException $e) { |
|
| 81 | + die($e->getMessage()); |
|
| 82 | + } |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + public function ticket_data($id) |
|
| 86 | + { |
|
| 87 | + $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `id`= ?'); |
|
| 88 | + $query->bindValue(1, $id); |
|
| 89 | + |
|
| 90 | + try { |
|
| 91 | + $query->execute(); |
|
| 92 | + |
|
| 93 | + return $query->fetch(); |
|
| 94 | + } catch (PDOException $e) { |
|
| 95 | + die($e->getMessage()); |
|
| 96 | + } |
|
| 97 | + } |
|
| 98 | + |
|
| 99 | + public function get_tickets() |
|
| 100 | + { |
|
| 101 | + $query = $this->db->prepare('SELECT * FROM `tickets` ORDER BY `ticketnumber` DESC'); |
|
| 102 | + |
|
| 103 | + try { |
|
| 104 | + $query->execute(); |
|
| 105 | + } catch (PDOException $e) { |
|
| 106 | + die($e->getMessage()); |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + return $query->fetchAll(); |
|
| 110 | + } |
|
| 111 | + |
|
| 112 | + public function get_pro() |
|
| 113 | + { |
|
| 114 | + $query = $this->db->prepare('SELECT pro FROM `tickets`'); |
|
| 115 | + |
|
| 116 | + try { |
|
| 117 | + $query->execute(); |
|
| 118 | + } catch (PDOException $e) { |
|
| 119 | + die($e->getMessage()); |
|
| 120 | + } |
|
| 121 | + |
|
| 122 | + return $query->fetchAll(); |
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + public function get_opened_tickets() |
|
| 126 | + { |
|
| 127 | + $query = $this->db->prepare("SELECT * FROM `tickets` WHERE `ticketstatus` <> 'Closed' ORDER BY `ticketnumber` DESC"); |
|
| 128 | + |
|
| 129 | + try { |
|
| 130 | + $query->execute(); |
|
| 131 | + } catch (PDOException $e) { |
|
| 132 | + die($e->getMessage()); |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + return $query->fetchAll(); |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + public function get_tickets_by_requester($userid) |
|
| 139 | + { |
|
| 140 | + $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `documentedby`= ? ORDER BY `ticketnumber` DESC'); |
|
| 141 | + $query->bindValue(1, $userid); |
|
| 142 | + |
|
| 143 | + try { |
|
| 144 | + $query->execute(); |
|
| 145 | + } catch (PDOException $e) { |
|
| 146 | + die($e->getMessage()); |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + return $query->fetchAll(); |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + public function get_tickets_by_assignee($userid) |
|
| 153 | + { |
|
| 154 | + $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `assignee`= ? ORDER BY `ticketnumber` DESC'); |
|
| 155 | + $query->bindValue(1, $userid); |
|
| 156 | + |
|
| 157 | + try { |
|
| 158 | + $query->execute(); |
|
| 159 | + } catch (PDOException $e) { |
|
| 160 | + die($e->getMessage()); |
|
| 161 | + } |
|
| 162 | + |
|
| 163 | + return $query->fetchAll(); |
|
| 164 | + } |
|
| 165 | + |
|
| 166 | + public function get_tickets_by_resolver($username) |
|
| 167 | + { |
|
| 168 | + $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `resolvedby`= ? ORDER BY `ticketnumber` DESC'); |
|
| 169 | + $query->bindValue(1, $username); |
|
| 170 | + |
|
| 171 | + try { |
|
| 172 | + $query->execute(); |
|
| 173 | + } catch (PDOException $e) { |
|
| 174 | + die($e->getMessage()); |
|
| 175 | + } |
|
| 176 | + |
|
| 177 | + return $query->fetchAll(); |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + public function get_tickets_by_resolver_not_closed($username) |
|
| 181 | + { |
|
| 182 | + $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `resolvedby`=? and `ticketstatus` <> ? ORDER BY `ticketnumber` DESC'); |
|
| 183 | + $query->bindValue(1, $username); |
|
| 184 | + $query->bindValue(2, 'Closed'); |
|
| 185 | + |
|
| 186 | + try { |
|
| 187 | + $query->execute(); |
|
| 188 | + } catch (PDOException $e) { |
|
| 189 | + die($e->getMessage()); |
|
| 190 | + } |
|
| 191 | + |
|
| 192 | + return $query->fetchAll(); |
|
| 193 | + } |
|
| 194 | + |
|
| 195 | + public function get_tickets_by_status($ticketstatus) |
|
| 196 | + { |
|
| 197 | + $query = $this->db->prepare('SELECT * FROM `tickets` WHERE `ticketstatus`=? ORDER BY `ticketnumber` DESC'); |
|
| 198 | + $query->bindValue(1, $ticketstatus); |
|
| 199 | + |
|
| 200 | + try { |
|
| 201 | + $query->execute(); |
|
| 202 | + } catch (PDOException $e) { |
|
| 203 | + die($e->getMessage()); |
|
| 204 | + } |
|
| 205 | + |
|
| 206 | + return $query->fetchAll(); |
|
| 207 | + } |
|
| 208 | + |
|
| 209 | + public function search_closed_ticket($fromperiod, $toperiod) |
|
| 210 | + { |
|
| 211 | + $query = $this->db->prepare("SELECT * FROM `tickets` WHERE `documenteddate` >= ? AND `documenteddate` <= ? AND `ticketstatus` = 'Closed' ORDER BY `documenteddate` DESC"); |
|
| 212 | + $query->bindValue(1, $fromperiod); |
|
| 213 | + $query->bindValue(2, $toperiod); |
|
| 214 | + |
|
| 215 | + try { |
|
| 216 | + $query->execute(); |
|
| 217 | + } catch (PDOException $e) { |
|
| 218 | + die($e->getMessage()); |
|
| 219 | + } |
|
| 220 | + |
|
| 221 | + return $query->fetchAll(); |
|
| 222 | + } |
|
| 223 | + |
|
| 224 | + public function count_tickets_by_status() |
|
| 225 | + { |
|
| 226 | + $query = $this->db->prepare('SELECT ticketstatus, count(*) as total FROM `tickets` GROUP BY ticketstatus'); |
|
| 227 | + |
|
| 228 | + try { |
|
| 229 | + $query->execute(); |
|
| 230 | + } catch (PDOException $e) { |
|
| 231 | + die($e->getMessage()); |
|
| 232 | + } |
|
| 233 | + |
|
| 234 | + return $query->fetchAll(); |
|
| 235 | + } |
|
| 236 | + |
|
| 237 | + public function count_resolved_tickets_by_month() |
|
| 238 | + { |
|
| 239 | + $sql = "SELECT Month(FROM_UNIXTIME(`documenteddate`)) as Bulan, Count(*) as Total FROM `tickets` WHERE (`ticketstatus`='Resolved' OR `ticketstatus`='Closed') AND FROM_UNIXTIME(`documenteddate`) >= CURDATE() - INTERVAL 1 YEAR GROUP BY Month(FROM_UNIXTIME(`documenteddate`))"; |
|
| 240 | + $query = $this->db->prepare($sql); |
|
| 241 | + |
|
| 242 | + try { |
|
| 243 | + $query->execute(); |
|
| 244 | + } catch (PDOException $e) { |
|
| 245 | + die($e->getMessage()); |
|
| 246 | + } |
|
| 247 | + |
|
| 248 | + return $query->fetchAll(); |
|
| 249 | + } |
|
| 250 | + |
|
| 251 | + public function count_inprogress_tickets_by_month() |
|
| 252 | + { |
|
| 253 | + $sql = "SELECT Month(FROM_UNIXTIME(`documenteddate`)) as Bulan, Count(*) as Total FROM `tickets` WHERE (`ticketstatus`='Assigned' OR `ticketstatus`='Pending') AND FROM_UNIXTIME(`documenteddate`) >= CURDATE() - INTERVAL 1 YEAR GROUP BY Month(FROM_UNIXTIME(`documenteddate`))"; |
|
| 254 | + $query = $this->db->prepare($sql); |
|
| 255 | + |
|
| 256 | + try { |
|
| 257 | + $query->execute(); |
|
| 258 | + } catch (PDOException $e) { |
|
| 259 | + die($e->getMessage()); |
|
| 260 | + } |
|
| 261 | + |
|
| 262 | + return $query->fetchAll(); |
|
| 263 | + } |
|
| 264 | + |
|
| 265 | + public function get_last_ticket() |
|
| 266 | + { |
|
| 267 | + $query = $this->db->prepare('SELECT * FROM `tickets` ORDER BY id DESC LIMIT 1'); |
|
| 268 | + |
|
| 269 | + try { |
|
| 270 | + $query->execute(); |
|
| 271 | + |
|
| 272 | + return $query->fetch(); |
|
| 273 | + } catch (PDOException $e) { |
|
| 274 | + die($e->getMessage()); |
|
| 275 | + } |
|
| 276 | + } |
|
| 277 | + |
|
| 278 | + /* |
|
| 279 | 279 | public function notify_assignee($id,$ticketnumber,$email_assignee) |
| 280 | 280 | { if (substr(php_uname(), 0, 7) == "Windows"){ |
| 281 | 281 | $cmd = "D:\mowes_portable\www\helpdesk\batch\sendemail.bat"; |
@@ -289,54 +289,54 @@ discard block |
||
| 289 | 289 | } |
| 290 | 290 | }*/ |
| 291 | 291 | |
| 292 | - public function 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) |
|
| 293 | - { |
|
| 294 | - $changedate = time(); |
|
| 295 | - $querystring = 'INSERT INTO `log_tickets` (`id`,`sla`,`reporteddate`, `reportedby`, `telp`, `email`, `problemsummary`,`problemdetail`,`ticketstatus`,`assignee`,`assigneddate`,`pendingby`,`pendingdate`,`resolution`,`resolvedby`,`resolveddate`,`closedby`,`closeddate`,`changes`,`changeby`,`changedate`,`processby`,`processdate`,`comment`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'; |
|
| 296 | - $query = $this->db->prepare($querystring); |
|
| 297 | - $query->bindValue(1, $id); |
|
| 298 | - $query->bindValue(2, $sla); |
|
| 299 | - $query->bindValue(3, $reporteddate); |
|
| 300 | - $query->bindValue(4, $reportedby); |
|
| 301 | - $query->bindValue(5, $telp); |
|
| 302 | - $query->bindValue(6, $email); |
|
| 303 | - $query->bindValue(7, $problemsummary); |
|
| 304 | - $query->bindValue(8, $problemdetail); |
|
| 305 | - $query->bindValue(9, $ticketstatus); |
|
| 306 | - $query->bindValue(10, $assignee); |
|
| 307 | - $query->bindValue(11, $assigneddate); |
|
| 308 | - $query->bindValue(12, $pendingby); |
|
| 309 | - $query->bindValue(13, $pendingdate); |
|
| 310 | - $query->bindValue(14, $resolution); |
|
| 311 | - $query->bindValue(15, $resolvedby); |
|
| 312 | - $query->bindValue(16, $resolveddate); |
|
| 313 | - $query->bindValue(17, $closedby); |
|
| 314 | - $query->bindValue(18, $closeddate); |
|
| 315 | - $query->bindValue(19, $changes); |
|
| 316 | - $query->bindValue(20, $changeby); |
|
| 317 | - $query->bindValue(21, $changedate); |
|
| 318 | - $query->bindValue(22, $processby); |
|
| 319 | - $query->bindValue(23, $processdate); |
|
| 320 | - $query->bindValue(24, $comment); |
|
| 321 | - |
|
| 322 | - try { |
|
| 323 | - $query->execute(); |
|
| 324 | - } catch (PDOException $e) { |
|
| 325 | - die($e->getMessage()); |
|
| 326 | - } |
|
| 327 | - } |
|
| 328 | - |
|
| 329 | - public function get_audit_trail($id) |
|
| 330 | - { |
|
| 331 | - $query = $this->db->prepare('SELECT * FROM `log_tickets` WHERE `id`= ? ORDER BY `changedate` DESC'); |
|
| 332 | - $query->bindValue(1, $id); |
|
| 333 | - |
|
| 334 | - try { |
|
| 335 | - $query->execute(); |
|
| 336 | - } catch (PDOException $e) { |
|
| 337 | - die($e->getMessage()); |
|
| 338 | - } |
|
| 339 | - |
|
| 340 | - return $query->fetchAll(); |
|
| 341 | - } |
|
| 292 | + public function 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) |
|
| 293 | + { |
|
| 294 | + $changedate = time(); |
|
| 295 | + $querystring = 'INSERT INTO `log_tickets` (`id`,`sla`,`reporteddate`, `reportedby`, `telp`, `email`, `problemsummary`,`problemdetail`,`ticketstatus`,`assignee`,`assigneddate`,`pendingby`,`pendingdate`,`resolution`,`resolvedby`,`resolveddate`,`closedby`,`closeddate`,`changes`,`changeby`,`changedate`,`processby`,`processdate`,`comment`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'; |
|
| 296 | + $query = $this->db->prepare($querystring); |
|
| 297 | + $query->bindValue(1, $id); |
|
| 298 | + $query->bindValue(2, $sla); |
|
| 299 | + $query->bindValue(3, $reporteddate); |
|
| 300 | + $query->bindValue(4, $reportedby); |
|
| 301 | + $query->bindValue(5, $telp); |
|
| 302 | + $query->bindValue(6, $email); |
|
| 303 | + $query->bindValue(7, $problemsummary); |
|
| 304 | + $query->bindValue(8, $problemdetail); |
|
| 305 | + $query->bindValue(9, $ticketstatus); |
|
| 306 | + $query->bindValue(10, $assignee); |
|
| 307 | + $query->bindValue(11, $assigneddate); |
|
| 308 | + $query->bindValue(12, $pendingby); |
|
| 309 | + $query->bindValue(13, $pendingdate); |
|
| 310 | + $query->bindValue(14, $resolution); |
|
| 311 | + $query->bindValue(15, $resolvedby); |
|
| 312 | + $query->bindValue(16, $resolveddate); |
|
| 313 | + $query->bindValue(17, $closedby); |
|
| 314 | + $query->bindValue(18, $closeddate); |
|
| 315 | + $query->bindValue(19, $changes); |
|
| 316 | + $query->bindValue(20, $changeby); |
|
| 317 | + $query->bindValue(21, $changedate); |
|
| 318 | + $query->bindValue(22, $processby); |
|
| 319 | + $query->bindValue(23, $processdate); |
|
| 320 | + $query->bindValue(24, $comment); |
|
| 321 | + |
|
| 322 | + try { |
|
| 323 | + $query->execute(); |
|
| 324 | + } catch (PDOException $e) { |
|
| 325 | + die($e->getMessage()); |
|
| 326 | + } |
|
| 327 | + } |
|
| 328 | + |
|
| 329 | + public function get_audit_trail($id) |
|
| 330 | + { |
|
| 331 | + $query = $this->db->prepare('SELECT * FROM `log_tickets` WHERE `id`= ? ORDER BY `changedate` DESC'); |
|
| 332 | + $query->bindValue(1, $id); |
|
| 333 | + |
|
| 334 | + try { |
|
| 335 | + $query->execute(); |
|
| 336 | + } catch (PDOException $e) { |
|
| 337 | + die($e->getMessage()); |
|
| 338 | + } |
|
| 339 | + |
|
| 340 | + return $query->fetchAll(); |
|
| 341 | + } |
|
| 342 | 342 | } |