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

Add Queue Columns Annotation as Fields.

parent af829e82
No related branches found
No related tags found
No related merge requests found
......@@ -135,7 +135,7 @@ class SearchAjaxAPI extends AjaxController {
$_SESSION[$key] = $keep;
}
}
function _hashCriteria($criteria, $size=10) {
$parts = array();
foreach ($criteria as $C) {
......
......@@ -1508,6 +1508,17 @@ abstract class QueueColumnAnnotation {
function isVisible($row) {
return true;
}
static function addToQuery($query, $name=false) {
$name = $name ?: static::$qname;
$annotation = new Static(array());
return $annotation->annotate($query, $name);
}
static function from_query($row, $name=false) {
$name = $name ?: static::$qname;
return $row[$name];
}
}
class TicketThreadCount
......
......@@ -1436,6 +1436,7 @@ class OpenClosedTicketStatusList extends TicketStatusList {
return $rv;
}
}
class TicketStatusChoiceField extends SelectionField {
static $widget = 'ChoicesWidget';
......@@ -1468,6 +1469,50 @@ class TicketStatusChoiceField extends SelectionField {
}
}
class TicketThreadCountField extends NumericField {
function addToQuery($query, $name=false) {
return TicketThreadCount::addToQuery($query, $name);
}
function from_query($row, $name=false) {
return TicketThreadCount::from_query($row, $name);
}
}
class TicketReopenCountField extends NumericField {
function addToQuery($query, $name=false) {
return TicketReopenCount::addToQuery($query, $name);
}
function from_query($row, $name=false) {
return TicketReopenCount::from_query($row, $name);
}
}
class ThreadAttachmentCountField extends NumericField {
function addToQuery($query, $name=false) {
return ThreadAttachmentCount::addToQuery($query, $name);
}
function from_query($row, $name=false) {
return ThreadAttachmentCount::from_query($row, $name);
}
}
class ThreadCollaboratorCountField extends NumericField {
function addToQuery($query, $name=false) {
return ThreadCollaboratorCount::addToQuery($query, $name);
}
function from_query($row, $name=false) {
return ThreadCollaboratorCount::from_query($row, $name);
}
}
interface Searchable {
// Fetch an array of [ orm__path => Field() ] pairs. The field label is
// used when this list is rendered in a dropdown, and the field search
......
......@@ -2182,6 +2182,18 @@ implements RestrictedAccess, Threadable, Searchable {
'isassigned' => new AssignedField(array(
'label' => __('Assigned'),
)),
'thread_count' => new TicketThreadCountField(array(
'label' => __('Thread Count'),
)),
'attachment_count' => new ThreadAttachmentCountField(array(
'label' => __('Attachment Count'),
)),
'collaborator_count' => new ThreadCollaboratorCountField(array(
'label' => __('Collaborator Count'),
)),
'reopen_count' => new TicketReopenCountField(array(
'label' => __('Reopen Count'),
)),
'ip_address' => new TextboxField(array(
'label' => __('IP Address'),
'configuration' => array('validator' => 'ip'),
......
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