[Household members editor] add address suggestion on menage creation

This commit is contained in:
2021-08-16 19:07:03 +02:00
parent 25465b1121
commit 5a716a3523
7 changed files with 568 additions and 14 deletions

View File

@@ -99,6 +99,22 @@ class Household
return $this;
}
/**
* Force an address starting at the current day
* on the Household.
*
* This will force the startDate's address on today.
*
* Used on household creation.
*
* @Serializer\Groups({"create"})
*/
public function setForceAddress(Address $address)
{
$address->setValidFrom(new \DateTime('today'));
$this->addAddress($address);
}
/**
* @param Address $address
*/
@@ -128,7 +144,7 @@ class Household
$at = $at === null ? new \DateTime('today') : $at;
$addrs = $this->getAddresses()->filter(function (Address $a) use ($at) {
return $a->getValidFrom() < $at && (
return $a->getValidFrom() <= $at && (
NULL === $a->getValidTo() || $at < $a->getValidTo()
);
});