prepare break time field (#5366)
This commit is contained in:
@@ -310,6 +310,10 @@ class TimesheetEditForm extends AbstractType
|
||||
|
||||
$builder->add('duration', DurationType::class, $durationOptions);
|
||||
|
||||
if ($this->systemConfiguration->isBreakTimeEnabled()) {
|
||||
$builder->add('break', DurationType::class, ['label' => 'break', 'required' => false]);
|
||||
}
|
||||
|
||||
$builder->addEventListener(
|
||||
FormEvents::POST_SET_DATA,
|
||||
function (FormEvent $event) {
|
||||
@@ -338,7 +342,7 @@ class TimesheetEditForm extends AbstractType
|
||||
|
||||
$duration = $timesheet->getDuration() ?? 0;
|
||||
|
||||
// only apply the duration, if the end is not yet set
|
||||
// only apply the duration, if the end is not yet set.
|
||||
// without that check, the end would be overwritten and the real end time would be lost
|
||||
if (($forceApply && $duration > 0) || ($duration > 0 && $timesheet->isRunning())) {
|
||||
$end = clone $timesheet->getBegin();
|
||||
|
||||
Reference in New Issue
Block a user