From 5ec03c3eea6a451c5655553966f3c07848e73ddf Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@osticket.com>
Date: Sun, 24 May 2015 18:20:33 +0000
Subject: [PATCH] Move agent collision setting to system level

---
 include/class.config.php                      |  4 +-
 .../i18n/en_US/help/tips/settings.system.yaml |  8 +++
 .../i18n/en_US/help/tips/settings.ticket.yaml |  8 ---
 include/staff/settings-system.inc.php         | 54 +++++++++++--------
 include/staff/settings-tickets.inc.php        |  7 ---
 5 files changed, 41 insertions(+), 40 deletions(-)

diff --git a/include/class.config.php b/include/class.config.php
index 73b6fc23c..afaefc133 100644
--- a/include/class.config.php
+++ b/include/class.config.php
@@ -1020,6 +1020,7 @@ class OsticketConfig extends Config {
         $f['helpdesk_url']=array('type'=>'string',   'required'=>1, 'error'=>__('Helpdesk URL is required'));
         $f['helpdesk_title']=array('type'=>'string',   'required'=>1, 'error'=>__('Helpdesk title is required'));
         $f['default_dept_id']=array('type'=>'int',   'required'=>1, 'error'=>__('Default Department is required'));
+        $f['autolock_minutes']=array('type'=>'int',   'required'=>1, 'error'=>__('Enter lock time in minutes'));
         //Date & Time Options
         $f['time_format']=array('type'=>'string',   'required'=>1, 'error'=>__('Time format is required'));
         $f['date_format']=array('type'=>'string',   'required'=>1, 'error'=>__('Date format is required'));
@@ -1073,6 +1074,7 @@ class OsticketConfig extends Config {
             'system_language'=>$vars['system_language'],
             'secondary_langs'=>$secondary_langs,
             'max_file_size' => $vars['max_file_size'],
+            'autolock_minutes' => $vars['autolock_minutes'],
             'enable_html_thread' => isset($vars['enable_html_thread']) ? 1 : 0,
         ));
     }
