diff --git a/CHANGELOG.md b/CHANGELOG.md index 2448611f2..15d07a076 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to ## Unreleased +* [person] order accompanying period by opening date in search persons, person and household period lists (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/493) * [parcours] autosave of the pinned comment for draft accompanying course (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/477) * [main] filter user job in undispatch acc period to assign (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/472) * [main] filter user job in undispatch acc period to assign (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/472) @@ -42,6 +43,7 @@ and this project adheres to * [phonenumber] Remove placeholder in phonenumber field (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/496) * [contact] add contact button color changed plus the pipe at the side removed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/506) * [blur] Improved positioning of toggle icon (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/486) + ## Test releases ### test release 2022-02-21 diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php index bb0081c27..c34702ad1 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodController.php @@ -222,6 +222,10 @@ class AccompanyingPeriodController extends AbstractController $accompanyingPeriodsRaw = $this->accompanyingPeriodACLAwareRepository ->findByPerson($person, AccompanyingPeriodVoter::SEE); + usort($accompanyingPeriodsRaw, static function ($a, $b) { + return $b->getOpeningDate() > $a->getOpeningDate(); + }); + // filter visible or not visible $accompanyingPeriods = array_filter($accompanyingPeriodsRaw, function (AccompanyingPeriod $ap) { return $this->isGranted(AccompanyingPeriodVoter::SEE, $ap); diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php index 07fa34b5a..0a8b7eea1 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php @@ -78,6 +78,10 @@ class HouseholdController extends AbstractController } } + usort($accompanyingPeriods, static function ($a, $b) { + return $b->getOpeningDate() > $a->getOpeningDate(); + }); + $oldMembers = $household->getNonCurrentMembers(); $accompanyingPeriodsOld = []; diff --git a/src/Bundle/ChillPersonBundle/Entity/Person.php b/src/Bundle/ChillPersonBundle/Entity/Person.php index fab4b2845..7297754bd 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person.php @@ -109,6 +109,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI * @ORM\OneToMany(targetEntity=AccompanyingPeriodParticipation::class, * mappedBy="person", * cascade={"persist", "remove", "merge", "detach"}) + * @ORM\OrderBy({"startDate" = "DESC"}) */ private $accompanyingPeriodParticipations;