diff --git a/.changes/unreleased/Fixed-20240526-220837.yaml b/.changes/unreleased/Fixed-20240526-220837.yaml new file mode 100644 index 000000000..ffe35eeda --- /dev/null +++ b/.changes/unreleased/Fixed-20240526-220837.yaml @@ -0,0 +1,6 @@ +kind: Fixed +body: Display agents traitants instead of accompanying period referrer in export list + social actions. +time: 2024-05-26T22:08:37.281237634+02:00 +custom: + Issue: "170" diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod.php index 6ebfa1bec..eb9f1c525 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeriod.php @@ -54,7 +54,6 @@ final readonly class ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeri 'socialAction', 'socialIssue', 'acp_id', - 'acp_user', 'startDate', 'endDate', 'goalsId', @@ -70,8 +69,8 @@ final readonly class ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeri 'personsName', 'thirdParties', 'handlingThierParty', - // 'acpwReferrers', - 'referrers', + 'acpwReferrers', + 'referrer', 'createdAt', 'createdBy', 'updatedAt', @@ -157,9 +156,9 @@ final readonly class ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeri [] ); }, - 'createdBy', 'updatedBy', 'acp_user' => $this->userHelper->getLabel($key, $values, 'export.list.acpw.'.$key), - 'referrers' => $this->userHelper->getLabel($key, $values, 'export.list.acpw.'.$key), - // 'acpwReferrers' => $this->userHelper->getLabelMulti($key, $values, 'export.list.acpw.' . $key), + 'createdBy', 'updatedBy' => $this->userHelper->getLabel($key, $values, 'export.list.acpw.'.$key), + 'referrer' => $this->userHelper->getLabel($key, $values, 'export.list.acpw.'.$key), + 'acpwReferrers' => $this->userHelper->getLabelMulti($key, $values, 'export.list.acpw.'.$key), 'personsName' => $this->personHelper->getLabelMulti($key, $values, 'export.list.acpw.'.$key), 'handlingThierParty' => $this->thirdPartyHelper->getLabel($key, $values, 'export.list.acpw.'.$key), 'thirdParties' => $this->thirdPartyHelper->getLabelMulti($key, $values, 'export.list.acpw.'.$key), @@ -273,8 +272,7 @@ final readonly class ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeri // join acp $qb - ->addSelect('acp.id AS acp_id') - ->addSelect('IDENTITY(acp.user) AS acp_user'); + ->addSelect('acp.id AS acp_id'); // persons $qb @@ -283,21 +281,18 @@ final readonly class ListAccompanyingPeriodWorkAssociatePersonOnAccompanyingPeri ->addSelect('(SELECT AGGREGATE(person1_acpw_member.id) FROM '.Person::class.' person1_acpw_member ' .'WHERE person1_acpw_member MEMBER OF acpw.persons) AS personsName'); - // referrers => at date XXXX - $qb - ->addSelect('(SELECT JSON_BUILD_OBJECT(\'uid\', IDENTITY(history.user), \'d\', history.startDate) FROM '.UserHistory::class.' history '. - 'WHERE history.accompanyingPeriod = acp AND history.startDate <= :calcDate AND (history.endDate IS NULL OR history.endDate > :calcDate)) AS referrers'); - - /* - // acpwReferrers at date XXX + // referrer => at date XXXX $qb ->addSelect('( - SELECT IDENTITY(acpw_ref_history.accompanyingPeriodWork) AS acpw_ref_history_id, - JSON_BUILD_OBJECT(\'uid\', IDENTITY(acpw_ref_history.user), \'d\', acpw_ref_history.startDate) - FROM ' . AccompanyingPeriodWorkReferrerHistory::class . ' acpw_ref_history ' . - 'WHERE acpw_ref_history.accompanyingPeriodWork = acpw AND acpw_ref_history.startDate <= :calcDate AND (acpw_ref_history.endDate IS NULL or acpw_ref_history.endDate > :calcDate) GROUP BY acpw_ref_history_id) AS acpwReferrers' - ); - */ + SELECT JSON_BUILD_OBJECT(\'uid\', IDENTITY(history.user), \'d\', history.startDate) FROM '.UserHistory::class.' history '. + 'WHERE history.accompanyingPeriod = acp AND history.startDate <= :calcDate AND (history.endDate IS NULL OR history.endDate > :calcDate)) AS referrer'); + + // acpwReferrer at date XXX + $qb->addSelect('(SELECT AGGREGATE(IDENTITY(acpwrh.user)) FROM '.AccompanyingPeriodWorkReferrerHistory::class.' acpwrh + WHERE acpwrh.accompanyingPeriodWork = acpw + AND acpwrh.startDate <= :calcDate AND (acpwrh.endDate IS NULL or acpwrh.endDate > :calcDate) + ) AS acpwReferrers'); + $qb->setParameter('calcDate', $calcDate); // thirdparties $qb diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnWork.php b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnWork.php index f55f254b8..d05e22af3 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnWork.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingPeriodWorkAssociatePersonOnWork.php @@ -54,7 +54,6 @@ final readonly class ListAccompanyingPeriodWorkAssociatePersonOnWork implements 'socialAction', 'socialIssue', 'acp_id', - 'acp_user', 'startDate', 'endDate', 'goalsId', @@ -70,8 +69,8 @@ final readonly class ListAccompanyingPeriodWorkAssociatePersonOnWork implements 'personsName', 'thirdParties', 'handlingThierParty', - // 'acpwReferrers', - 'referrers', + 'acpwReferrers', + 'referrer', 'createdAt', 'createdBy', 'updatedAt', @@ -157,9 +156,9 @@ final readonly class ListAccompanyingPeriodWorkAssociatePersonOnWork implements [] ); }, - 'createdBy', 'updatedBy', 'acp_user' => $this->userHelper->getLabel($key, $values, 'export.list.acpw.'.$key), - 'referrers' => $this->userHelper->getLabel($key, $values, 'export.list.acpw.'.$key), - // 'acpwReferrers' => $this->userHelper->getLabelMulti($key, $values, 'export.list.acpw.' . $key), + 'createdBy', 'updatedBy' => $this->userHelper->getLabel($key, $values, 'export.list.acpw.'.$key), + 'referrer' => $this->userHelper->getLabel($key, $values, 'export.list.acpw.'.$key), + 'acpwReferrers' => $this->userHelper->getLabelMulti($key, $values, 'export.list.acpw.'.$key), 'personsName' => $this->personHelper->getLabelMulti($key, $values, 'export.list.acpw.'.$key), 'handlingThierParty' => $this->thirdPartyHelper->getLabel($key, $values, 'export.list.acpw.'.$key), 'thirdParties' => $this->thirdPartyHelper->getLabelMulti($key, $values, 'export.list.acpw.'.$key), @@ -268,8 +267,7 @@ final readonly class ListAccompanyingPeriodWorkAssociatePersonOnWork implements // join acp $qb - ->addSelect('acp.id AS acp_id') - ->addSelect('IDENTITY(acp.user) AS acp_user'); + ->addSelect('acp.id AS acp_id'); // persons $qb @@ -278,21 +276,17 @@ final readonly class ListAccompanyingPeriodWorkAssociatePersonOnWork implements ->addSelect('(SELECT AGGREGATE(person1_acpw_member.id) FROM '.Person::class.' person1_acpw_member ' .'WHERE person1_acpw_member MEMBER OF acpw.persons) AS personsName'); - // referrers => at date XXXX + // referrer => at date XXXX $qb ->addSelect('(SELECT JSON_BUILD_OBJECT(\'uid\', IDENTITY(history.user), \'d\', history.startDate) FROM '.UserHistory::class.' history '. - 'WHERE history.accompanyingPeriod = acp AND history.startDate <= :calcDate AND (history.endDate IS NULL OR history.endDate > :calcDate)) AS referrers'); + 'WHERE history.accompanyingPeriod = acp AND history.startDate <= :calcDate AND (history.endDate IS NULL OR history.endDate > :calcDate)) AS referrer'); - /* // acpwReferrers at date XXX - $qb - ->addSelect('( - SELECT IDENTITY(acpw_ref_history.accompanyingPeriodWork) AS acpw_ref_history_id, - JSON_BUILD_OBJECT(\'uid\', IDENTITY(acpw_ref_history.user), \'d\', acpw_ref_history.startDate) - FROM ' . AccompanyingPeriodWorkReferrerHistory::class . ' acpw_ref_history ' . - 'WHERE acpw_ref_history.accompanyingPeriodWork = acpw AND acpw_ref_history.startDate <= :calcDate AND (acpw_ref_history.endDate IS NULL or acpw_ref_history.endDate > :calcDate) GROUP BY acpw_ref_history_id) AS acpwReferrers' - ); - */ + $qb->addSelect('(SELECT AGGREGATE(IDENTITY(acpwrh.user)) FROM '.AccompanyingPeriodWorkReferrerHistory::class.' acpwrh + WHERE acpwrh.accompanyingPeriodWork = acpw + AND acpwrh.startDate <= :calcDate AND (acpwrh.endDate IS NULL or acpwrh.endDate > :calcDate) + ) AS acpwReferrers'); + $qb->setParameter('calcDate', $calcDate); // thirdparties $qb diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 013298ba5..fbd33dfd2 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -1405,7 +1405,8 @@ export: updatedBy: Modifié par acp_id: Identifiant du parcours acp_user: Référent du parcours - referrers: Agents traitants + acpwReferrers: Agents traitants + referrer: Référent du parcours personsId: Identifiants des usagers personsName: Usagers de l'action goalsId: Identifiants des objectifs