Skip to content
Snippets Groups Projects
Commit 87f1d60d authored by Peter Rotich's avatar Peter Rotich
Browse files

Unassign reopened tickets if claim on response is NOT enabled.

parent 7145785a
Branches
Tags
No related merge requests found
...@@ -1031,16 +1031,26 @@ class Ticket { ...@@ -1031,16 +1031,26 @@ class Ticket {
db_query('UPDATE '.TICKET_TABLE.' SET isanswered=0,lastmessage=NOW() WHERE ticket_id='.db_input($this->getId())); 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 // Auto-assign to closing staff or last respondent
if(!($staff=$this->getStaff()) || !$staff->isAvailable()) { // If the ticket is closed and auto-claim is not enabled then put the
if(($lastrep=$this->getLastRespondent()) && $lastrep->isAvailable()) { // 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; $this->setStaffId($lastrep->getId()); //direct assignment;
} else { } else {
$this->setStaffId(0); //unassign - last respondent is not available. $this->setStaffId(0); //unassign - last respondent is not available.
} }
} }
if($this->isClosed()) $this->reopen(); //reopen.. // Reopen if closed.
if($this->isClosed()) $this->reopen();
/********** double check auto-response ************/ /********** double check auto-response ************/
if (!($user = $message->getUser())) if (!($user = $message->getUser()))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment