mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 06:30:59 +01:00
using new historylog custom field stuff, specially logging each custome field separate
This commit is contained in:
parent
e01df197ae
commit
d7a6328c12
@ -142,12 +142,6 @@ class timesheet_bo extends so_sql_cf
|
||||
//'link_to' => 'Attachments & Links',
|
||||
'customfields' => 'Custom fields',
|
||||
);
|
||||
/**
|
||||
* setting field-name from DB to history status
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
var $field2history = array();
|
||||
/**
|
||||
* Name of the timesheet table storing custom fields
|
||||
*/
|
||||
@ -214,10 +208,6 @@ class timesheet_bo extends so_sql_cf
|
||||
$GLOBALS['timesheet_bo'] =& $this;
|
||||
}
|
||||
$this->grants = $GLOBALS['egw']->acl->get_grants(TIMESHEET_APP);
|
||||
//set fields for tracking
|
||||
$this->field2history = array_keys($this->db_cols);
|
||||
$this->field2history = array_diff(array_combine($this->field2history,$this->field2history),array('ts_modified'));
|
||||
$this->field2history += array('customfields' => '#c'); //add custom fields for history
|
||||
}
|
||||
|
||||
/**
|
||||
@ -518,18 +508,7 @@ class timesheet_bo extends so_sql_cf
|
||||
|
||||
$this->tracking->html_content_allow = true;
|
||||
}
|
||||
if ($this->customfields)
|
||||
{
|
||||
$data_custom = $old_custom = array();
|
||||
foreach($this->customfields as $name => $custom)
|
||||
{
|
||||
if (isset($this->data['#'.$name]) && (string)$this->data['#'.$name]!=='') $data_custom[] = $custom['label'].': '.$this->data['#'.$name];
|
||||
if (isset($old['#'.$name]) && (string)$old['#'.$name]!=='') $old_custom[] = $custom['label'].': '.$old['#'.$name];
|
||||
}
|
||||
$this->data['customfields'] = implode("\n",$data_custom);
|
||||
$old['customfields'] = implode("\n",$old_custom);
|
||||
}
|
||||
if (!$this->tracking->track($this->data,$old,$this->user))
|
||||
if ($this->tracking->track($this->data,$old,$this->user) === false)
|
||||
{
|
||||
return implode(', ',$this->tracking->errors);
|
||||
}
|
||||
|
@ -65,14 +65,17 @@ class timesheet_tracking extends bo_tracking
|
||||
* @param timesheet_bo $botimesheet
|
||||
* @return timesheet_tracking
|
||||
*/
|
||||
function __construct($bo)
|
||||
function __construct(timesheet_bo $bo)
|
||||
{
|
||||
parent::__construct(); // calling the constructor of the extended class
|
||||
|
||||
$this->bo = $bo;
|
||||
|
||||
$this->field2history = $this->bo->field2history;
|
||||
//set fields for tracking
|
||||
$this->field2history = array_keys($this->bo->db_cols);
|
||||
$this->field2history = array_diff(array_combine($this->field2history,$this->field2history),array('ts_modified'));
|
||||
$this->field2history += array('customfields' => '#c'); // to display old customfield data in history
|
||||
|
||||
// custom fields are now handled by parent::__construct('tracker')
|
||||
parent::__construct('timesheet');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,6 +84,7 @@ class timesheet_ui extends timesheet_bo
|
||||
}
|
||||
$referer = preg_match('/menuaction=([^&]+)/',$_SERVER['HTTP_REFERER'],$matches) ? $matches[1] :
|
||||
(strpos($_SERVER['HTTP_REFERER'],'/infolog/index.php') !== false ? 'infolog.infolog_ui.index' : TIMESHEET_APP.'.timesheet_ui.index');
|
||||
|
||||
if (!isset($GLOBALS['egw_info']['user']['apps']['admin']) && $this->data['ts_status'])
|
||||
{
|
||||
if ($this->status_labels_config[$this->data['ts_status']]['admin'])
|
||||
@ -352,10 +353,8 @@ class timesheet_ui extends timesheet_bo
|
||||
'cat_id' => 'select-cat',
|
||||
),
|
||||
);
|
||||
foreach($this->field2history as $field => $status)
|
||||
{
|
||||
$sel_options['status'][$status] = $this->field2label[$field];
|
||||
}
|
||||
$sel_options['status'] = $this->field2label;
|
||||
|
||||
// the actual title-blur is either the preserved title blur (if we are called from infolog entry),
|
||||
// or the preserved project-blur comming from the current selected project
|
||||
$content['ts_title_blur'] = $preserv['ts_title_blur'] ? $preserv['ts_title_blur'] : $preserv['ts_project_blur'];
|
||||
@ -380,6 +379,11 @@ class timesheet_ui extends timesheet_bo
|
||||
{
|
||||
$readonlys['ts_owner'] = true;
|
||||
}
|
||||
// in view mode, we need to add the owner, if it does not exist, otherwise it's displayed empty
|
||||
if ($view && $content['ts_owner'] && !isset($edit_grants[$content['ts_owner']]))
|
||||
{
|
||||
$edit_grants[$content['ts_owner']] = common::grab_owner_name($content['ts_owner']);
|
||||
}
|
||||
$sel_options['ts_owner'] = $edit_grants;
|
||||
$sel_options['ts_status'] = $this->status_labels;
|
||||
$GLOBALS['egw_info']['flags']['app_header'] = lang('timesheet').' - '.
|
||||
|
Loading…
Reference in New Issue
Block a user