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!').''; ?>
hasPerm(Email::PERM_BANLIST) || $role->hasPerm(Ticket::PERM_EDIT) || ($dept && $dept->isManager($thisstaff))) { ?> hasPerm(Ticket::PERM_EDIT)) { ?> hasPerm(Ticket::PERM_TRANSFER)) {?> isOpen() && $role->hasPerm(Ticket::PERM_ASSIGN)) {?>
    getStaff() && (!$dept->assignMembersOnly() || $dept->isMember($thisstaff)) ) { ?>
    hasPerm(Ticket::PERM_EDIT)) { ?>
  • hasPerm(Ticket::PERM_MERGE) && !$ticket->isChild()) { ?>
  • hasPerm(Ticket::PERM_LINK) && $ticket->getMergeType() == 'visual') { ?>
  • isAssigned() && $canRelease) { ?>
  • isOpen() && $isManager) { if(!$ticket->isOverdue()) { ?>
  • isOpen() && $canMarkAnswered) { if($ticket->isAnswered()) { ?>
  • hasPerm(Ticket::PERM_REFER)) { ?>
  • hasPerm(Ticket::PERM_EDIT)) { ?>
  • hasPerm(Ticket::PERM_REPLY) && $thread && $ticket->getId() == $thread->getObjectId()) { ?>
  • %s', $ticket->getThreadId(), $recipients); ?>
  • hasPerm(Email::PERM_BANLIST) && $role->hasPerm(Ticket::PERM_REPLY)) { if(!$emailBanned) {?>
  • ')), $ticket->getEmail()); ?>
  • ')), $ticket->getEmail()); ?>
  • hasPerm(Ticket::PERM_DELETE)) { ?>
%s', __('PARENT')); elseif ($ticket->isChild()) echo sprintf('%s', __('CHILD')); if ($role->hasPerm(Ticket::PERM_REPLY)) { ?>

getField('subject'); echo $subject_field ? $subject_field->display($ticket->getSubject()) : Format::htmlchars($ticket->getSubject()); ?>

hasPerm(Ticket::PERM_CLOSE)) {?> hasPerm(Ticket::PERM_EDIT) && ($pf = $ticket->getPriorityField())) { ?> hasPerm(Ticket::PERM_TRANSFER)) {?>
: getStatus(); ?> getStatus()) ? $S->display() : ''; ?>
: getAnswer()->display(); ?> getPriority(); ?>
: getDeptName()); ?> getDeptName()); ?>
: getCreateDate()); ?>
getOrganization()) { ?> org) ?>
: getName()); ?> (getNumTickets(); ?>)
    getNumOpenTickets())) echo sprintf('
  • %s
  • ', $user->getId(), sprintf(_N('%d Open Ticket', '%d Open Tickets', $open), $open)); if(($closed=$user->getNumClosedTickets())) echo sprintf('
  • %s
  • ', $user->getId(), sprintf(_N('%d Closed Ticket', '%d Closed Tickets', $closed), $closed)); ?>
  • hasPerm(User::PERM_DIRECTORY)) { ?>
hasPerm(Ticket::PERM_EDIT) && $thread && $ticket->getId() == $thread->getObjectId()) { if ($thread) { $numCollaborators = $thread->getNumCollaborators(); if ($thread->getNumCollaborators()) $recipients = sprintf(__('%d'), $numCollaborators); } else $recipients = 0; echo sprintf(' (%s)', $ticket->getThreadId(), $ticket->getThreadId(), $recipients); }?>
: getEmail(); ?>
: getOrganization()->getName()); ?> (getNumOrganizationTickets(); ?>)
    getNumOpenOrganizationTickets()) { ?>
  • getNumClosedOrganizationTickets()) { ?>
  • hasPerm(User::PERM_DIRECTORY)) { ?>
: hasPerm(Ticket::PERM_EDIT)) { $source = $ticket->getField('source');?> getSource()); ?> getSource()); } if (!strcasecmp($ticket->getSource(), 'Web') && $ticket->getIP()) echo '   ('.Format::htmlchars($ticket->getIP()).')'; ?>

isOpen()) { ?> hasPerm(Ticket::PERM_ASSIGN)) {?> isOpen()){ ?> hasPerm(Ticket::PERM_EDIT)) { $duedate = $ticket->getField('duedate'); ?>
: isAssigned()) echo Format::htmlchars(implode('/', $ticket->getAssignees())); else echo '— '.__('Unassigned').' —'; ?> isAssigned()) echo Format::htmlchars(implode('/', $ticket->getAssignees())); else echo '— '.__('Unassigned').' —'; ?>
: getStaff())) echo Format::htmlchars($staff->getName()); else echo '— '.__('Unknown').' —'; ?>
: hasPerm(Ticket::PERM_EDIT)) { $slaField = $ticket->getField('sla'); ?>
: getEstDueDate()); ?> getEstDueDate()); ?>
: getCloseDate()); ?>
hasPerm(Ticket::PERM_EDIT)) { $topic = $ticket->getField('topic'); ?>
: getHelpTopic() ?: __('None'); ?> getHelpTopic()); ?>
: getLastMsgDate()); ?>
: getLastRespDate()); ?>

