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

This commit is contained in:
2024-01-22 12:46:20 +01:00
parent 0a2805f23f
commit 15a927a9f8
3 changed files with 31 additions and 1 deletions

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