[Export][List of accompanying periods] Add a list of persons, names and ids

This commit is contained in:
Julien Fastré 2024-01-22 12:46:20 +01:00
parent 0a2805f23f
commit 15a927a9f8
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
3 changed files with 31 additions and 1 deletions

View File

@ -0,0 +1,6 @@
kind: Feature
body: '[Export][List of accompanyign period] Add two columns: the list of persons
participating to the period, and their ids'
time: 2024-01-22T12:48:49.824833412+01:00
custom:
Issue: "241"

View File

@ -18,6 +18,7 @@ use Chill\MainBundle\Export\Helper\ExportAddressHelper;
use Chill\MainBundle\Export\Helper\UserHelper;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
use Chill\PersonBundle\Entity\Household\PersonHouseholdAddress;
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
use Chill\PersonBundle\Repository\PersonRepository;
@ -40,6 +41,8 @@ final readonly class ListAccompanyingPeriodHelper
'closingDate',
'referrer',
'referrerSince',
'acpParticipantPersons',
'acpParticipantPersonsIds',
'administrativeLocation',
'locationIsPerson',
'locationIsTemp',
@ -79,6 +82,7 @@ final readonly class ListAccompanyingPeriodHelper
private TranslatableStringHelperInterface $translatableStringHelper,
private TranslatorInterface $translator,
private UserHelper $userHelper,
private LabelPersonHelper $labelPersonHelper,
) {
}
@ -110,7 +114,20 @@ final readonly class ListAccompanyingPeriodHelper
return $this->translatableStringHelper->localize(json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR));
},
'acpCreatedBy', 'acpUpdatedBy', 'referrer' => $this->userHelper->getLabel($key, $values, 'export.list.acp.'.$key),
'acpParticipantsPersons' => function ($value) {
'acpParticipantPersons' => $this->labelPersonHelper->getLabelMulti($key, $values, 'export.list.acp.'.$key),
'acpParticipantPersonsIds' => function ($value) use ($key): string {
if ('_header' === $value) {
return 'export.list.acp.'.$key;
}
if (null === $value || '' === $value) {
return '';
}
$keys = json_decode((string) $value, true, 512, JSON_THROW_ON_ERROR);
return implode('|', $keys);
},
'locationPersonName', 'requestorPerson' => function ($value) use ($key) {
if ('_header' === $value) {
@ -224,6 +241,11 @@ final readonly class ListAccompanyingPeriodHelper
->addSelect(sprintf('%s_t.%s AS %s', $entity, $field, $entity));
}
// persons
$qb
->addSelect(sprintf('(SELECT AGGREGATE(IDENTITY(participant_persons_n.person)) FROM %s participant_persons_n WHERE participant_persons_n.accompanyingPeriod = acp) AS acpParticipantPersons', AccompanyingPeriodParticipation::class))
->addSelect(sprintf('(SELECT AGGREGATE(IDENTITY(participant_persons_ids.person)) FROM %s participant_persons_ids WHERE participant_persons_ids.accompanyingPeriod = acp) AS acpParticipantPersonsIds', AccompanyingPeriodParticipation::class));
// step at date
$qb
->addSelect('stepHistory.step AS step')

View File

@ -1296,6 +1296,8 @@ export:
socialIssues: Problématiques sociales
requestorPerson: Demandeur (personne)
requestorThirdParty: Demandeur (tiers)
acpParticipantPersons: Usagers concernés
acpParticipantPersonsIds: Usagers concernés (identifiants)
eval:
List of evaluations: Liste des évaluations