mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
Merge remote-tracking branch 'origin/master' into issue439_residential_address_otf
This commit is contained in:
@@ -13,17 +13,18 @@ namespace Chill\PersonBundle\Form;
|
||||
|
||||
use Chill\MainBundle\Form\Event\CustomizeFormEvent;
|
||||
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||
use Chill\MainBundle\Form\Type\ChillPhoneNumberType;
|
||||
use Chill\MainBundle\Form\Type\PickCenterType;
|
||||
use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Form\Type\GenderType;
|
||||
use Chill\PersonBundle\Form\Type\PersonAltNameType;
|
||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use libphonenumber\PhoneNumberType;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TelType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
@@ -60,11 +61,13 @@ final class CreationPersonType extends AbstractType
|
||||
->add('birthdate', ChillDateType::class, [
|
||||
'required' => false,
|
||||
])
|
||||
->add('phonenumber', TelType::class, [
|
||||
->add('phonenumber', ChillPhoneNumberType::class, [
|
||||
'required' => false,
|
||||
'type' => PhoneNumberType::FIXED_LINE,
|
||||
])
|
||||
->add('mobilenumber', TelType::class, [
|
||||
->add('mobilenumber', ChillPhoneNumberType::class, [
|
||||
'required' => false,
|
||||
'type' => PhoneNumberType::MOBILE,
|
||||
])
|
||||
->add('email', EmailType::class, [
|
||||
'required' => false,
|
||||
|
@@ -14,26 +14,27 @@ namespace Chill\PersonBundle\Form;
|
||||
use Chill\CustomFieldsBundle\Form\Type\CustomFieldType;
|
||||
use Chill\MainBundle\Form\Type\ChillCollectionType;
|
||||
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||
use Chill\MainBundle\Form\Type\ChillPhoneNumberType;
|
||||
use Chill\MainBundle\Form\Type\ChillTextareaType;
|
||||
use Chill\MainBundle\Form\Type\CommentType;
|
||||
use Chill\MainBundle\Form\Type\PickCivilityType;
|
||||
use Chill\MainBundle\Form\Type\Select2CountryType;
|
||||
use Chill\MainBundle\Form\Type\Select2LanguageType;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Entity\PersonPhone;
|
||||
use Chill\PersonBundle\Form\Type\GenderType;
|
||||
use Chill\PersonBundle\Form\Type\PersonAltNameType;
|
||||
use Chill\PersonBundle\Form\Type\PersonPhoneType;
|
||||
use Chill\PersonBundle\Form\Type\Select2MaritalStatusType;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\CallbackTransformer;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TelType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
@@ -57,17 +58,21 @@ class PersonType extends AbstractType
|
||||
|
||||
protected TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
private ParameterBagInterface $parameterBag;
|
||||
|
||||
/**
|
||||
* @param string[] $personFieldsConfiguration configuration of visibility of some fields
|
||||
*/
|
||||
public function __construct(
|
||||
array $personFieldsConfiguration,
|
||||
ConfigPersonAltNamesHelper $configAltNamesHelper,
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
TranslatableStringHelperInterface $translatableStringHelper,
|
||||
ParameterBagInterface $parameterBag
|
||||
) {
|
||||
$this->config = $personFieldsConfiguration;
|
||||
$this->configAltNamesHelper = $configAltNamesHelper;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->parameterBag = $parameterBag;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
@@ -126,22 +131,34 @@ class PersonType extends AbstractType
|
||||
}
|
||||
|
||||
if ('visible' === $this->config['phonenumber']) {
|
||||
$builder->add('phonenumber', TelType::class, [
|
||||
'required' => false,
|
||||
// 'placeholder' => '+33623124554' //TODO placeholder for phone numbers
|
||||
]);
|
||||
$builder
|
||||
->add(
|
||||
'phonenumber',
|
||||
ChillPhoneNumberType::class,
|
||||
[
|
||||
'required' => false,
|
||||
'type' => \libphonenumber\PhoneNumberType::FIXED_LINE,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
if ('visible' === $this->config['mobilenumber']) {
|
||||
$builder
|
||||
->add('mobilenumber', TelType::class, ['required' => false])
|
||||
->add(
|
||||
'mobilenumber',
|
||||
ChillPhoneNumberType::class,
|
||||
[
|
||||
'type' => \libphonenumber\PhoneNumberType::MOBILE,
|
||||
'required' => false,
|
||||
]
|
||||
)
|
||||
->add('acceptSMS', CheckboxType::class, [
|
||||
'required' => false,
|
||||
]);
|
||||
}
|
||||
|
||||
$builder->add('otherPhoneNumbers', ChillCollectionType::class, [
|
||||
'entry_type' => PersonPhoneType::class,
|
||||
'entry_type' => ChillPhoneNumberType::class,
|
||||
'button_add_label' => 'Add new phone',
|
||||
'button_remove_label' => 'Remove phone',
|
||||
'required' => false,
|
||||
|
Reference in New Issue
Block a user