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();
|
||||
|
||||
@@ -46,6 +46,9 @@
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if form.break is defined %}
|
||||
{{ form_row(form.break, {'row_attr': {'class': 'mb-3 ' ~ form.vars.name ~ '_row_' ~ form.break.vars.name}}) }}
|
||||
{% endif %}
|
||||
{% if form.customer is defined %}
|
||||
{{ form_row(form.customer, {'row_attr': {'class': 'mb-3 ' ~ form.vars.name ~ '_row_' ~ form.customer.vars.name}}) }}
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user