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

Ensure OoO message does not clear closing agent

This patch will help ensure that if a ticket is not reopened on a message
(perhaps because of a out-of-office auto-reply from an enduser), then the
closing agent on a closed ticket should not be cleared.
parent be2f138c
No related branches found
No related tags found
No related merge requests found
......@@ -1158,31 +1158,36 @@ class Ticket {
db_query('UPDATE '.TICKET_TABLE.' SET isanswered=0,lastmessage=NOW() WHERE ticket_id='.db_input($this->getId()));
// Auto-assign to closing staff or last respondent
// If the ticket is closed and auto-claim is not enabled then put the
// ticket back to unassigned pool.
if ($this->isClosed() && !$cfg->autoClaimTickets()) {
$this->setStaffId(0);
} elseif(!($staff=$this->getStaff()) || !$staff->isAvailable()) {
// Ticket has no assigned staff - if auto-claim is enabled then
// try assigning it to the last respondent (if available)
// otherwise leave the ticket unassigned.
if ($cfg->autoClaimTickets() //Auto claim is enabled.
&& ($lastrep=$this->getLastRespondent())
&& $lastrep->isAvailable()) {
$this->setStaffId($lastrep->getId()); //direct assignment;
} else {
$this->setStaffId(0); //unassign - last respondent is not available.
}
}
// Reopen if closed AND reopenable
// We're also checking autorespond flag because we don't want to
// reopen closed tickets on auto-reply from end user. This is not to
// confused with autorespond on new message setting
if ($autorespond && $this->isClosed() && $this->isReopenable())
if ($autorespond && $this->isClosed() && $this->isReopenable()) {
$this->reopen();
// Auto-assign to closing staff or last respondent
// If the ticket is closed and auto-claim is not enabled then put the
// ticket back to unassigned pool.
if (!$cfg->autoClaimTickets()) {
$this->setStaffId(0);
}
elseif (!($staff = $this->getStaff()) || !$staff->isAvailable()) {
// Ticket has no assigned staff - if auto-claim is enabled then
// try assigning it to the last respondent (if available)
// otherwise leave the ticket unassigned.
if (($lastrep = $this->getLastRespondent())
&& $lastrep->isAvailable()
) {
$this->setStaffId($lastrep->getId()); //direct assignment;
}
else {
// unassign - last respondent is not available.
$this->setStaffId(0);
}
}
}
/********** double check auto-response ************/
if (!($user = $message->getUser()))
$autorespond=false;
......
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