Skip to content
Snippets Groups Projects
Commit e601405e authored by Peter Rotich's avatar Peter Rotich
Browse files

Merge remote branch 'upstream/develop-next' into develop-next

parents c5fd54d1 fcc06c91
No related branches found
No related tags found
No related merge requests found
...@@ -246,6 +246,7 @@ class CustomQueue extends VerySimpleModel { ...@@ -246,6 +246,7 @@ class CustomQueue extends VerySimpleModel {
function getCurrentSearchFields($source=array(), $criteria=array()) { function getCurrentSearchFields($source=array(), $criteria=array()) {
static $basic = array( static $basic = array(
'Ticket' => array( 'Ticket' => array(
'status__id',
'status__state', 'status__state',
'dept_id', 'dept_id',
'assignee', 'assignee',
...@@ -937,10 +938,14 @@ class CustomQueue extends VerySimpleModel { ...@@ -937,10 +938,14 @@ class CustomQueue extends VerySimpleModel {
return $agent && $this->isPrivate() && $this->checkOwnership($agent); return $agent && $this->isPrivate() && $this->checkOwnership($agent);
} }
function isSaved() {
return true;
}
function ignoreVisibilityConstraints(Staff $agent) { function ignoreVisibilityConstraints(Staff $agent) {
// For saved searches (not queues), some staff can have a permission to // For searches (not queues), some staff can have a permission to
// see all records // see all records
return (!$this->isASubQueue() return ($this->isASearch()
&& $this->isOwner($agent) && $this->isOwner($agent)
&& $agent->canSearchEverything()); && $agent->canSearchEverything());
} }
...@@ -994,6 +999,10 @@ class CustomQueue extends VerySimpleModel { ...@@ -994,6 +999,10 @@ class CustomQueue extends VerySimpleModel {
return $this->hasFlag(self::FLAG_QUEUE); return $this->hasFlag(self::FLAG_QUEUE);
} }
function isASearch() {
return !$this->isAQueue() || !$this->isSaved();
}
function isPrivate() { function isPrivate() {
return !$this->isAQueue() && !$this->isPublic() && return !$this->isAQueue() && !$this->isPublic() &&
$this->staff_id; $this->staff_id;
......
...@@ -912,6 +912,10 @@ extends SavedSearch { ...@@ -912,6 +912,10 @@ extends SavedSearch {
return false; return false;
} }
function isOwner(Staff $staff) {
return $this->ht['staff_id'] == $staff->getId();
}
function checkAccess($staff) { function checkAccess($staff) {
return true; return true;
} }
...@@ -921,6 +925,7 @@ extends SavedSearch { ...@@ -921,6 +925,7 @@ extends SavedSearch {
} }
function load($key) { function load($key) {
global $thisstaff;
if (strpos($key, 'adhoc') === 0) if (strpos($key, 'adhoc') === 0)
list(, $key) = explode(',', $key, 2); list(, $key) = explode(',', $key, 2);
...@@ -933,6 +938,7 @@ extends SavedSearch { ...@@ -933,6 +938,7 @@ extends SavedSearch {
$queue = new AdhocSearch(array( $queue = new AdhocSearch(array(
'id' => "adhoc,$key", 'id' => "adhoc,$key",
'root' => 'T', 'root' => 'T',
'staff_id' => $thisstaff->getId(),
'title' => __('Advanced Search'), 'title' => __('Advanced Search'),
)); ));
$queue->config = $config; $queue->config = $config;
......
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