mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
Household/composition add + fixes household composition editor
This commit is contained in:
@@ -29,6 +29,8 @@ class MembersEditor
|
||||
{
|
||||
public const VALIDATION_GROUP_AFFECTED = 'household_memberships';
|
||||
|
||||
public const VALIDATION_GROUP_COMPOSITION = 'household_composition';
|
||||
|
||||
public const VALIDATION_GROUP_CREATED = 'household_memberships_created';
|
||||
|
||||
private ?Household $household = null;
|
||||
@@ -77,6 +79,15 @@ class MembersEditor
|
||||
$this->oldMembershipsHashes[] = spl_object_hash($participation);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($person->getHouseholdParticipationsNotShareHousehold() as $participation) {
|
||||
if ($participation->getHousehold() === $this->household
|
||||
&& $participation->getEndDate() === null || $participation->getEndDate() > $membership->getStartDate()
|
||||
&& $participation->getStartDate() <= $membership->getStartDate()
|
||||
) {
|
||||
$participation->setEndDate($membership->getStartDate());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->membershipsAffected[] = $membership;
|
||||
@@ -129,7 +140,7 @@ class MembersEditor
|
||||
{
|
||||
if ($this->hasHousehold()) {
|
||||
$list = $this->validator
|
||||
->validate($this->getHousehold(), null, [self::VALIDATION_GROUP_AFFECTED]);
|
||||
->validate($this->getHousehold(), null, [self::VALIDATION_GROUP_AFFECTED, self::VALIDATION_GROUP_COMPOSITION]);
|
||||
} else {
|
||||
$list = new ConstraintViolationList();
|
||||
}
|
||||
|
Reference in New Issue
Block a user