Skip to content
Snippets Groups Projects
Unverified Commit a0221ef1 authored by Peter Rotich's avatar Peter Rotich Committed by GitHub
Browse files

Merge pull request #5157 from aydreeihn/issue/auto-assignment

Modify Reopen Assignment
parents ed8b9cd7 d50ebbb1
No related branches found
No related tags found
No related merge requests found
......@@ -1363,7 +1363,24 @@ implements RestrictedAccess, Threadable, Searchable {
};
break;
case 'open':
// TODO: check current status if it allows for reopening
if ($this->isClosed() && $this->isReopenable()) {
// Auto-assign to closing staff or the last respondent if the
// agent is available and has access. Otherwise, put the ticket back
// to unassigned pool.
$dept = $this->getDept();
$staff = $this->getStaff() ?: $this->getLastRespondent();
$autoassign = (!$dept->disableReopenAutoAssign());
if ($autoassign
&& $staff
// Is agent on vacation ?
&& $staff->isAvailable()
// Does the agent have access to dept?
&& $staff->canAccessDept($dept))
$this->setStaffId($staff->getId());
else
$this->setStaffId(0); // Clear assignment
}
if ($this->isClosed()) {
$this->closed = $this->lastupdate = $this->reopened = SqlFunction::NOW();
$ecb = function ($t) {
......@@ -1701,24 +1718,8 @@ implements RestrictedAccess, Threadable, Searchable {
// 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 ($reopen && $this->isClosed() && $this->isReopenable()) {
if ($reopen && $this->isClosed() && $this->isReopenable())
$this->reopen();
// Auto-assign to closing staff or the last respondent if the
// agent is available and has access. Otherwise, put the ticket back
// to unassigned pool.
$dept = $this->getDept();
$staff = $this->getStaff() ?: $this->getLastRespondent();
$autoassign = (!$dept->disableReopenAutoAssign());
if ($autoassign
&& $staff
// Is agent on vacation ?
&& $staff->isAvailable()
// Does the agent have access to dept?
&& $staff->canAccessDept($dept))
$this->setStaffId($staff->getId());
else
$this->setStaffId(0); // Clear assignment
}
if (!$autorespond)
return;
......
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