diff --git a/include/ajax.search.php b/include/ajax.search.php index 93da251e7d164e9548550dce3b35cf16051bbcf3..dbc0a291b86d3c7bebb6f1c67333735b23739b9e 100644 --- a/include/ajax.search.php +++ b/include/ajax.search.php @@ -135,7 +135,7 @@ class SearchAjaxAPI extends AjaxController { $_SESSION[$key] = $keep; } } - + function _hashCriteria($criteria, $size=10) { $parts = array(); foreach ($criteria as $C) { diff --git a/include/class.queue.php b/include/class.queue.php index 9dd9b36e3a914ee2c8e845f12d58938635868017..1741d4f96d0c94c13126d4ada8ca42b55a3b75ac 100644 --- a/include/class.queue.php +++ b/include/class.queue.php @@ -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 diff --git a/include/class.search.php b/include/class.search.php index 51629ccdbb279f736273346b2ee6fdfc20323237..c32916504b3d4200ccdde403e00ebe4656c4a9cb 100644 --- a/include/class.search.php +++ b/include/class.search.php @@ -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 diff --git a/include/class.ticket.php b/include/class.ticket.php index 8174989cbe525f5250b1bd246298afeb5088bbb6..1b84762c6c0209734f9b91b1a33aa5d4d70f08d1 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -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'),