forked from extern/egroupware
* Timesheet - only admins can select admin only statuses
This commit is contained in:
parent
b2b285848e
commit
f69789c8a5
@ -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
|
||||
*
|
||||
|
@ -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(),
|
||||
),
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user