mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
[Household members editor] add address suggestion on menage creation
This commit is contained in:
@@ -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()
|
||||
);
|
||||
});
|
||||
|
Reference in New Issue
Block a user