Commit 2f03f925 authored by Julien Minet's avatar Julien Minet

add mobilenumber + validation on email and phonenumber (regex)

parent db00a0d2
Pipeline #52081 failed with stages
in 1 minute and 33 seconds
...@@ -72,6 +72,9 @@ class Person implements HasCenterInterface { ...@@ -72,6 +72,9 @@ class Person implements HasCenterInterface {
/** @var string The person's phonenumber */ /** @var string The person's phonenumber */
private $phonenumber = ''; private $phonenumber = '';
/** @var string The person's mobile phone number */
private $mobilenumber = '';
//TO-ADD : caseOpeningDate //TO-ADD : caseOpeningDate
//TO-ADD nativeLanguag //TO-ADD nativeLanguag
...@@ -603,6 +606,29 @@ class Person implements HasCenterInterface { ...@@ -603,6 +606,29 @@ class Person implements HasCenterInterface {
return $this->phonenumber; return $this->phonenumber;
} }
/**
* Set mobilenumber
*
* @param string $mobilenumber
* @return Person
*/
public function setMobilenumber($mobilenumber = '')
{
$this->mobilenumber = $mobilenumber;
return $this;
}
/**
* Get mobilenumber
*
* @return string
*/
public function getMobilenumber()
{
return $this->mobilenumber;
}
public function __toString() public function __toString()
{ {
return $this->getLabel(); return $this->getLabel();
......
...@@ -27,6 +27,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; ...@@ -27,6 +27,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\DateType; use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Chill\PersonBundle\Form\Type\GenderType; use Chill\PersonBundle\Form\Type\GenderType;
use Chill\MainBundle\Form\Type\Select2CountryType; use Chill\MainBundle\Form\Type\Select2CountryType;
...@@ -80,7 +81,7 @@ class PersonType extends AbstractType ...@@ -80,7 +81,7 @@ class PersonType extends AbstractType
} }
if ($this->config['email'] === 'visible') { if ($this->config['email'] === 'visible') {
$builder->add('email', TextareaType::class, array('required' => false)); $builder->add('email', EmailType::class, array('required' => false));
} }
if ($this->config['country_of_birth'] === 'visible') { if ($this->config['country_of_birth'] === 'visible') {
......
...@@ -30,6 +30,17 @@ Chill\PersonBundle\Entity\Person: ...@@ -30,6 +30,17 @@ Chill\PersonBundle\Entity\Person:
accompanyingPeriods: accompanyingPeriods:
- Valid: - Valid:
traverse: true traverse: true
email:
- Email:
groups: [general, creation]
message: 'The email "{{ value }}" is not a valid email.'
phonenumber:
- Regex:
pattern: '/^([\+{1}]|[0])([0-9\s*]{4,20})$/'
groups: [general, creation]
message: 'Invalid phone number: it should begin with "0" or "+", hold only digits and be smaller than 20 characters '
constraints: constraints:
- Callback: - Callback:
callback: isAccompanyingPeriodValid callback: isAccompanyingPeriodValid
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment