Fix worklog input validation error and default to current day during buildup
This commit is contained in:
parent
9e0c7180d7
commit
e750436a82
|
@ -87,9 +87,9 @@ function user_worklog_from_request(Worklog $worklog)
|
||||||
}
|
}
|
||||||
|
|
||||||
$worklog->hours = $request->input('work_hours');
|
$worklog->hours = $request->input('work_hours');
|
||||||
if (!preg_match("/^\d+(\.\d{0,2})?$/", $worklog->hours)) {
|
if (!preg_match("/^\d+(\.\d{0,2})?$/", $request->input('work_hours'))) {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
error(__('Please enter work hours in format ##[.##].'));
|
error(__('Please enter work hours in format ##[.##]'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$worklog->comment = $request->input('comment');
|
$worklog->comment = $request->input('comment');
|
||||||
|
|
|
@ -125,9 +125,11 @@ function UserWorkLog_new($userId)
|
||||||
{
|
{
|
||||||
/** @var Carbon $buildup */
|
/** @var Carbon $buildup */
|
||||||
$buildup = config('buildup_start');
|
$buildup = config('buildup_start');
|
||||||
|
/** @var Carbon $event */
|
||||||
|
$event = config('event_start');
|
||||||
|
|
||||||
$work_date = Carbon::today();
|
$work_date = Carbon::today();
|
||||||
if (!empty($buildup)) {
|
if (!empty($buildup) && (empty($event) || $event->lessThan(Carbon::now()))) {
|
||||||
$work_date = $buildup;
|
$work_date = $buildup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -777,8 +777,8 @@ msgid "Please enter work date."
|
||||||
msgstr "Bitte Einsatzdatum angeben."
|
msgstr "Bitte Einsatzdatum angeben."
|
||||||
|
|
||||||
#: includes/controller/user_worklog_controller.php:87
|
#: includes/controller/user_worklog_controller.php:87
|
||||||
msgid "Please enter work hours in format ##[.##]."
|
msgid "Please enter work hours in format ##[.##]"
|
||||||
msgstr "Bitte Stunden im Format ##[.##| eingeben."
|
msgstr "Bitte Stunden im Format ##[.##] eingeben."
|
||||||
|
|
||||||
#: includes/controller/user_worklog_controller.php:93
|
#: includes/controller/user_worklog_controller.php:93
|
||||||
msgid "Please enter a comment."
|
msgid "Please enter a comment."
|
||||||
|
|
Loading…
Reference in New Issue