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

Merge pull request #3020 from protich/issue/closed-by


closed-by: Credit the agent opening a ticket on close

Reviewed-By: default avatarJared Hancock <jared@osticket.com>
parents dcfa5527 8598e999
No related branches found
No related tags found
No related merge requests found
...@@ -3245,7 +3245,9 @@ implements RestrictedAccess, Threadable { ...@@ -3245,7 +3245,9 @@ implements RestrictedAccess, Threadable {
} }
} }
// Any error above is fatal.
// Any errors above are fatal.
if ($errors) if ($errors)
return 0; return 0;
...@@ -3427,38 +3429,39 @@ implements RestrictedAccess, Threadable { ...@@ -3427,38 +3429,39 @@ implements RestrictedAccess, Threadable {
// Configure service-level-agreement for this ticket // Configure service-level-agreement for this ticket
$ticket->selectSLAId($vars['slaId']); $ticket->selectSLAId($vars['slaId']);
// Assign ticket to staff or team (new ticket by staff) // Set status
if ($vars['assignId']) { $status = TicketStatus::lookup($statusId);
$asnform = $ticket->getAssignmentForm(array( if (!$status || !$ticket->setStatus($status, false, $errors,
'assignee' => $vars['assignId'], !strcasecmp($origin, 'staff'))) {
'comments' => $vars['note']) // Tickets _must_ have a status. Forceably set one here
); $ticket->setStatusId($cfg->getDefaultTicketStatusId());
$e = array(); }
$ticket->assign($asnform, $e);
} // Only do assignment if the ticket is in an open state
else { if ($ticket->isOpen()) {
// Auto assign staff or team - auto assignment based on filter // Assign ticket to staff or team (new ticket by staff)
// rules. Both team and staff can be assigned if ($vars['assignId']) {
if ($vars['staffId']) $asnform = $ticket->getAssignmentForm(array(
$ticket->assignToStaff($vars['staffId'], false); 'assignee' => $vars['assignId'],
if ($vars['teamId']) 'comments' => $vars['note'])
// No team alert if also assigned to an individual agent );
$ticket->assignToTeam($vars['teamId'], false, !$vars['staffId']); $e = array();
$ticket->assign($asnform, $e);
}
else {
// Auto assign staff or team - auto assignment based on filter
// rules. Both team and staff can be assigned
if ($vars['staffId'])
$ticket->assignToStaff($vars['staffId'], false);
if ($vars['teamId'])
// No team alert if also assigned to an individual agent
$ticket->assignToTeam($vars['teamId'], false, !$vars['staffId']);
}
} }
// Update the estimated due date in the database // Update the estimated due date in the database
$ticket->updateEstDueDate(); $ticket->updateEstDueDate();
// Apply requested status — this should be done AFTER assignment,
// because if it is requested to be closed, it should not cause the
// ticket to be reopened for assignment.
if ($statusId) {
if (!$ticket->setStatus($statusId, false, $errors, false)) {
// Tickets _must_ have a status. Forceably set one here
$ticket->setStatusId($cfg->getDefaultTicketStatusId());
}
}
/********** double check auto-response ************/ /********** double check auto-response ************/
//Override auto responder if the FROM email is one of the internal emails...loop control. //Override auto responder if the FROM email is one of the internal emails...loop control.
if($autorespond && (Email::getIdByEmail($ticket->getEmail()))) if($autorespond && (Email::getIdByEmail($ticket->getEmail())))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment