Export: add clauses on the social work start date and end date within the filter "Filter accompanying period by accompanying period work"'

This commit is contained in:
2023-11-15 13:23:05 +01:00
parent af6bee2497
commit e9df26c2f7
6 changed files with 147 additions and 26 deletions

View File

@@ -37,9 +37,13 @@ class RollingDateDataMapper implements DataMapperInterface
{
$forms = iterator_to_array($forms);
$viewData = new RollingDate(
$forms['roll']->getData() ?? RollingDate::T_TODAY,
$forms['fixedDate']->getData()
);
if (null === $forms['roll']->getData()) {
$viewData = null;
} else {
$viewData = new RollingDate(
$forms['roll']->getData(),
$forms['fixedDate']->getData()
);
}
}
}

View File

@@ -54,7 +54,7 @@ class PickRollingDateType extends AbstractType
{
$resolver->setDefaults([
'class' => RollingDate::class,
'empty_data' => new RollingDate(RollingDate::T_TODAY),
'empty_data' => null,
'constraints' => [
new Callback($this->validate(...)),
],
@@ -66,6 +66,10 @@ class PickRollingDateType extends AbstractType
public function validate($data, ExecutionContextInterface $context, $payload): void
{
if (null === $data) {
return;
}
/** @var RollingDate $data */
if (RollingDate::T_FIXED_DATE === $data->getRoll() && null === $data->getFixedDate()) {
$context