Skip to content
Snippets Groups Projects
Commit d26e8443 authored by Peter Rotich's avatar Peter Rotich
Browse files

Revisit ticket status

Cleanup status change form
Add resolve to ticket ticket view
Use the new status table when checking for overdue
parent 9de12f62
Branches
Tags
No related merge requests found
...@@ -2856,13 +2856,15 @@ class Ticket { ...@@ -2856,13 +2856,15 @@ class Ticket {
function checkOverdue() { function checkOverdue() {
$sql='SELECT ticket_id FROM '.TICKET_TABLE.' T1 ' $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) ' .' 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) ' .' 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 (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()) ' .' OR (duedate is NOT NULL AND duedate<NOW()) '
.' ) ORDER BY T1.created LIMIT 50'; //Age upto 50 tickets at a time? .' ) ORDER BY T1.created LIMIT 50'; //Age upto 50 tickets at a time?
//echo $sql;
if(($res=db_query($sql)) && db_num_rows($res)) { if(($res=db_query($sql)) && db_num_rows($res)) {
while(list($id)=db_fetch_row($res)) { while(list($id)=db_fetch_row($res)) {
if(($ticket=Ticket::lookup($id)) && $ticket->markOverdue()) if(($ticket=Ticket::lookup($id)) && $ticket->markOverdue())
......
...@@ -34,7 +34,6 @@ $action = $info['action'] ?: ('#tickets/status/'. $state); ...@@ -34,7 +34,6 @@ $action = $info['action'] ?: ('#tickets/status/'. $state);
<tbody> <tbody>
<tr><td colspan="2"><strong><?php echo $info['extra']; <tr><td colspan="2"><strong><?php echo $info['extra'];
?></strong></td> </tr> ?></strong></td> </tr>
<tr><td colspan="2">&nbsp;</td></tr>
</tbody> </tbody>
<?php <?php
} }
...@@ -47,9 +46,9 @@ $action = $info['action'] ?: ('#tickets/status/'. $state); ...@@ -47,9 +46,9 @@ $action = $info['action'] ?: ('#tickets/status/'. $state);
<tr> <tr>
<td colspan=2> <td colspan=2>
<span> <span>
<?php echo __('Status') ?>:&nbsp;
<?php <?php
if (count($statuses) > 1) { ?> if (count($statuses) > 1) { ?>
<strong><?php echo __('Status') ?>:&nbsp;</strong>
<select name="status_id"> <select name="status_id">
<?php <?php
foreach ($statuses as $s) { foreach ($statuses as $s) {
...@@ -65,7 +64,6 @@ $action = $info['action'] ?: ('#tickets/status/'. $state); ...@@ -65,7 +64,6 @@ $action = $info['action'] ?: ('#tickets/status/'. $state);
<font class="error">*&nbsp;<?php echo $errors['status_id']; ?></font> <font class="error">*&nbsp;<?php echo $errors['status_id']; ?></font>
<?php <?php
} elseif ($statuses[0]) { } elseif ($statuses[0]) {
echo __($statuses[0]->getName());
echo "<input type='hidden' name='status_id' value={$statuses[0]->getId()} />"; echo "<input type='hidden' name='status_id' value={$statuses[0]->getId()} />";
} ?> } ?>
</span> </span>
...@@ -77,14 +75,13 @@ $action = $info['action'] ?: ('#tickets/status/'. $state); ...@@ -77,14 +75,13 @@ $action = $info['action'] ?: ('#tickets/status/'. $state);
<tbody> <tbody>
<tr> <tr>
<td colspan="2"> <td colspan="2">
<em>Reasons for status change (internal note): Optional but highly recommended.</em> <?php
</td> $placeholder = __('Optional reason for status change (internal note)');
</tr> ?>
<tr>
<td colspan="2">
<textarea name="comments" id="comments" <textarea name="comments" id="comments"
cols="50" rows="3" wrap="soft" style="width:100%" 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> echo $info['notes']; ?></textarea>
</td> </td>
</tr> </tr>
......
...@@ -60,7 +60,10 @@ if($ticket->isOverdue()) ...@@ -60,7 +60,10 @@ if($ticket->isOverdue())
if($ticket->isOpen()) {?> if($ticket->isOpen()) {?>
<a class="action-button ticket-action" <a class="action-button ticket-action"
href="#tickets/<?php echo $ticket->getId() 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 <?php
} else { ?> } else { ?>
<a class="action-button ticket-action" <a class="action-button ticket-action"
......
...@@ -390,11 +390,12 @@ if($thisstaff->showAssignedOnly() && $stats['closed']) { ...@@ -390,11 +390,12 @@ if($thisstaff->showAssignedOnly() && $stats['closed']) {
($_REQUEST['status']=='closed')); ($_REQUEST['status']=='closed'));
} else { } else {
$nav->addSubMenu(array('desc' => __('Resolved').' ('.number_format($stats['resolved']).')', if ($stats['resolved'])
'title'=>__('Resolved Tickets'), $nav->addSubMenu(array('desc' => __('Resolved').' ('.number_format($stats['resolved']).')',
'href'=>'tickets.php?status=resolved', 'title'=>__('Resolved Tickets'),
'iconclass'=>'closedTickets'), 'href'=>'tickets.php?status=resolved',
($_REQUEST['status']=='resolved')); 'iconclass'=>'closedTickets'),
($_REQUEST['status']=='resolved'));
$nav->addSubMenu(array('desc' => __('Closed').' ('.number_format($stats['closed']).')', $nav->addSubMenu(array('desc' => __('Closed').' ('.number_format($stats['closed']).')',
'title'=>__('Closed Tickets'), 'title'=>__('Closed Tickets'),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment