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

preview: Fix crash if the ticket has no thread

parent 476080e3
No related branches found
No related tags found
No related merge requests found
...@@ -8,6 +8,7 @@ $staff=$ticket->getStaff(); ...@@ -8,6 +8,7 @@ $staff=$ticket->getStaff();
$lock=$ticket->getLock(); $lock=$ticket->getLock();
$role=$thisstaff->getRole($ticket->getDeptId()); $role=$thisstaff->getRole($ticket->getDeptId());
$error=$msg=$warn=null; $error=$msg=$warn=null;
$thread = $ticket->getThread();
if($lock && $lock->getStaffId()==$thisstaff->getId()) if($lock && $lock->getStaffId()==$thisstaff->getId())
$warn.='&nbsp;<span class="Icon lockedTicket">' $warn.='&nbsp;<span class="Icon lockedTicket">'
...@@ -34,12 +35,12 @@ echo '<ul class="tabs" id="ticket-preview">'; ...@@ -34,12 +35,12 @@ echo '<ul class="tabs" id="ticket-preview">';
echo ' echo '
<li class="active"><a id="preview_tab" href="#preview" <li class="active"><a id="preview_tab" href="#preview"
><i class="icon-list-alt"></i>&nbsp;'.__('Ticket Summary').'</a></li>'; ><i class="icon-list-alt"></i>&nbsp;'.__('Ticket Summary').'</a></li>';
if ($ticket->getThread()->getNumCollaborators()) { if ($thread && $thread->getNumCollaborators()) {
echo sprintf(' echo sprintf('
<li><a id="collab_tab" href="#collab" <li><a id="collab_tab" href="#collab"
><i class="icon-fixed-width icon-group ><i class="icon-fixed-width icon-group
faded"></i>&nbsp;'.__('Collaborators (%d)').'</a></li>', faded"></i>&nbsp;'.__('Collaborators (%d)').'</a></li>',
$ticket->getThread()->getNumCollaborators()); $thread->getNumCollaborators());
} }
echo '</ul>'; echo '</ul>';
echo '<div id="ticket-preview_container">'; echo '<div id="ticket-preview_container">';
...@@ -121,7 +122,7 @@ echo '</div>'; // ticket preview content. ...@@ -121,7 +122,7 @@ echo '</div>'; // ticket preview content.
<table border="0" cellspacing="" cellpadding="1"> <table border="0" cellspacing="" cellpadding="1">
<colgroup><col style="min-width: 250px;"></col></colgroup> <colgroup><col style="min-width: 250px;"></col></colgroup>
<?php <?php
if (($collabs=$ticket->getThread()->getCollaborators())) {?> if ($thread && ($collabs=$thread->getCollaborators())) {?>
<?php <?php
foreach($collabs as $collab) { foreach($collabs as $collab) {
echo sprintf('<tr><td %s><i class="icon-%s"></i> echo sprintf('<tr><td %s><i class="icon-%s"></i>
...@@ -141,7 +142,7 @@ echo '</div>'; // ticket preview content. ...@@ -141,7 +142,7 @@ echo '</div>'; // ticket preview content.
echo sprintf('<span><a class="collaborators" echo sprintf('<span><a class="collaborators"
href="#tickets/%d/collaborators">%s</a></span>', href="#tickets/%d/collaborators">%s</a></span>',
$ticket->getId(), $ticket->getId(),
$ticket->getThread()->getNumCollaborators() $thread && $thread->getNumCollaborators()
? __('Manage Collaborators') : __('Add Collaborator') ? __('Manage Collaborators') : __('Add Collaborator')
); );
?> ?>
......
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