diff --git a/include/class.dept.php b/include/class.dept.php index 502c34742ccf9610968faaf833c619e3d6b6ac1c..0f74f4cf8e0f02f1fcff3491ba4455ab7a0e0b7c 100644 --- a/include/class.dept.php +++ b/include/class.dept.php @@ -62,6 +62,7 @@ implements TemplateVariable { const ALERTS_DEPT_ONLY = 0; const FLAG_ASSIGN_MEMBERS_ONLY = 0x0001; + const FLAG_DISABLE_AUTO_CLAIM = 0x0002; function asVar() { return $this->getName(); @@ -319,6 +320,10 @@ implements TemplateVariable { return $this->flags & self::FLAG_ASSIGN_MEMBERS_ONLY; } + function disableAutoClaim() { + return $this->flags & self::FLAG_DISABLE_AUTO_CLAIM; + } + function isGroupMembershipEnabled() { return $this->group_membership; } @@ -329,7 +334,8 @@ implements TemplateVariable { foreach (static::$meta['joins'] as $k => $v) unset($ht[$k]); - $ht['assign_members_only'] = $this->flags & self::FLAG_ASSIGN_MEMBERS_ONLY; + $ht['assign_members_only'] = $this->assignMembersOnly(); + $ht['disable_auto_claim'] = $this->disableAutoClaim(); return $ht; } @@ -422,6 +428,21 @@ implements TemplateVariable { return $path; } + /** + * setFlag + * + * Utility method to set/unset flag bits + * + */ + + private function setFlag($flag, $val) { + + if ($val) + $this->flags |= $flag; + else + $this->flags &= ~$flag; + } + /*----Static functions-------*/ static function getIdByName($name, $pid=null) { $row = static::objects() @@ -591,7 +612,10 @@ implements TemplateVariable { $this->group_membership = $vars['group_membership']; $this->ticket_auto_response = isset($vars['ticket_auto_response'])?$vars['ticket_auto_response']:1; $this->message_auto_response = isset($vars['message_auto_response'])?$vars['message_auto_response']:1; - $this->flags = isset($vars['assign_members_only']) ? self::FLAG_ASSIGN_MEMBERS_ONLY : 0; + $this->flags = 0; + $this->setFlag(self::FLAG_ASSIGN_MEMBERS_ONLY, isset($vars['assign_members_only'])); + $this->setFlag(self::FLAG_DISABLE_AUTO_CLAIM, isset($vars['disable_auto_claim'])); + $this->path = $this->getFullPath(); $wasnew = $this->__new__; diff --git a/include/class.ticket.php b/include/class.ticket.php index f849340c57ebf4d9a849d2da055e0a5124be5af8..22e97d0fd248b6cf3ad67c9f74f7af1948a47fa2 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -1460,11 +1460,12 @@ implements RestrictedAccess, Threadable { // confused with autorespond on new message setting if ($autorespond && $this->isClosed() && $this->isReopenable()) { $this->reopen(); - + $dept = $this->getDept(); + $autoclaim = ($cfg->autoClaimTickets() && !$dept->disableAutoClaim()); // 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()) { + if (!$autoclaim) { $this->setStaffId(0); } elseif (!($staff = $this->getStaff()) || !$staff->isAvailable()) { @@ -2399,6 +2400,7 @@ implements RestrictedAccess, Threadable { if (!($response = $this->getThread()->addResponse($vars, $errors))) return null; + $dept = $this->getDept(); $assignee = $this->getStaff(); // Set status - if checked. if ($vars['reply_status_id'] @@ -2407,10 +2409,12 @@ implements RestrictedAccess, Threadable { $this->setStatus($vars['reply_status_id']); } + // Claim on response bypasses the department assignment restrictions - if ($claim && $thisstaff && $this->isOpen() && !$this->getStaffId() - && $cfg->autoClaimTickets() - ) { + $claim = ($claim + && $cfg->autoClaimTickets() + && !$dept->disableAutoClaim()); + if ($claim && $thisstaff && $this->isOpen() && !$this->getStaffId()) { $this->setStaffId($thisstaff->getId()); //direct assignment; } @@ -2422,11 +2426,12 @@ implements RestrictedAccess, Threadable { if (!$alert) return $response; - $dept = $this->getDept(); + $options = array(); + $email = $dept->getEmail(); if ($thisstaff && $vars['signature']=='mine') $signature=$thisstaff->getSignature(); - elseif ($vars['signature']=='dept' && $dept && $dept->isPublic()) + elseif ($vars['signature']=='dept' && $dept->isPublic()) $signature=$dept->getSignature(); else $signature=''; diff --git a/include/i18n/en_US/help/tips/staff.department.yaml b/include/i18n/en_US/help/tips/staff.department.yaml index 28637faa31a1c7738208b306bf2a9f2c95ae1a38..015c9b1224c3a6a8647e633e3dcb14dd3e2b6f82 100644 --- a/include/i18n/en_US/help/tips/staff.department.yaml +++ b/include/i18n/en_US/help/tips/staff.department.yaml @@ -77,6 +77,14 @@ sandboxing: if <span class="doc-desc-title">Alerts & Notices Recipients</span> includes groups members. +disable_auto_claim: + title: Disable Auto Claim + content: > + Check this to <strong>disable</strong> auto-claim on response/reply for + this department. + <br><br> + Agents can still manually claim unassigned tickets + auto_response_settings: title: Autoresponder Settings content: > diff --git a/include/staff/department.inc.php b/include/staff/department.inc.php index 4fa72ef7c412f1732eca323faf1c53af97664c60..7374f4b7f74f7407901b0644e86f9ebcf6e01146 100644 --- a/include/staff/department.inc.php +++ b/include/staff/department.inc.php @@ -150,6 +150,22 @@ $info = Format::htmlchars(($errors && $_POST) ? $_POST : $info); <i class="help-tip icon-question-sign" href="#sandboxing"></i> </td> </tr> + + <tr> + <td><?php echo __('Claim on Response'); ?>:</td> + <td> + <label> + <input type="checkbox" name="disable_auto_claim" <?php echo + $info['disable_auto_claim'] ? 'checked="checked"' : ''; ?>> + <?php echo sprintf('<strong>%s</strong> %s', + __('Disable'), + __('auto claim')); ?> + </label> + <i class="help-tip icon-question-sign" + href="#disable_auto_claim"></i> + </td> + </tr> + <tr> <th colspan="2"> <em><strong><?php echo __('Outgoing Email Settings'); ?></strong>:</em>