From d26e8443500e83c896e646be94967e1125847b35 Mon Sep 17 00:00:00 2001 From: Peter Rotich <peter@osticket.com> Date: Tue, 19 Aug 2014 18:34:38 +0000 Subject: [PATCH] Revisit ticket status Cleanup status change form Add resolve to ticket ticket view Use the new status table when checking for overdue --- include/class.ticket.php | 6 ++++-- include/staff/templates/ticket-status.tmpl.php | 15 ++++++--------- include/staff/ticket-view.inc.php | 5 ++++- scp/tickets.php | 11 ++++++----- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/include/class.ticket.php b/include/class.ticket.php index faa95986b..f451de786 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -2856,13 +2856,15 @@ class Ticket { function checkOverdue() { $sql='SELECT ticket_id FROM '.TICKET_TABLE.' T1 ' + .' INNER JOIN '.TICKET_STATUS_TABLE.' status + ON (status.id=T1.status_id AND status.state="open") ' .' LEFT JOIN '.SLA_TABLE.' T2 ON (T1.sla_id=T2.id AND T2.isactive=1) ' - .' WHERE status=\'open\' AND isoverdue=0 ' + .' WHERE isoverdue=0 ' .' AND ((reopened is NULL AND duedate is NULL AND TIME_TO_SEC(TIMEDIFF(NOW(),T1.created))>=T2.grace_period*3600) ' .' OR (reopened is NOT NULL AND duedate is NULL AND TIME_TO_SEC(TIMEDIFF(NOW(),reopened))>=T2.grace_period*3600) ' .' OR (duedate is NOT NULL AND duedate<NOW()) ' .' ) ORDER BY T1.created LIMIT 50'; //Age upto 50 tickets at a time? - //echo $sql; + if(($res=db_query($sql)) && db_num_rows($res)) { while(list($id)=db_fetch_row($res)) { if(($ticket=Ticket::lookup($id)) && $ticket->markOverdue()) diff --git a/include/staff/templates/ticket-status.tmpl.php b/include/staff/templates/ticket-status.tmpl.php index 6703ca1b0..96c60d1d8 100644 --- a/include/staff/templates/ticket-status.tmpl.php +++ b/include/staff/templates/ticket-status.tmpl.php @@ -34,7 +34,6 @@ $action = $info['action'] ?: ('#tickets/status/'. $state); <tbody> <tr><td colspan="2"><strong><?php echo $info['extra']; ?></strong></td> </tr> - <tr><td colspan="2"> </td></tr> </tbody> <?php } @@ -47,9 +46,9 @@ $action = $info['action'] ?: ('#tickets/status/'. $state); <tr> <td colspan=2> <span> - <?php echo __('Status') ?>: <?php if (count($statuses) > 1) { ?> + <strong><?php echo __('Status') ?>: </strong> <select name="status_id"> <?php foreach ($statuses as $s) { @@ -65,7 +64,6 @@ $action = $info['action'] ?: ('#tickets/status/'. $state); <font class="error">* <?php echo $errors['status_id']; ?></font> <?php } elseif ($statuses[0]) { - echo __($statuses[0]->getName()); echo "<input type='hidden' name='status_id' value={$statuses[0]->getId()} />"; } ?> </span> @@ -77,14 +75,13 @@ $action = $info['action'] ?: ('#tickets/status/'. $state); <tbody> <tr> <td colspan="2"> - <em>Reasons for status change (internal note): Optional but highly recommended.</em> - </td> - </tr> - <tr> - <td colspan="2"> + <?php + $placeholder = __('Optional reason for status change (internal note)'); + ?> <textarea name="comments" id="comments" cols="50" rows="3" wrap="soft" style="width:100%" - class="richtext ifhtml no-bar"><?php + class="richtext ifhtml no-bar" + placeholder="<?php echo $placeholder; ?>"><?php echo $info['notes']; ?></textarea> </td> </tr> diff --git a/include/staff/ticket-view.inc.php b/include/staff/ticket-view.inc.php index 04e064c6b..651c30866 100644 --- a/include/staff/ticket-view.inc.php +++ b/include/staff/ticket-view.inc.php @@ -60,7 +60,10 @@ if($ticket->isOverdue()) if($ticket->isOpen()) {?> <a class="action-button ticket-action" href="#tickets/<?php echo $ticket->getId() - ?>/status/close"><i class="icon-remove-circle"></i> <?php echo __('Close');?></a> + ?>/status/close"><i class="icon-repeat"></i> <?php echo __('Close');?></a> + <a class="action-button ticket-action" + href="#tickets/<?php echo $ticket->getId() + ?>/status/resolve"><i class="icon-ok-circle"></i> <?php echo __('Resolve');?></a> <?php } else { ?> <a class="action-button ticket-action" diff --git a/scp/tickets.php b/scp/tickets.php index 42dec382b..17235eb62 100644 --- a/scp/tickets.php +++ b/scp/tickets.php @@ -390,11 +390,12 @@ if($thisstaff->showAssignedOnly() && $stats['closed']) { ($_REQUEST['status']=='closed')); } else { - $nav->addSubMenu(array('desc' => __('Resolved').' ('.number_format($stats['resolved']).')', - 'title'=>__('Resolved Tickets'), - 'href'=>'tickets.php?status=resolved', - 'iconclass'=>'closedTickets'), - ($_REQUEST['status']=='resolved')); + if ($stats['resolved']) + $nav->addSubMenu(array('desc' => __('Resolved').' ('.number_format($stats['resolved']).')', + 'title'=>__('Resolved Tickets'), + 'href'=>'tickets.php?status=resolved', + 'iconclass'=>'closedTickets'), + ($_REQUEST['status']=='resolved')); $nav->addSubMenu(array('desc' => __('Closed').' ('.number_format($stats['closed']).')', 'title'=>__('Closed Tickets'), -- GitLab