mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
[Household] when two adresses on same date, close the existing one
This commit is contained in:
parent
18cfe17878
commit
217b74b9e2
@ -11,6 +11,7 @@ and this project adheres to
|
|||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
<!-- write down unreleased development here -->
|
<!-- write down unreleased development here -->
|
||||||
|
* [household] do not allow to create two addresses on the same date
|
||||||
|
|
||||||
## Test releases
|
## Test releases
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ class Household
|
|||||||
public function addAddress(Address $address)
|
public function addAddress(Address $address)
|
||||||
{
|
{
|
||||||
foreach ($this->getAddresses() as $a) {
|
foreach ($this->getAddresses() as $a) {
|
||||||
if ($a->getValidFrom() < $address->getValidFrom() && $a->getValidTo() === null) {
|
if ($a->getValidFrom() <= $address->getValidFrom() && $a->getValidTo() === null) {
|
||||||
$a->setValidTo($address->getValidFrom());
|
$a->setValidTo($address->getValidFrom());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user