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

Go back to tickets page on reply

Always clear staff's drafts on successful reply
Remove errant reload
parent 6de37933
No related branches found
No related tags found
No related merge requests found
......@@ -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.
Finish editing this message first!
Please register or to comment