mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 02:23:51 +00:00
PersonAddressMove: fix tests, address history on household, and household::getMembersOnRange
This commit is contained in:
@@ -168,4 +168,42 @@ class PersonAddressMoveEvent extends Event
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Will the change affect this date ?
|
||||
*/
|
||||
public function willChangeBeActiveAt(DateTimeImmutable $date): bool
|
||||
{
|
||||
if ($this->getMoveDate() < $date && $this->personLeaveWithoutHousehold()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->personChangeHousehold()) {
|
||||
if ($this->getMoveDate() > $date) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (null === $this->getNextMembership()->getEndDate()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->getNextMembership()->getEndDate() > $date) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if ($this->getNextAddress()->getValidFrom() > $date) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (null === $this->getNextAddress()->getValidTo()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->getNextAddress()->getValidTo() > $date) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user