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

Merge pull request #241 from protich/issue/collaborators


Various fixes for collaboration

Reviewed-By: default avatarJared Hancock <jared@osticket.com>
parents a1a9db0b db65223a
No related branches found
No related tags found
No related merge requests found
...@@ -470,11 +470,15 @@ class TicketsAjaxAPI extends AjaxController { ...@@ -470,11 +470,15 @@ class TicketsAjaxAPI extends AjaxController {
} }
$errors = $info = array(); $errors = $info = array();
if ($user && ($c=$ticket->addCollaborator($user, $errors))) { if ($user) {
$info =array('msg' => sprintf('%s added as a collaborator', if ($user->getId() == $ticket->getOwnerId())
$c->getName())); $errors['err'] = sprintf('Ticket owner, %s, is a collaborator by default!',
$user->getName());
return self::_collaborators($ticket, $info); elseif (($c=$ticket->addCollaborator($user, $errors))) {
$info = array('msg' => sprintf('%s added as a collaborator',
$c->getName()));
return self::_collaborators($ticket, $info);
}
} }
if($errors && $errors['err']) { if($errors && $errors['err']) {
...@@ -483,7 +487,6 @@ class TicketsAjaxAPI extends AjaxController { ...@@ -483,7 +487,6 @@ class TicketsAjaxAPI extends AjaxController {
$info +=array('error' =>'Unable to add collaborator - try again'); $info +=array('error' =>'Unable to add collaborator - try again');
} }
return self::_addcollaborator($ticket, $user, $form, $info); return self::_addcollaborator($ticket, $user, $form, $info);
} }
......
...@@ -763,6 +763,15 @@ Class ThreadEntry { ...@@ -763,6 +763,15 @@ Class ThreadEntry {
if(!$vars['ticketId'] || !$vars['type'] || !in_array($vars['type'], array('M','R','N'))) if(!$vars['ticketId'] || !$vars['type'] || !in_array($vars['type'], array('M','R','N')))
return false; return false;
//Strip quoted reply...on emailed messages
if($vars['origin']
&& !strcasecmp($vars['origin'], 'Email')
&& $cfg->stripQuotedReply()
&& ($tag=$cfg->getReplySeparator())
&& strpos($vars['body'], $tag))
if((list($msg) = explode($tag, $vars['body'], 2)) && trim($msg))
$vars['body'] = $msg;
if (isset($vars['attachments'])) { if (isset($vars['attachments'])) {
foreach ($vars['attachments'] as &$a) { foreach ($vars['attachments'] as &$a) {
// Change <img src="cid:"> inside the message to point to // Change <img src="cid:"> inside the message to point to
......
...@@ -594,7 +594,8 @@ class Ticket { ...@@ -594,7 +594,8 @@ class Ticket {
function addCollaborator($user, &$errors) { function addCollaborator($user, &$errors) {
if(!$user) return null; if(!$user || $user->getId()==$this->getOwnerId())
return null;
$vars = array( $vars = array(
'ticketId' => $this->getId(), 'ticketId' => $this->getId(),
...@@ -1443,14 +1444,7 @@ class Ticket { ...@@ -1443,14 +1444,7 @@ class Ticket {
function postMessage($vars, $origin='', $alerts=true) { function postMessage($vars, $origin='', $alerts=true) {
global $cfg; global $cfg;
//Strip quoted reply...on emailed replies $vars['origin'] = $origin;
if(!strcasecmp($origin, 'Email')
&& $cfg->stripQuotedReply()
&& ($tag=$cfg->getReplySeparator())
&& strpos($vars['message'], $tag))
if((list($msg) = explode($tag, $vars['message'], 2)) && trim($msg))
$vars['message'] = $msg;
if(isset($vars['ip'])) if(isset($vars['ip']))
$vars['ip_address'] = $vars['ip']; $vars['ip_address'] = $vars['ip'];
elseif(!$vars['ip_address'] && $_SERVER['REMOTE_ADDR']) elseif(!$vars['ip_address'] && $_SERVER['REMOTE_ADDR'])
......
...@@ -430,7 +430,7 @@ $tcount+= $ticket->getNumNotes(); ...@@ -430,7 +430,7 @@ $tcount+= $ticket->getNumNotes();
'table-row-group':'none'; ?>;"> 'table-row-group':'none'; ?>;">
<tr> <tr>
<td width="120"> <td width="120">
<label><strong>CC:</strong></label> <label><strong>Recipients:</strong></label>
</td> </td>
<td> <td>
<?php <?php
......
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