Infolog: History tab showed start / due / completed dates in server time, not user time

This commit is contained in:
nathan 2023-06-06 14:44:24 -06:00
parent efd073c4c2
commit e96031c154
2 changed files with 31 additions and 0 deletions

View File

@ -2768,4 +2768,34 @@ class infolog_ui
}
return $fields;
}
/**
* Modify history to make timestamps in user time
*
* @param array $data values for keys "data" (data) and "args":
* values for keys "value", "rows" (reference) and "total" (reference)
*/
public function modify_history(array $data)
{
$fields = ['Co', 'st', 'Mo', 'En'];
foreach($data['rows'] as $index => &$row)
{
if($row['appname'] !== 'infolog')
{
return;
}
if(in_array($row['status'], $fields))
{
foreach(['old_value', 'new_value'] as $field)
{
if(!$row[$field])
{
continue;
}
$row[$field] = Api\DateTime::server2user($row[$field], Api\DateTime::ET2);
}
}
}
}
}

View File

@ -58,6 +58,7 @@ $setup_info['infolog']['hooks']['timesheet_set'] = 'infolog.infolog_ui.timesheet
$setup_info['infolog']['hooks']['calendar_set'] = 'infolog.infolog_ui.calendar_set';
$setup_info['infolog']['hooks']['mail_import'] = 'infolog_hooks::mail_import';
$setup_info['infolog']['hooks']['change_account_ids'] = 'infolog_customfields::change_account_ids';
$setup_info['infolog']['hooks']['etemplate2_history_get_rows'] = 'infolog.infolog_ui.modify_history';
// Dependencies for this app to work
$setup_info['infolog']['depends'][] = array(