Merge branch 'master' into household_filiation

This commit is contained in:
2021-11-12 17:20:46 +01:00
298 changed files with 8036 additions and 3185 deletions

View File

@@ -34,6 +34,7 @@ use Chill\PersonBundle\Entity\MaritalStatus;
use Chill\PersonBundle\Entity\Household\HouseholdMember;
use Chill\MainBundle\Entity\HasCenterInterface;
use Chill\MainBundle\Entity\Address;
use Chill\MainBundle\Entity\Civility;
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
use Chill\PersonBundle\Entity\Person\PersonCurrentAddress;
use DateTime;
@@ -212,6 +213,15 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
*/
private $maritalStatus;
/**
* The marital status of the person
* @var Civility
*
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Civility")
* @ORM\JoinColumn(nullable=true)
*/
private $civility;
/**
* The date of the last marital status change of the person
* @var \DateTime
@@ -406,7 +416,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
* Array where customfield's data are stored
* @var array
*
* @ORM\Column(type="json_array")
* @ORM\Column(type="json")
*/
private $cFData;
@@ -620,7 +630,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
{
$currentAccompanyingPeriods = [];
$currentDate = new DateTime();
foreach ($this->accompanyingPeriodParticipations as $participation)
{
$endDate = $participation->getEndDate();
@@ -988,6 +998,28 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
return $this->maritalStatus;
}
/**
* Set civility
*
* @param Civility $civility
* @return Person
*/
public function setCivility(Civility $civility = null)
{
$this->civility = $civility;
return $this;
}
/**
* Get civility
*
* @return Civility
*/
public function getCivility()
{
return $this->civility;
}
/**
* Set contactInfo
*
@@ -1309,11 +1341,14 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
/**
* get the address associated with the person at the given date
*
* If the `$at` parameter is now, use the method `getCurrentPersonAddress`, which is optimized
* on database side.
*
* @param DateTime|null $at
* @return Address|null
* @throws \Exception
*/
public function getCurrentPersonAddress(?\DateTime $at = null): ?Address
public function getAddressAt(?\DateTime $at = null): ?Address
{
$at ??= new DateTime('now');
@@ -1331,6 +1366,20 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
current($addresses);
}
/**
* Get the current person address
*
* @return Address|null
*/
public function getCurrentPersonAddress(): ?Address
{
if (null === $this->currentPersonAddress) {
return null;
}
return $this->currentPersonAddress->getAddress();
}
/**
* Validation callback that checks if the accompanying periods are valid
*