diff --git a/include/ajax.admin.php b/include/ajax.admin.php index 1047b8395d101d93dac8990ce2022c4e178c6825..4b31278e088217d4f8f73ab3da0e0248965ad1e6 100644 --- a/include/ajax.admin.php +++ b/include/ajax.admin.php @@ -237,6 +237,9 @@ class AdminAjaxAPI extends AjaxController { } } + if (!$data_form) + $data_form = $sort->getDataConfigForm(); + include STAFFINC_DIR . 'templates/queue-sorting-add.tmpl.php'; } diff --git a/include/api.tickets.php b/include/api.tickets.php index 8d20e391cfa1aebb66ad5d154a16f2fd1510d1ef..8336943f5e63c08d80f02c5ea6d9c0075b1a2050 100644 --- a/include/api.tickets.php +++ b/include/api.tickets.php @@ -15,7 +15,12 @@ class TicketApiController extends ApiController { array("name", "type", "data", "encoding", "size") ), "message", "ip", "priorityId", - "system_emails", "thread_entry_recipients" + "system_emails" => array( + "*" => "*" + ), + "thread_entry_recipients" => array ( + "*" => array("to", "cc") + ) ); # Fetch dynamic form field names for the given help topic and add # the names to the supported request structure diff --git a/include/class.search.php b/include/class.search.php index 7f39725668c970e8fd57e69ac7f2afd381a7c625..2e05d9445ed1e5195cd96dd04469986579d55e39 100755 --- a/include/class.search.php +++ b/include/class.search.php @@ -900,7 +900,7 @@ class SavedQueue extends CustomQueue { $counts = array(); $query = Ticket::objects(); // Apply tickets visibility for the agent - $query = $agent->applyVisibility($query); + $query = $agent->applyVisibility($query, true); // Aggregate constraints foreach ($queues as $queue) { $Q = $queue->getBasicQuery(); diff --git a/include/class.staff.php b/include/class.staff.php index b8235be0646115c886a73e89fc6fe13e00077cfe..f3ec54ae2462bd8317c65a6e05d86e0f95e9cb0a 100644 --- a/include/class.staff.php +++ b/include/class.staff.php @@ -584,7 +584,7 @@ implements AuthenticatedUser, EmailContact, TemplateVariable, Searchable { return $this->_teams; } - function getTicketsVisibility() { + function getTicketsVisibility($exclude_archived=false) { // -- Open and assigned to me $assigned = Q::any(array( @@ -607,15 +607,26 @@ implements AuthenticatedUser, EmailContact, TemplateVariable, Searchable { // -- Routed to a department of mine if (($depts=$this->getDepts()) && count($depts)) { - $visibility->add(array('dept_id__in' => $depts)); - $visibility->add(array('thread__referrals__dept__id__in' => $depts)); + $in_dept = Q::any(array( + 'dept_id__in' => $depts, + 'thread__referrals__dept__id__in' => $depts, + )); + + if ($exclude_archived) { + $in_dept = Q::all(array( + 'status__state__in' => ['open', 'closed'], + $in_dept, + )); + } + + $visibility->add($in_dept); } return $visibility; } - function applyVisibility($query) { - return $query->filter($this->getTicketsVisibility()); + function applyVisibility($query, $exclude_archived=false) { + return $query->filter($this->getTicketsVisibility($exclude_archived)); } /* stats */ diff --git a/include/staff/templates/queue-sorting.tmpl.php b/include/staff/templates/queue-sorting.tmpl.php index 2640e43acfed9c1c9ad917e2d632cf57dec63b1b..7f84926b4f57bd3fb83485a9835e33720a67294c 100644 --- a/include/staff/templates/queue-sorting.tmpl.php +++ b/include/staff/templates/queue-sorting.tmpl.php @@ -1,4 +1,4 @@ -<?php echo $sort->getDataConfigForm()->asTable(); ?> +<?php echo $data_form->asTable(); ?> <table class="table"> <tbody class="sortable-rows"> diff --git a/include/staff/templates/queue-tickets.tmpl.php b/include/staff/templates/queue-tickets.tmpl.php index d6e6307c1d8c3a0ab4f5f9e820a397c7ead872e5..49a8eb2461becec6470e55dc755cc42ee42aae31 100644 --- a/include/staff/templates/queue-tickets.tmpl.php +++ b/include/staff/templates/queue-tickets.tmpl.php @@ -6,7 +6,11 @@ // Impose visibility constraints // ------------------------------------------------------------ -if (!$queue->ignoreVisibilityConstraints($thisstaff)) +//filter if limited visibility or if unlimited visibility and in a queue +$ignoreVisibility = $queue->ignoreVisibilityConstraints($thisstaff); +if (!$ignoreVisibility || //limited visibility + ($ignoreVisibility && ($queue->isAQueue() || $queue->isASubQueue())) //unlimited visibility + not a search +) $tickets->filter($thisstaff->getTicketsVisibility()); // Make sure the cdata materialized view is available