mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-03-04 13:09:42 +00:00
Fix export group by center for persons without a center in CenterAggregator.php
This commit is contained in:
6
.changes/unreleased/Fixed-20251230-125728.yaml
Normal file
6
.changes/unreleased/Fixed-20251230-125728.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
kind: Fixed
|
||||
body: Fix export group by center for persons without a center in CenterAggregator.php
|
||||
time: 2025-12-30T12:57:28.773521385+01:00
|
||||
custom:
|
||||
Issue: "477"
|
||||
SchemaChange: No schema change
|
||||
@@ -19,6 +19,7 @@ use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
final readonly class CenterAggregator implements AggregatorInterface
|
||||
{
|
||||
@@ -27,6 +28,7 @@ final readonly class CenterAggregator implements AggregatorInterface
|
||||
public function __construct(
|
||||
private CenterRepositoryInterface $centerRepository,
|
||||
private RollingDateConverterInterface $rollingDateConverter,
|
||||
private TranslatorInterface $translator,
|
||||
) {}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder): void
|
||||
@@ -62,7 +64,7 @@ final readonly class CenterAggregator implements AggregatorInterface
|
||||
{
|
||||
return function (int|string|null $value) {
|
||||
if (null === $value || '' === $value) {
|
||||
return '';
|
||||
return $this->translator->trans('person.export.aggregator.by_center.no_center');
|
||||
}
|
||||
|
||||
if ('_header' === $value) {
|
||||
@@ -94,15 +96,18 @@ final readonly class CenterAggregator implements AggregatorInterface
|
||||
$atDate = 'pers_center_agg_at_date';
|
||||
|
||||
$qb->leftJoin('person.centerHistory', $alias);
|
||||
$qb
|
||||
->andWhere(
|
||||
$qb->expr()->lte($alias.'.startDate', ':'.$atDate),
|
||||
)->andWhere(
|
||||
$qb->expr()->orX(
|
||||
$qb->expr()->isNull($alias.'.endDate'),
|
||||
$qb->expr()->gt($alias.'.endDate', ':'.$atDate)
|
||||
$qb->andWhere(
|
||||
$qb->expr()->orX(
|
||||
$qb->expr()->isNull($alias.'.id'),
|
||||
$qb->expr()->andX(
|
||||
$qb->expr()->lte($alias.'.startDate', ':'.$atDate),
|
||||
$qb->expr()->orX(
|
||||
$qb->expr()->isNull($alias.'.endDate'),
|
||||
$qb->expr()->gt($alias.'.endDate', ':'.$atDate)
|
||||
)
|
||||
)
|
||||
);
|
||||
)
|
||||
);
|
||||
$qb->setParameter($atDate, $this->rollingDateConverter->convert($data['at_date']));
|
||||
|
||||
$qb->addSelect("IDENTITY({$alias}.center) AS ".self::COLUMN_NAME);
|
||||
|
||||
@@ -103,6 +103,11 @@ Employment status: Situation professionelle
|
||||
Administrative status: Situation administrative
|
||||
|
||||
person:
|
||||
# trans key according to new conventions
|
||||
export:
|
||||
aggregator:
|
||||
by_center:
|
||||
no_center: Sans territoire
|
||||
Identifiers: Identifiants
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user