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 {
}
}
$state = strtolower($status->getState());
if (!$errors && $ticket->setStatus($status, $_REQUEST['comments'])) {
if (!strcasecmp($status->getState(), 'deleted')) {
if ($state == 'deleted') {
$msg = sprintf('%s %s',
sprintf(__('Ticket #%s'), $ticket->getNumber()),
__('deleted sucessfully')
);
} elseif ($state != 'open') {
$msg = sprintf(__('%s status changed to %s'),
sprintf(__('Ticket #%s'), $ticket->getNumber()),
$status->getName());
} else {
$msg = sprintf(
__('Successfully changed ticket status to %s'),
__('%s status changed to %s'),
__('Ticket'),
$status->getName());
}
......@@ -809,8 +816,7 @@ class TicketsAjaxAPI extends AjaxController {
$errors['err'] = __('Error updating ticket status');
}
$state = $status
? $status->getState() : $ticket->getStatus()->getState();
$state = $state ?: $ticket->getStatus()->getState();
$info['status_id'] = $status
? $status->getId() : $ticket->getStatusId();
......
......@@ -4,11 +4,13 @@ global $thisstaff, $ticket;
$actions= array(
'closed' => array(
'icon' => 'icon-repeat',
'action' => 'close'
'action' => 'close',
'href' => 'tickets.php'
),
'resolved' => array(
'icon' => 'icon-ok-circle',
'action' => 'resolve'
'action' => 'resolve',
'href' => 'tickets.php'
),
'open' => array(
'icon' => 'icon-undo',
......@@ -49,7 +51,14 @@ $actions= array(
echo sprintf('#%s/status/%s/%d',
$ticket ? ('tickets/'.$ticket->getId()) : 'tickets',
$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';
?>"></i> <?php
echo __($status->getName()); ?></a>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment