diff --git a/timesheet/inc/class.timesheet_bo.inc.php b/timesheet/inc/class.timesheet_bo.inc.php index 84f724e806..3273aa3d6a 100644 --- a/timesheet/inc/class.timesheet_bo.inc.php +++ b/timesheet/inc/class.timesheet_bo.inc.php @@ -277,6 +277,30 @@ class timesheet_bo extends Api\Storage } } + /** + * Get status labels with admin statuses (optionally) filtered out + * + * @param boolean $admin + * + * @return Array + */ + protected function get_status_labels($admin = null) + { + if(is_null($admin)) + { + $admin = isset($GLOBALS['egw_info']['user']['apps']['admin']); + } + $labels = array(); + foreach($this->status_labels as $status_id => $label) + { + if($admin || !$admin && !$this->status_labels_config[$status_id]['admin']) + { + $labels[$status_id] = $label; + } + } + return $labels; + } + /** * get list of specified grants as uid => Username pairs * diff --git a/timesheet/inc/class.timesheet_ui.inc.php b/timesheet/inc/class.timesheet_ui.inc.php index f112153c55..0641d15398 100644 --- a/timesheet/inc/class.timesheet_ui.inc.php +++ b/timesheet/inc/class.timesheet_ui.inc.php @@ -444,7 +444,7 @@ class timesheet_ui extends timesheet_bo $edit_grants[$content['ts_owner']] = Api\Accounts::username($content['ts_owner']); } $sel_options['ts_owner'] = $edit_grants; - $sel_options['ts_status'] = $this->status_labels; + $sel_options['ts_status'] = $this->get_status_labels($only_admin_edit); if($this->config_data['history'] && $content['ts_status'] == self::DELETED_STATUS) { $sel_options['ts_status'][self::DELETED_STATUS] = 'Deleted'; @@ -1051,9 +1051,9 @@ class timesheet_ui extends timesheet_bo 'icon' => 'apply', 'caption' => 'Modify status', 'group' => $group, - 'children' => $this->status_labels, + 'children' => $this->get_status_labels(), 'prefix' => 'to_status_', - 'enabled' => (boolean)$this->status_labels, + 'enabled' => (boolean)$this->get_status_labels(), ), );