getId()) die('Invalid path');
//Make sure the staff is allowed to access the page.
if(!@$thisstaff->isStaff() || !$ticket->checkStaffPerm($thisstaff)) die('Access Denied');
//Re-use the post info on error...savekeyboards.org (Why keyboard? -> some people care about objects than users!!)
$info=($_POST && $errors)?Format::input($_POST):array();
$type = array('type' => 'viewed');
Signal::send('object.view', $ticket, $type);
//Get the goodies.
$dept = $ticket->getDept(); //Dept
$role = $ticket->getRole($thisstaff);
$staff = $ticket->getStaff(); //Assigned or closed by..
$user = $ticket->getOwner(); //Ticket User (EndUser)
$team = $ticket->getTeam(); //Assigned team.
$sla = $ticket->getSLA();
$lock = $ticket->getLock(); //Ticket lock obj
$children = $ticket->getChildren();
$thread = $ticket->getThread();
if (!$lock && $cfg->getTicketLockMode() == Lock::MODE_ON_VIEW)
$lock = $ticket->acquireLock($thisstaff->getId());
$mylock = ($lock && $lock->getStaffId() == $thisstaff->getId()) ? $lock : null;
$id = $ticket->getId(); //Ticket ID.
$isManager = $dept->isManager($thisstaff); //Check if Agent is Manager
$canRelease = ($isManager || $role->hasPerm(Ticket::PERM_RELEASE)); //Check if Agent can release tickets
$blockReply = $ticket->isChild() && $ticket->getMergeType() != 'visual';
$canMarkAnswered = ($isManager || $role->hasPerm(Ticket::PERM_MARKANSWERED)); //Check if Agent can mark as answered/unanswered
//Useful warnings and errors the user might want to know!
if ($ticket->isClosed() && !$ticket->isReopenable())
$warn = sprintf(
__('Current ticket status (%s) does not allow the end user to reply.'),
$ticket->getStatus());
elseif ($blockReply)
$warn = __('Child Tickets do not allow the end user or agent to reply.');
elseif ($ticket->isAssigned()
&& (($staff && $staff->getId()!=$thisstaff->getId())
|| ($team && !$team->hasMember($thisstaff))
))
$warn.= sprintf(' %s',
sprintf(__('Ticket is assigned to %s'),
implode('/', $ticket->getAssignees())
));
if (!$errors['err']) {
if ($lock && $lock->getStaffId()!=$thisstaff->getId())
$errors['err'] = sprintf(__('%s is currently locked by %s'),
__('This ticket'),
$lock->getStaffName());
elseif (($emailBanned=Banlist::isBanned($ticket->getEmail())))
$errors['err'] = __('Email is in banlist! Must be removed before any reply/response');
elseif (!Validator::is_valid_email($ticket->getEmail()))
$errors['err'] = __('EndUser email address is not valid! Consider updating it before responding');
}
$unbannable=($emailBanned) ? BanList::includes($ticket->getEmail()) : false;
if($ticket->isOverdue())
$warn.=' '.__('Marked overdue!').'';
?>
remove %s from ban list?'), $ticket->getEmail()); ?>
unassign ticket from %s?'), $ticket->getAssigned()); ?>
will no longer have access to the ticket')),
''.Format::htmlchars($ticket->getName()).'', Format::htmlchars($ticket->getEmail())); ?>
change ticket owner to %s?'),
'this guy'); ?>