worklog: Fix hours validation

closes #527 (Worklog entries with floating point numbers with a comma dispatches a team of untrained monkeys)
main
Igor Scheller 6 years ago
parent 204ff4c0e7
commit 9a15fbc71e

@ -82,7 +82,7 @@ function user_worklog_from_request($userWorkLog)
} }
$userWorkLog['work_hours'] = $request->input('work_hours'); $userWorkLog['work_hours'] = $request->input('work_hours');
if (!preg_match("/[0-9]+(\.[0-9]+)?/", $userWorkLog['work_hours'])) { if (!preg_match("/^[0-9]+(\.[0-9]+)?$/", $userWorkLog['work_hours'])) {
$valid = false; $valid = false;
error(__('Please enter work hours in format ##[.##].')); error(__('Please enter work hours in format ##[.##].'));
} }

Loading…
Cancel
Save