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

Merge pull request #4576 from aydreeihn/issue/delete-default-queue

Deleting the Default Queue
parents 428e43bf b86efb5c
Branches
Tags
No related merge requests found
...@@ -72,11 +72,13 @@ if ($_POST) { ...@@ -72,11 +72,13 @@ if ($_POST) {
if ($queue->save()) $updated++; if ($queue->save()) $updated++;
break; break;
case 'delete': case 'delete':
if ($queue->delete()) $updated++; if ($queue->getId() == $cfg->getDefaultTicketQueueId())
$err = __('This queue is the default queue. Unable to delete. ');
elseif ($queue->delete()) $updated++;
} }
} }
if (!$updated) { if (!$updated) {
Messages::error(__( Messages::error($err ?: __(
'Unable to manage any of the selected queues')); 'Unable to manage any of the selected queues'));
} }
elseif ($_POST['count'] && $updated != $_POST['count']) { elseif ($_POST['count'] && $updated != $_POST['count']) {
......
...@@ -23,6 +23,11 @@ require_once(INCLUDE_DIR.'class.json.php'); ...@@ -23,6 +23,11 @@ require_once(INCLUDE_DIR.'class.json.php');
require_once(INCLUDE_DIR.'class.dynamic_forms.php'); require_once(INCLUDE_DIR.'class.dynamic_forms.php');
require_once(INCLUDE_DIR.'class.export.php'); // For paper sizes require_once(INCLUDE_DIR.'class.export.php'); // For paper sizes
// Fetch ticket queues organized by root and sub-queues
$queues = CustomQueue::getHierarchicalQueues($thisstaff);
$page=''; $page='';
$ticket = $user = null; //clean start. $ticket = $user = null; //clean start.
$redirect = false; $redirect = false;
...@@ -113,18 +118,21 @@ if (!$ticket) { ...@@ -113,18 +118,21 @@ if (!$ticket) {
$queue = AdhocSearch::load($key); $queue = AdhocSearch::load($key);
} }
// Make the current queue sticky if ((int) $queue_id && !$queue)
$_SESSION[$queue_key] = $queue_id;
if ((int) $queue_id && !$queue) {
$queue = SavedQueue::lookup($queue_id); $queue = SavedQueue::lookup($queue_id);
}
if (!$queue) {
$queue = SavedQueue::lookup($cfg->getDefaultTicketQueueId());
}
// Set the queue_id for navigation to turn a top-level item bold if (!$queue && ($qid=$cfg->getDefaultTicketQueueId()))
$_REQUEST['queue'] = $queue->getId(); $queue = SavedQueue::lookup($qid);
if (!$queue && $queues)
list($queue,) = $queues[0];
if ($queue) {
// Set the queue_id for navigation to turn a top-level item bold
$_REQUEST['queue'] = $queue->getId();
// Make the current queue sticky
$_SESSION[$queue_key] = $queue->getId();
}
} }
// Configure form for file uploads // Configure form for file uploads
...@@ -450,9 +458,6 @@ if (isset($_GET['clear_filter'])) ...@@ -450,9 +458,6 @@ if (isset($_GET['clear_filter']))
$nav->setTabActive('tickets'); $nav->setTabActive('tickets');
$nav->addSubNavInfo('jb-overflowmenu', 'customQ_nav'); $nav->addSubNavInfo('jb-overflowmenu', 'customQ_nav');
// Fetch ticket queues organized by root and sub-queues
$queues = CustomQueue::getHierarchicalQueues($thisstaff);
// Start with all the top-level (container) queues // Start with all the top-level (container) queues
foreach ($queues as $_) { foreach ($queues as $_) {
list($q, $children) = $_; list($q, $children) = $_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment