|
@@ -600,7 +600,10 @@ class OrganizationFactory
|
|
|
} else {
|
|
} else {
|
|
|
$person = new Person();
|
|
$person = new Person();
|
|
|
|
|
|
|
|
- if ($this->personRepository->findOneBy(['username' => $creationRequestData->getUsername()])) {
|
|
|
|
|
|
|
+ if (
|
|
|
|
|
+ $creationRequestData->getUsername() !== null &&
|
|
|
|
|
+ $this->personRepository->findOneBy(['username' => $creationRequestData->getUsername()])
|
|
|
|
|
+ ) {
|
|
|
throw new \RuntimeException('Username already in use : '.$creationRequestData->getUsername());
|
|
throw new \RuntimeException('Username already in use : '.$creationRequestData->getUsername());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -692,21 +695,29 @@ class OrganizationFactory
|
|
|
\DateTime $creationDate,
|
|
\DateTime $creationDate,
|
|
|
?int $authorId,
|
|
?int $authorId,
|
|
|
): ContactPoint {
|
|
): ContactPoint {
|
|
|
- if (!$this->phoneNumberUtil->isPossibleNumber($organizationMemberCreationRequest->getPhone())) {
|
|
|
|
|
|
|
+ if (
|
|
|
|
|
+ $organizationMemberCreationRequest->getPhone() !== null
|
|
|
|
|
+ && !$this->phoneNumberUtil->isPossibleNumber($organizationMemberCreationRequest->getPhone())
|
|
|
|
|
+ ) {
|
|
|
throw new \RuntimeException('Phone number is invalid or missing (person: '.$organizationMemberCreationRequest->getUsername().')');
|
|
throw new \RuntimeException('Phone number is invalid or missing (person: '.$organizationMemberCreationRequest->getUsername().')');
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
if (
|
|
if (
|
|
|
$organizationMemberCreationRequest->getMobile() !== null
|
|
$organizationMemberCreationRequest->getMobile() !== null
|
|
|
&& !$this->phoneNumberUtil->isPossibleNumber($organizationMemberCreationRequest->getMobile())) {
|
|
&& !$this->phoneNumberUtil->isPossibleNumber($organizationMemberCreationRequest->getMobile())) {
|
|
|
throw new \RuntimeException('Mobile phone number is invalid (person: '.$organizationMemberCreationRequest->getUsername().')');
|
|
throw new \RuntimeException('Mobile phone number is invalid (person: '.$organizationMemberCreationRequest->getUsername().')');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- $phoneNumber = $this->phoneNumberUtil->parse($organizationMemberCreationRequest->getPhone());
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
$contactPoint = new ContactPoint();
|
|
$contactPoint = new ContactPoint();
|
|
|
$contactPoint->setContactType(ContactPointTypeEnum::PRINCIPAL);
|
|
$contactPoint->setContactType(ContactPointTypeEnum::PRINCIPAL);
|
|
|
$contactPoint->setEmail($organizationMemberCreationRequest->getEmail());
|
|
$contactPoint->setEmail($organizationMemberCreationRequest->getEmail());
|
|
|
- $contactPoint->setTelphone($phoneNumber);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if ($organizationMemberCreationRequest->getPhone() !== null) {
|
|
|
|
|
+ $phoneNumber = $this->phoneNumberUtil->parse($organizationMemberCreationRequest->getPhone());
|
|
|
|
|
+ $contactPoint->setTelphone($phoneNumber);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
if ($organizationMemberCreationRequest->getMobile() !== null) {
|
|
if ($organizationMemberCreationRequest->getMobile() !== null) {
|
|
|
$mobileNumber = $this->phoneNumberUtil->parse($organizationMemberCreationRequest->getMobile());
|
|
$mobileNumber = $this->phoneNumberUtil->parse($organizationMemberCreationRequest->getMobile());
|