Worklog: Limit worklog comment length to 200 as it is configured in the database

This commit is contained in:
Igor Scheller 2020-01-09 13:43:10 +01:00
parent 74cf8d1e69
commit 94753bc3d8
2 changed files with 6 additions and 1 deletions

View File

@ -93,6 +93,11 @@ function user_worklog_from_request($userWorkLog)
error(__('Please enter a comment.')); error(__('Please enter a comment.'));
} }
if (mb_strlen($userWorkLog['comment']) > 200) {
$valid = false;
error(__('Comment too long.'));
}
return [ return [
$valid, $valid,
$userWorkLog $userWorkLog

View File

@ -45,7 +45,7 @@ function UserWorkLog_edit_form($user_source, $userWorkLog)
form_info(__('User'), User_Nick_render($user_source)), form_info(__('User'), User_Nick_render($user_source)),
form_date('work_timestamp', __('Work date'), $userWorkLog['work_timestamp'], null, time()), form_date('work_timestamp', __('Work date'), $userWorkLog['work_timestamp'], null, time()),
form_text('work_hours', __('Work hours'), $userWorkLog['work_hours']), form_text('work_hours', __('Work hours'), $userWorkLog['work_hours']),
form_text('comment', __('Comment'), $userWorkLog['comment']), form_text('comment', __('Comment'), $userWorkLog['comment'], false, 200),
form_submit('submit', __('Save')) form_submit('submit', __('Save'))
]); ]);
} }