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

Ticket status change

Redirect to tickets listing page when a ticket is resolved or closed via
status change.
parent 30e7a424
No related branches found
No related tags found
No related merge requests found
...@@ -789,16 +789,23 @@ class TicketsAjaxAPI extends AjaxController { ...@@ -789,16 +789,23 @@ class TicketsAjaxAPI extends AjaxController {
} }
} }
$state = strtolower($status->getState());
if (!$errors && $ticket->setStatus($status, $_REQUEST['comments'])) { if (!$errors && $ticket->setStatus($status, $_REQUEST['comments'])) {
if (!strcasecmp($status->getState(), 'deleted')) { if ($state == 'deleted') {
$msg = sprintf('%s %s', $msg = sprintf('%s %s',
sprintf(__('Ticket #%s'), $ticket->getNumber()), sprintf(__('Ticket #%s'), $ticket->getNumber()),
__('deleted sucessfully') __('deleted sucessfully')
); );
} elseif ($state != 'open') {
$msg = sprintf(__('%s status changed to %s'),
sprintf(__('Ticket #%s'), $ticket->getNumber()),
$status->getName());
} else { } else {
$msg = sprintf( $msg = sprintf(
__('Successfully changed ticket status to %s'), __('%s status changed to %s'),
__('Ticket'),
$status->getName()); $status->getName());
} }
...@@ -809,8 +816,7 @@ class TicketsAjaxAPI extends AjaxController { ...@@ -809,8 +816,7 @@ class TicketsAjaxAPI extends AjaxController {
$errors['err'] = __('Error updating ticket status'); $errors['err'] = __('Error updating ticket status');
} }
$state = $status $state = $state ?: $ticket->getStatus()->getState();
? $status->getState() : $ticket->getStatus()->getState();
$info['status_id'] = $status $info['status_id'] = $status
? $status->getId() : $ticket->getStatusId(); ? $status->getId() : $ticket->getStatusId();
......
...@@ -4,11 +4,13 @@ global $thisstaff, $ticket; ...@@ -4,11 +4,13 @@ global $thisstaff, $ticket;
$actions= array( $actions= array(
'closed' => array( 'closed' => array(
'icon' => 'icon-repeat', 'icon' => 'icon-repeat',
'action' => 'close' 'action' => 'close',
'href' => 'tickets.php'
), ),
'resolved' => array( 'resolved' => array(
'icon' => 'icon-ok-circle', 'icon' => 'icon-ok-circle',
'action' => 'resolve' 'action' => 'resolve',
'href' => 'tickets.php'
), ),
'open' => array( 'open' => array(
'icon' => 'icon-undo', 'icon' => 'icon-undo',
...@@ -49,7 +51,14 @@ $actions= array( ...@@ -49,7 +51,14 @@ $actions= array(
echo sprintf('#%s/status/%s/%d', echo sprintf('#%s/status/%s/%d',
$ticket ? ('tickets/'.$ticket->getId()) : 'tickets', $ticket ? ('tickets/'.$ticket->getId()) : 'tickets',
$actions[$status->getState()]['action'], $actions[$status->getState()]['action'],
$status->getId()); ?>"><i class=" aaa <?php $status->getId()); ?>"
<?php
if (isset($actions[$status->getState()]['href']))
echo sprintf('data-href="%s"',
$actions[$status->getState()]['href']);
?>
><i class="<?php
echo $actions[$status->getState()]['icon'] ?: 'icon-tag'; echo $actions[$status->getState()]['icon'] ?: 'icon-tag';
?>"></i> <?php ?>"></i> <?php
echo __($status->getName()); ?></a> echo __($status->getName()); ?></a>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment