Skip to content
Snippets Groups Projects
Commit d0d7c463 authored by Jared Hancock's avatar Jared Hancock
Browse files

Merge pull request #1185 from protich/issue/ticket-status-change


Ticket status change

Reviewed-By: default avatarJared Hancock <jared@osticket.com>
parents d8d92245 168c3aa9
Branches
Tags
No related merge requests found
......@@ -864,12 +864,15 @@ class Ticket {
case 'open':
// TODO: check current status if it allows for reopening
if ($this->isClosed()) {
$sql.= ',closed=NULL, reopened=NOW() ';
$sql .= ',closed=NULL, reopened=NOW() ';
$ecb = function ($t) {
$t->logEvent('reopened', 'closed');
};
}
// If the ticket is not open then clear answered flag
if (!$this->isOpen())
$sql .= ', isanswered = 0 ';
break;
default:
return false;
......
<?php
$actions= array(
'close' => array(
'action' => __('Close'),
'icon' => 'icon-repeat',
'states' => array('closed')
'state' => 'closed'
),
'resolve' => array(
'action' => __('Resolve'),
'icon' => 'icon-ok-circle',
'states' => array('resolved')
'state' => 'resolved'
),
'reopen' => array(
'action' => __('Reopen'),
'icon' => 'icon-undo',
'states' => array('open')
'state' => 'open'
),
);
foreach($actions as $k => $v) {
$criteria = array('states' => $v['states']);
$criteria = array('states' => array($v['state']));
if (!($statuses = TicketStatusList::getStatuses($criteria)->all()))
continue;
......@@ -30,7 +27,8 @@ foreach($actions as $k => $v) {
<a id="tickets-<?php echo $k; ?>"
class="tickets-action"
href="#tickets/status/<?php echo $k; ?>"><i
class="<?php echo $v['icon']; ?>"></i> <?php echo $v['action']; ?></a>
class="<?php echo $v['icon']; ?>"></i> <?php
echo TicketStateField::getVerb($v['state']); ?></a>
<i class="icon-caret-down"></i>
</span>
<div id="action-dropdown-<?php echo $k; ?>"
......@@ -54,7 +52,8 @@ foreach($actions as $k => $v) {
?>
<a id="tickets-<?php echo $k; ?>" class="action-button tickets-action"
href="#tickets/status/<?php echo $k; ?>"><i
class="<?php echo $v['icon']; ?>"></i> <?php echo $v['action']; ?></a>
class="<?php echo $v['icon']; ?>"></i> <?php
echo TicketStateField::getVerb($v['state']); ?></a>
<?php
}
}
......
......@@ -63,24 +63,29 @@ if($_POST && !$errors):
$errors['err']=__('Email is in banlist. Must be removed to reply.');
}
$wasOpen =($ticket->isOpen());
//If no error...do the do.
$vars = $_POST;
if(!$errors && $_FILES['attachments'])
$vars['files'] = AttachmentFile::format($_FILES['attachments']);
if(!$errors && ($response=$ticket->postReply($vars, $errors, $_POST['emailreply']))) {
$msg=__('Reply posted successfully');
$ticket->reload();
if($ticket->isClosed() && $wasOpen)
$ticket=null;
else
// Still open -- cleanup response draft for this user
Draft::deleteForNamespace(
'ticket.response.' . $ticket->getId(),
$thisstaff->getId());
$msg = sprintf(__('%s: Reply posted successfully'),
sprintf(__('Ticket #%s'),
sprintf('<a href="tickets.php?id=%d"><b>%s</b></a>',
$ticket->getId(), $ticket->getNumber()))
);
// Remove staff's locks
TicketLock::removeStaffLocks($thisstaff->getId(),
$ticket->getId());
// Cleanup response draft for this user
Draft::deleteForNamespace(
'ticket.response.' . $ticket->getId(),
$thisstaff->getId());
// Go back to the ticket listing page on reply
$ticket = null;
} elseif(!$errors['err']) {
$errors['err']=__('Unable to post the reply. Correct the errors below and try again!');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment