Compare commits

...

8 Commits

Author SHA1 Message Date
51d97fa3f9 Add changie 2025-12-30 16:43:13 +01:00
98af0d9bbf Add translations 2025-12-30 16:41:50 +01:00
835d1a2638 Create ReferrerMainCenterFilter and ReferrerMainCenterAggregator 2025-12-30 16:41:41 +01:00
47b285b584 Fix export group by center for persons without a center in CenterAggregator.php 2025-12-30 13:01:56 +01:00
7c9b4d02f6 Fix ordering of social actions
Actions with a closing date in the future should be considered as 'still open'.
2025-12-18 11:08:18 +01:00
3ff9bba4de Fix the condition to display concerned persons in calendar list items. 2025-12-18 10:24:24 +01:00
c0f9e953fb Update to v4.11.0 2025-12-17 16:56:35 +01:00
a49ea2b6b9 Fix translation syntax
Cannot start with %, wrap translation value in double quotes
2025-12-17 16:54:33 +01:00
17 changed files with 375 additions and 34 deletions

View File

@@ -1,6 +0,0 @@
kind: Feature
body: 'Add filtering to admin lists: social actions, social issues, goals, results, and evaluations'
time: 2025-12-10T03:20:45.135973502+01:00
custom:
Issue: "478"
SchemaChange: No schema change

View File

@@ -0,0 +1,6 @@
kind: Feature
body: Add filter and aggregator based on referrer's main center for exports of accompanying period
time: 2025-12-30T16:43:03.898677616+01:00
custom:
Issue: "486"
SchemaChange: No schema change

View File

@@ -1,7 +0,0 @@
kind: Fixed
body: |
Fix migration query after previous fix
time: 2025-12-11T21:49:08.899926492+01:00
custom:
Issue: "466"
SchemaChange: No schema change

View File

@@ -0,0 +1,6 @@
kind: Fixed
body: Fix the condition to display concerned persons in calendar list items.
time: 2025-12-18T10:24:05.885090777+01:00
custom:
Issue: "480"
SchemaChange: No schema change

View File

@@ -0,0 +1,6 @@
kind: Fixed
body: 'Fix ordering of social actions: actions with a closing date in the future should be considered as ''still open''.'
time: 2025-12-18T11:07:22.699897317+01:00
custom:
Issue: "481"
SchemaChange: No schema change

View 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

9
.changes/v4.11.0.md Normal file
View File

