From 871d8b38d6880956994a085460604c06a0c4dc91 Mon Sep 17 00:00:00 2001 From: Peter Rotich <peter@osticket.com> Date: Tue, 14 Oct 2014 21:26:49 +0000 Subject: [PATCH] bug: Custom ticket statuses Add order by method to ticket status list to return appropriate sort columns Delegate __get method in CustomListHandler to the parent list --- include/class.list.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/include/class.list.php b/include/class.list.php index dfee67d55..f5f9c4bd2 100644 --- a/include/class.list.php +++ b/include/class.list.php @@ -109,10 +109,15 @@ abstract class CustomListHandler { return $rv; } + function __get($field) { + return $this->_list->{$field}; + } + function update($vars, &$errors) { return $this->_list->update($vars, $errors); } + abstract function getListOrderBy(); abstract function getNumItems(); abstract function getAllItems(); abstract function getItems($criteria); @@ -334,6 +339,7 @@ class DynamicList extends VerySimpleModel implements CustomList { $this->set('updated', new SqlFunction('NOW')); if (isset($this->dirty['notes'])) $this->notes = Format::sanitize($this->notes); + return parent::save($refetch); } @@ -656,6 +662,14 @@ class TicketStatusList extends CustomListHandler { var $_items; var $_form; + function getListOrderBy() { + switch ($this->getSortMode()) { + case 'Alpha': return 'name'; + case '-Alpha': return '-name'; + case 'SortCol': return 'sort'; + } + } + function getNumItems() { return TicketStatus::objects()->count(); } @@ -774,8 +788,6 @@ class TicketStatus extends VerySimpleModel implements CustomListItem { const ENABLED = 0x0001; const INTERNAL = 0x0002; // Forbid deletion or name and status change. - - function __construct() { call_user_func_array(array('parent', '__construct'), func_get_args()); } -- GitLab