Release 2.34 (#5465)
* fix timing issue in timesheet edit form with deactivated rounding * bump packages * only show update messages for newer plugin versions * replace deprecated method * remove internal from API * remove technical terms from translation * prevent calls to internal symfony methods * helper method to flag entry as modified * support meta-fields in weekly-hourse view * fix running timesheets were deleted in weekly-hourse
This commit is contained in:
@@ -33,6 +33,18 @@ final class QuickEntryForm extends AbstractType
|
||||
$builder->addModelTransformer(new CallbackTransformer(
|
||||
function ($value) {
|
||||
// page is loaded, nothing to do
|
||||
if (!$value instanceof QuickEntryWeek) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
foreach ($value->getRows() as $row) {
|
||||
foreach ($row->getTimesheets() as $timesheet) {
|
||||
foreach ($timesheet->getMetaFields() as $metaField) {
|
||||
$row->setMetaFieldValue($metaField);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $value;
|
||||
},
|
||||
function (?QuickEntryWeek $value) {
|
||||
@@ -49,6 +61,24 @@ final class QuickEntryForm extends AbstractType
|
||||
foreach ($row->getTimesheets() as $timesheet) {
|
||||
$timesheet->setProject($project);
|
||||
$timesheet->setActivity($activity);
|
||||
foreach ($row->getMetaFields() as $metaField) {
|
||||
if (null === ($name = $metaField->getName())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (null === $timesheet->getMetaField($name)) {
|
||||
$timesheet->setMetaField($metaField);
|
||||
}
|
||||
|
||||
if (null === ($tmpField = $timesheet->getMetaField($name))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($tmpField->getValue() !== $metaField->getValue()) {
|
||||
$tmpField->setValue($metaField->getValue());
|
||||
$timesheet->markAsModified();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -214,9 +214,9 @@ class TimesheetEditForm extends AbstractType
|
||||
return;
|
||||
}
|
||||
|
||||
// if the user did not change the time, make sure to keep the seconds
|
||||
$seconds = 0;
|
||||
if ($data->getBegin()?->format('H:i') === $time->format('H:i')) {
|
||||
// if the user did not change the time, make sure to keep the seconds (ONLY if the timesheet is already existing)
|
||||
if ($data->getBegin()?->format('H:i') === $time->format('H:i') && $data->getId() !== null) {
|
||||
$seconds = $data->getBegin()->format('s') ?? 0;
|
||||
}
|
||||
|
||||
@@ -276,9 +276,9 @@ class TimesheetEditForm extends AbstractType
|
||||
throw new \Exception('Cannot work with timesheets without start time');
|
||||
}
|
||||
|
||||
// if the user did not change the time, make sure to keep the seconds
|
||||
$seconds = 0;
|
||||
if ($oldEnd !== null && $oldEnd->format('H:i') === $end->format('H:i')) {
|
||||
// if the user did not change the time, make sure to keep the seconds (ONLY if the timesheet is already existing)
|
||||
if ($oldEnd !== null && $oldEnd->format('H:i') === $end->format('H:i') && $timesheet->getId() !== null) {
|
||||
$seconds = $oldEnd->format('s') ?? 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,6 +92,8 @@ final class QuickEntryWeekType extends AbstractType
|
||||
};
|
||||
$builder->addEventListener(FormEvents::PRE_SUBMIT, $activityPreSubmitFunction);
|
||||
|
||||
$builder->add('metaFields', MetaFieldsCollectionType::class);
|
||||
|
||||
$builder->add('timesheets', CollectionType::class, [
|
||||
'entry_type' => QuickEntryTimesheetType::class,
|
||||
'label' => false,
|
||||
|
||||
Reference in New Issue
Block a user