@@ -0,0 +1,9 @@
## v4.11.0 - 2025-12-17
### Feature
* ([#478](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/478)) Add filtering to admin lists: social actions, social issues, goals, results, and evaluations
### Fixed
* ([#466](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/466)) Fix migration query after previous fix
* Fix translation key/value
Cannot start with % and should be wrapped in "".

View File

@@ -6,6 +6,16 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).
## v4.11.0 - 2025-12-17
### Feature
* ([#478](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/478)) Add filtering to admin lists: social actions, social issues, goals, results, and evaluations
### Fixed
* ([#466](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/466)) Fix migration query after previous fix
* Fix translation key/value
Cannot start with % and should be wrapped in "".
## v4.10.1 - 2025-12-11
### Fixed
* Fix missing translation variable in NewLocation component

View File

@@ -75,7 +75,7 @@
</div>
{% if calendar.comment.comment is not empty
or calendar.users|length > 0
or calendar.persons|length > 0
or calendar.thirdParties|length > 0
or calendar.users|length > 0 %}
<div class="item-row details separator">

View File

@@ -189,14 +189,14 @@ crud:
title_edit: Rapport "belemmering" bewerken
title_delete: Belemmering verwijderen
button_delete: Verwijderen
confirm_message_delete: %as_string% verwijderen?
confirm_message_delete: "%as_string% verwijderen?"
cscv:
title_new: Nieuw CV voor %person%
title_view: CV voor %person%
title_edit: CV bewerken
title_delete: CV verwijderen
button_delete: Verwijderen
confirm_message_delete: %as_string% verwijderen?
confirm_message_delete: "%as_string% verwijderen?"
no_date: Geen datum aangegeven
no_end_date: einddatum onbekend
no_start_date: startdatum onbekend
@@ -206,7 +206,7 @@ crud:
title_edit: Immersie bewerken
title_delete: Immersie verwijderen
button_delete: Verwijderen
confirm_message_delete: %as_string% verwijderen?
confirm_message_delete: "%as_string% verwijderen?"
projet_prof:
title_new: Nieuw professioneel project voor %person%
title_view: Professioneel project voor %person%

View File

@@ -1,3 +1,7 @@
common:
after: Après
until: Jusqu'à
centers: Territoires
"This program is free software: you can redistribute it and/or modify it under the terms of the <strong>GNU Affero General Public License</strong>": "Ce programme est un logiciel libre: vous pouvez le redistribuer et/ou le modifier selon les termes de la licence <strong>GNU Affero GPL</strong>"
User manual: Manuel d'utilisation
Search: Rechercher

View File

@@ -0,0 +1,143 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators;
use Chill\MainBundle\Export\AggregatorInterface;
use Chill\MainBundle\Export\DataTransformerInterface;
use Chill\MainBundle\Form\Type\PickRollingDateType;
use Chill\MainBundle\Repository\CenterRepositoryInterface;
use Chill\MainBundle\Service\RollingDate\RollingDate;
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
use Chill\PersonBundle\Export\Declarations;
use Doctrine\ORM\Query\Expr\Join;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
final readonly class ReferrerMainCenterAggregator implements AggregatorInterface, DataTransformerInterface
{
private const P = 'acp_agg_referrer_main_center';
public function __construct(
private CenterRepositoryInterface $centerRepository,
private RollingDateConverterInterface $rollingDateConverter,
) {}
public function addRole(): ?string
{
return null;
}
public function alterQuery(QueryBuilder $qb, $data, \Chill\MainBundle\Export\ExportGenerationContext $exportGenerationContext): void
{
$p = self::P;
$qb
->leftJoin('acp.userHistories', "{$p}_uh", Join::WITH, $qb->expr()->andX(
$qb->expr()->eq("{$p}_uh.accompanyingPeriod", 'acp.id'),
"OVERLAPSI (acp.openingDate, acp.closingDate), ({$p}_uh.startDate, {$p}_uh.endDate) = TRUE",
"OVERLAPSI (:{$p}_startDate, :{$p}_endDate), ({$p}_uh.startDate, {$p}_uh.endDate) = TRUE"
))
->leftJoin("{$p}_uh.user", "{$p}_user")
->addSelect("IDENTITY({$p}_user.mainCenter) AS {$p}_select")
->addGroupBy("{$p}_select")
->setParameter("{$p}_startDate", $this->rollingDateConverter->convert($data['start_date']))
->setParameter("{$p}_endDate", $this->rollingDateConverter->convert($data['end_date']));
}
public function applyOn(): string
{
return Declarations::ACP_TYPE;
}
public function buildForm(FormBuilderInterface $builder): void
{
$builder
->add('start_date', PickRollingDateType::class, [
'label' => 'common.after',
'required' => true,
])
->add('end_date', PickRollingDateType::class, [
'label' => 'common.until',
'required' => true,
]);
}
public function getNormalizationVersion(): int
{
return 1;
}
public function normalizeFormData(array $formData): array
{
return [
'start_date' => $formData['start_date']->normalize(),
'end_date' => $formData['end_date']->normalize(),
];
}
public function denormalizeFormData(array $formData, int $fromVersion): array
{
$default = $this->getFormDefaultData();
return [
'start_date' => array_key_exists('start_date', $formData) ? RollingDate::fromNormalized($formData['start_date']) : $default['start_date'],
'end_date' => array_key_exists('end_date', $formData) ? RollingDate::fromNormalized($formData['end_date']) : $default['end_date'],
];
}
public function getFormDefaultData(): array
{
return [
'start_date' => new RollingDate(RollingDate::T_YEAR_CURRENT_START),
'end_date' => new RollingDate(RollingDate::T_TODAY),
];
}
public function transformData(?array $before): array
{
$default = $this->getFormDefaultData();
if (null === $before) {
return $default;
}
return [
'start_date' => $before['start_date'] ?? $before['date_calc'] ?? $default['start_date'],
'end_date' => $before['end_date'] ?? $before['date_calc'] ?? $default['end_date'],
];
}
public function getLabels($key, array $values, $data): callable
{
return function ($value): string {
if ('_header' === $value) {
return 'person.export.period.aggregator.by_referrer_main_center.column_header';
}
if (null === $value || '' === $value) {
return '';
}
return (string) $this->centerRepository->find((int) $value)?->getName();
};
}
public function getQueryKeys($data): array
{
return [self::P.'_select'];
}
public function getTitle(): string
{
return 'person.export.period.aggregator.by_referrer_main_center.title';
}
}

View File

@@ -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.period.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);

View File

@@ -0,0 +1,134 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Export\ExportGenerationContext;
use Chill\MainBundle\Export\FilterInterface;
use Chill\MainBundle\Form\Type\PickRollingDateType;
use Chill\MainBundle\Repository\CenterRepositoryInterface;
use Chill\MainBundle\Service\RollingDate\RollingDate;
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
use Chill\PersonBundle\Export\Declarations;
use Doctrine\ORM\QueryBuilder;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\FormBuilderInterface;
/**
* Filter accompanying periods by the main center of their referrer (at a given date).
*/
final readonly class ReferrerMainCenterFilter implements FilterInterface
{
private const UH = 'acp_referrer_main_center_filter_uh';
private const DATE_PARAM = 'acp_referrer_main_center_filter_date';
public function __construct(
private RollingDateConverterInterface $rollingDateConverter,
private CenterRepositoryInterface $centerRepository,
) {}
public function addRole(): ?string
{
return null;
}
public function alterQuery(QueryBuilder $qb, $data, ExportGenerationContext $exportGenerationContext): void
{
$qb
->join('acp.userHistories', self::UH)
->join(self::UH.'.user', self::UH.'_user')
->andWhere(
$qb->expr()->andX(
$qb->expr()->lte(self::UH.'.startDate', ':'.self::DATE_PARAM),
$qb->expr()->orX(
$qb->expr()->isNull(self::UH.'.endDate'),
$qb->expr()->gt(self::UH.'.endDate', ':'.self::DATE_PARAM)
)
)
)
->andWhere('IDENTITY('.self::UH.'_user.mainCenter) IN (:acp_referrer_main_center_filter_centers)')
->setParameter(self::DATE_PARAM, $this->rollingDateConverter->convert($data['date_calc']))
->setParameter('acp_referrer_main_center_filter_centers', array_map(
static fn (Center $c): int => $c->getId(),
$data['centers']
));
}
public function applyOn(): string
{
return Declarations::ACP_TYPE;
}
public function buildForm(FormBuilderInterface $builder): void
{
$builder
->add('centers', EntityType::class, [
'class' => Center::class,
'multiple' => true,
'expanded' => false,
'choice_label' => static fn (Center $c) => $c->getName(),
'required' => true,
'label' => 'common.centers',
])
->add('date_calc', PickRollingDateType::class, [
'label' => 'person.export.period.filter.by_referrer_main_center.referrer_since',
'required' => true,
]);
}
public function getNormalizationVersion(): int
{
return 1;
}
public function normalizeFormData(array $formData): array
{
return [
'centers' => array_values(array_map(static fn (Center $c) => $c->getId(), $formData['centers'])),
'date_calc' => $formData['date_calc']->normalize(),
];
}
public function denormalizeFormData(array $formData, int $fromVersion): array
{
return [
'centers' => array_values(array_filter(array_map(
fn (int $id) => $this->centerRepository->find($id),
$formData['centers'] ?? []
))),
'date_calc' => RollingDate::fromNormalized($formData['date_calc']),
];
}
public function getFormDefaultData(): array
{
return [
'centers' => [],
'date_calc' => new RollingDate(RollingDate::T_TODAY),
];
}
public function describeAction($data, ExportGenerationContext $context): array|string
{
$names = array_map(static fn (Center $c) => $c->getName(), $data['centers']);
return [
'person.export.period.filter.by_referrer_main_center.action_%centers%',
['%centers%' => implode(', ', $names)],
];
}
public function getTitle(): string
{
return 'person.export.period.filter.by_referrer_main_center.title';
}
}

View File

@@ -100,9 +100,9 @@ class AccompanyingPeriodWorkRepository implements ObjectRepository
$rsm->addRootEntityFromClassMetadata(AccompanyingPeriodWork::class, 'w');
$sql = "SELECT {$rsm} FROM chill_person_accompanying_period_work w
LEFT JOIN chill_person_accompanying_period_work_referrer AS rw ON accompanyingperiodwork_id = w.id
AND (rw.enddate IS NULL OR rw.enddate > CURRENT_DATE)
WHERE accompanyingPeriod_id = :periodId";
LEFT JOIN chill_person_accompanying_period_work_referrer AS rw ON accompanyingperiodwork_id = w.id
AND (rw.enddate IS NULL OR rw.enddate > CURRENT_DATE)
WHERE accompanyingPeriod_id = :periodId";
// implement filters
@@ -136,11 +136,14 @@ class AccompanyingPeriodWorkRepository implements ObjectRepository
}
// set limit and offset
$sql .= " ORDER BY
CASE WHEN w.enddate IS NULL THEN '-infinity'::timestamp ELSE 'infinity'::timestamp END ASC,
w.startdate DESC,
w.enddate DESC,
w.id DESC";
$sql .= ' ORDER BY
CASE
WHEN w.enddate IS NULL OR w.enddate > CURRENT_DATE THEN 0
ELSE 1
END ASC,
w.startdate DESC,
w.enddate DESC,
w.id DESC';
$sql .= ' LIMIT :limit OFFSET :offset';

View File

@@ -104,6 +104,10 @@ services:
tags:
- { name: chill.export_filter, alias: accompanyingcourse_referrer_filter_between_dates }
Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\ReferrerMainCenterFilter:
tags:
- { name: chill.export_filter, alias: accompanyingcourse_referrer_main_center_filter }
chill.person.export.filter_openbetweendates:
class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\OpenBetweenDatesFilter
tags:
@@ -270,3 +274,7 @@ services:
Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\PersonParticipatingAggregator:
tags:
- { name: chill.export_aggregator, alias: accompanyingcourse_person_part_aggregator }
Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\ReferrerMainCenterAggregator:
tags:
- { name: chill.export_aggregator, alias: accompanyingcourse_referrer_main_center_aggregator }

View File

@@ -103,6 +103,20 @@ Employment status: Situation professionelle
Administrative status: Situation administrative
person:
# trans key according to new conventions
export:
period:
aggregator:
by_center:
no_center: Sans territoire
by_referrer_main_center:
title: Grouper par territoire du référent
column_header: Territoire du référent
filter:
by_referrer_main_center:
title: Filtrer par territoire du référent
action_%centers%: 'Filtrer par territoire du référent : uniquement %centers%'
referrer_since: Référent depuis le
Identifiers: Identifiants