@@ -1111,7 +1113,6 @@ class OsticketConfig extends Config {
         $f['default_ticket_status_id'] = array('type'=>'int', 'required'=>1, 'error'=>__('Selection required'));
         $f['default_priority_id']=array('type'=>'int',   'required'=>1, 'error'=>__('Selection required'));
         $f['max_open_tickets']=array('type'=>'int',   'required'=>1, 'error'=>__('Enter valid numeric value'));
-        $f['autolock_minutes']=array('type'=>'int',   'required'=>1, 'error'=>__('Enter lock time in minutes'));
 
 
         if($vars['enable_captcha']) {
@@ -1144,7 +1145,6 @@ class OsticketConfig extends Config {
             'default_ticket_status_id'=>$vars['default_ticket_status_id'],
             'default_sla_id'=>$vars['default_sla_id'],
             'max_open_tickets'=>$vars['max_open_tickets'],
-            'autolock_minutes'=>$vars['autolock_minutes'],
             'enable_captcha'=>isset($vars['enable_captcha'])?1:0,
             'auto_claim_tickets'=>isset($vars['auto_claim_tickets'])?1:0,
             'show_assigned_tickets'=>isset($vars['show_assigned_tickets'])?0:1,
diff --git a/include/i18n/en_US/help/tips/settings.system.yaml b/include/i18n/en_US/help/tips/settings.system.yaml
index 96d1a5e46..8b2db150a 100644
--- a/include/i18n/en_US/help/tips/settings.system.yaml
+++ b/include/i18n/en_US/help/tips/settings.system.yaml
@@ -83,6 +83,14 @@ enable_richtext:
         If enabled, this will permit the use of rich text formatting between
         Clients and Agents.
 
+collision_avoidance:
+    title: Agent Collision Avoidance
+    content: >
+        Enter the maximum length of time an Agent is allowed to hold a lock
+        on a ticket or task without any activity.
+        <br><br>
+        Enter <span class="doc-desc-opt">0</span> to disable the lockout feature.
+
 # Date and time options
 date_time_options:
     title: Date &amp; Time Options
diff --git a/include/i18n/en_US/help/tips/settings.ticket.yaml b/include/i18n/en_US/help/tips/settings.ticket.yaml
index d6fac581e..b54e13e3c 100644
--- a/include/i18n/en_US/help/tips/settings.ticket.yaml
+++ b/include/i18n/en_US/help/tips/settings.ticket.yaml
@@ -68,14 +68,6 @@ maximum_open_tickets:
         <br><br>
         Enter <span class="doc-desc-opt">0 </span> if you prefer to disable this limitation.
 
-agent_collision_avoidance:
-    title: Agent Collision Avoidance
-    content: >
-        Enter the maximum length of time an Agent is allowed to hold a lock
-        on a ticket without any activity.
-        <br><br>
-        Enter <span class="doc-desc-opt">0</span> to disable the lockout feature.
-
 email_ticket_priority:
     title: Email Ticket Priority
     content: >
diff --git a/include/staff/settings-system.inc.php b/include/staff/settings-system.inc.php
index 65a087d55..e5b2e2d6a 100644
--- a/include/staff/settings-system.inc.php
+++ b/include/staff/settings-system.inc.php
@@ -61,6 +61,37 @@ $gmtime = Misc::gmtime();
                 <i class="help-tip icon-question-sign" href="#default_department"></i>
             </td>
         </tr>
+        <tr>
+            <td width="180"><?php echo __('Default Name Formatting'); ?>:</td>
+            <td>
+                <select name="name_format">
+                <?php foreach (PersonsName::allFormats() as $n=>$f) {
+                    list($desc, $func) = $f;
+                    $selected = ($config['name_format'] == $n) ? 'selected="selected"' : ''; ?>
+                                    <option value="<?php echo $n; ?>" <?php echo $selected;
+                                        ?>><?php echo __($desc); ?></option>
+                <?php } ?>
+                </select>
+                <i class="help-tip icon-question-sign" href="#default_name_formatting"></i>
+            </td>
+        </tr>
+        <tr>
+            <td><?php echo __('Collision Avoidance Duration'); ?>:</td>
+            <td>
+                <input type="text" name="autolock_minutes" size=4 value="<?php echo $config['autolock_minutes']; ?>">
+                <font class="error"><?php echo $errors['autolock_minutes']; ?></font>&nbsp;<?php echo __('minutes'); ?>
+                &nbsp;<i class="help-tip icon-question-sign" href="#collision_avoidance"></i>
+            </td>
+        </tr>
+        <tr>
+            <td><?php echo __('Enable Rich Text'); ?>:</td>
+            <td>
+                <input type="checkbox" name="enable_html_thread" <?php
+                echo $config['enable_html_thread']?'checked="checked"':''; ?>>
+                <?php echo __('Enable html in thread entries and email correspondence.'); ?>
+                <i class="help-tip icon-question-sign" href="#enable_richtext"></i>
+            </td>
+        </tr>
 
         <tr><td><?php echo __('Default Page Size');?>:</td>
             <td>
@@ -106,29 +137,6 @@ $gmtime = Misc::gmtime();
                 <i class="help-tip icon-question-sign" href="#purge_logs"></i>
             </td>
         </tr>
-        <tr>
-            <td width="180"><?php echo __('Default Name Formatting'); ?>:</td>
-            <td>
-                <select name="name_format">
-                <?php foreach (PersonsName::allFormats() as $n=>$f) {
-                    list($desc, $func) = $f;
-                    $selected = ($config['name_format'] == $n) ? 'selected="selected"' : ''; ?>
-                                    <option value="<?php echo $n; ?>" <?php echo $selected;
-                                        ?>><?php echo __($desc); ?></option>
-                <?php } ?>
-                </select>
-                <i class="help-tip icon-question-sign" href="#default_name_formatting"></i>
-            </td>
-        </tr>
-        <tr>
-            <td><?php echo __('Enable Rich Text'); ?>:</td>
-            <td>
-                <input type="checkbox" name="enable_html_thread" <?php
-                echo $config['enable_html_thread']?'checked="checked"':''; ?>>
-                <?php echo __('Enable html in thread entries and email correspondence.'); ?>
-                <i class="help-tip icon-question-sign" href="#enable_richtext"></i>
-            </td>
-        </tr>
         <tr>
             <th colspan="2">
                 <em><b><?php echo __('Date and Time Options'); ?></b>&nbsp;
diff --git a/include/staff/settings-tickets.inc.php b/include/staff/settings-tickets.inc.php
index b22387e57..e4f00e2dc 100644
--- a/include/staff/settings-tickets.inc.php
+++ b/include/staff/settings-tickets.inc.php
@@ -154,13 +154,6 @@ if(!($maxfileuploads=ini_get('max_file_uploads')))
                 <?php echo __('per end user'); ?> <i class="help-tip icon-question-sign" href="#maximum_open_tickets"></i>
             </td>
         </tr>
-        <tr>
-            <td><?php echo __('Agent Collision Avoidance Duration'); ?>:</td>
-            <td>
-                <input type="text" name="autolock_minutes" size=4 value="<?php echo $config['autolock_minutes']; ?>">
-                <font class="error"><?php echo $errors['autolock_minutes']; ?></font>&nbsp;<?php echo __('minutes'); ?>&nbsp;<i class="help-tip icon-question-sign" href="#agent_collision_avoidance"></i>
-            </td>
-        </tr>
         <tr>
             <td><?php echo __('Human Verification');?>:</td>
             <td>
-- 
GitLab