getId()) as $form) { $form->addMissingFields(); //Find fields to exclude if disabled by help topic $disabled = Ticket::getMissingRequiredFields($ticket, true); // Skip core fields shown earlier in the ticket view // TODO: Rewrite getAnswers() so that one could write // ->getAnswers()->filter(not(array('field__name__in'=> // array('email', ...)))); $answers = $form->getAnswers()->exclude(Q::any(array( 'field__flags__hasbit' => DynamicFormField::FLAG_EXT_STORED, 'field__name__in' => array('subject', 'priority'), 'field__id__in' => $disabled, ))); $displayed = array(); foreach($answers as $a) { if (!$a->getField()->isVisibleToStaff()) continue; $displayed[] = $a; } if (count($displayed) == 0) continue; ?> getLocal('id'); $label = $a->getLocal('label'); $field = $a->getField(); $config = $field->getConfiguration(); $html = isset($config['html']) ? $config['html'] : false; $v = $html ? Format::striptags($a->display()) : $a->display(); $class = (Format::striptags($v)) ? '' : 'class="faded"'; $clean = (Format::striptags($v)) ? ($html ? Format::striptags($v) : $v) : '—' . __('Empty') . '—'; $isFile = ($field instanceof FileUploadField); $url = "#tickets/".$ticket->getId()."/field/".$id; ?>
getTitle()); ?>
: hasPerm(Ticket::PERM_EDIT) && $field->isEditableToStaff()) { $isEmpty = strpos($v, 'Empty') || ($v == ''); if ($isFile && !$isEmpty) { echo sprintf('%s
', $id, $class, $clean); } $title = ($html && !$isEmpty) ? __('View Content') : __('Update'); $href = $url.(($html && !$isEmpty) ? '/view' : '/edit'); ?> "; } elseif (strlen($v) > 200) { $clean = Format::truncate($v, 200); echo sprintf('%s', $id, $class, $clean); echo "
"; } else echo sprintf('%s', $id, $class, $clean); $a = $field->getAnswer(); $hint = ($field->isRequiredForClose() && $a && !$a->getValue() && get_class($field) != 'BooleanField') ? sprintf('', __('Required to close ticket'), __('Data is required in this field in order to close the related ticket')) : ''; echo $hint; ?>
getThreadEntries($types) ? $ticket->getThreadEntries($types)->count() : 0; ?>
render( array('M', 'R', 'N'), array( 'html-id' => 'ticketThread', 'mode' => Thread::MODE_STAFF, 'sort' => $thisstaff->thread_view_order ) ); ?>
hasPerm(Ticket::PERM_REPLY) && !($blockReply)) { $replyTo = $_POST['reply-to'] ?: 'all'; $emailReply = ($replyTo != 'none'); ?>
  
getOwner()->getEmail()->getAddress()); ?>
 
getThread()->getNumCollaborators()) $recipients = sprintf(__('(%d of %d)'), $ticket->getThread()->getNumActiveCollaborators(), $ticket->getThread()->getNumCollaborators()); echo sprintf('  %s   %s', __('Collaborators'), $ticket->getNumCollaborators() ? '' : 'hidden', $ticket->getThreadId(), sprintf('%s', $ticket->getThreadId(), $recipients) ); ?>
__('All Active Recipients'), 'user' => sprintf('%s (%s)', __('Ticket Owner'), Format::htmlchars($ticket->getOwner()->getEmail())), 'none' => sprintf('— %s —', __('Do Not Email Reply')) ); $replyTo = $_POST['reply-to'] ?: 'all'; $emailReply = ($replyTo != 'none'); ?>
 
%s', $errors['response']); if ($cfg->isCannedResponseEnabled()) { ?>
getDefaultSignatureType()) { case 'dept': if ($dept && $dept->canAppendSignature()) $signature = $dept->getSignature(); break; case 'mine': $signature = $thisstaff->getSignature(); break; } ?>
getField('attachments')->render(); ?>
getDefaultSignatureType(); ?> getSignature()) {?> canAppendSignature()) { ?>
hasPerm(Ticket::PERM_CLOSE) && is_string($warning=$ticket->isCloseable())) { $outstanding = true; echo sprintf('
%s
', $warning); } ?>