fix conflict in CHANGELOG

This commit is contained in:
nobohan
2021-11-08 12:41:11 +01:00
21 changed files with 287 additions and 127 deletions

View File

@@ -77,11 +77,13 @@ class Configuration implements ConfigurationInterface
->append($this->addFieldNode('nationality'))
->append($this->addFieldNode('country_of_birth'))
->append($this->addFieldNode('marital_status'))
->append($this->addFieldNode('civility'))
->append($this->addFieldNode('spoken_languages'))
->append($this->addFieldNode('address'))
->append($this->addFieldNode('accompanying_period'))
->append($this->addFieldNode('memo'))
->append($this->addFieldNode('number_of_children'))
->append($this->addFieldNode('acceptEmail'))
->arrayNode('alt_names')
->defaultValue([])
->arrayPrototype()

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
@@ -982,6 +992,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
*

View File

@@ -22,6 +22,7 @@
namespace Chill\PersonBundle\Form;
use Chill\CustomFieldsBundle\Form\Type\CustomFieldType;
use Chill\MainBundle\Entity\Civility;
use Chill\MainBundle\Form\Type\ChillCollectionType;
use Chill\MainBundle\Form\Type\ChillTextareaType;
use Chill\MainBundle\Form\Type\Select2CountryType;
@@ -35,6 +36,11 @@ use Chill\PersonBundle\Form\Type\Select2MaritalStatusType;
use Symfony\Component\Form\AbstractType;
use Chill\MainBundle\Form\Type\ChillDateType;
use Chill\MainBundle\Form\Type\CommentType;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Doctrine\ORM\QueryBuilder;
use Doctrine\ORM\EntityRepository;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\CallbackTransformer;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\TelType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
@@ -62,16 +68,20 @@ class PersonType extends AbstractType
*/
protected $configAltNamesHelper;
protected TranslatableStringHelper $translatableStringHelper;
/**
*
* @param string[] $personFieldsConfiguration configuration of visibility of some fields
*/
public function __construct(
array $personFieldsConfiguration,
ConfigPersonAltNamesHelper $configAltNamesHelper
ConfigPersonAltNamesHelper $configAltNamesHelper,
TranslatableStringHelper $translatableStringHelper
) {
$this->config = $personFieldsConfiguration;
$this->configAltNamesHelper = $configAltNamesHelper;
$this->translatableStringHelper = $translatableStringHelper;
}
/**
@@ -114,7 +124,19 @@ class PersonType extends AbstractType
}
if ($this->config['place_of_birth'] === 'visible') {
$builder->add('placeOfBirth', TextType::class, array('required' => false));
$builder->add('placeOfBirth', TextType::class, array(
'required' => false,
'attr' => ['style' => 'text-transform: uppercase;'],
));
$builder->get('placeOfBirth')->addModelTransformer(new CallbackTransformer(
function ($string) {
return strtoupper($string);
},
function ($string) {
return strtoupper($string);
}
));
}
if ($this->config['contact_info'] === 'visible') {
@@ -150,7 +172,11 @@ class PersonType extends AbstractType
if ($this->config['email'] === 'visible') {
$builder
->add('email', EmailType::class, array('required' => false))
->add('email', EmailType::class, array('required' => false));
}
if ($this->config['acceptEmail'] === 'visible') {
$builder
->add('acceptEmail', CheckboxType::class, array('required' => false));
}
@@ -173,6 +199,23 @@ class PersonType extends AbstractType
));
}
if ($this->config['civility'] === 'visible'){
$builder
->add('civility', EntityType::class, [
'label' => 'Civility',
'class' => Civility::class,
'choice_label' => function (Civility $civility): string {
return $this->translatableStringHelper->localize($civility->getName());
},
'query_builder' => function (EntityRepository $er): QueryBuilder {
return $er->createQueryBuilder('c')
->where('c.active = true');
},
'placeholder' => 'choose civility',
'required' => false
]);
}
if ($this->config['marital_status'] === 'visible'){
$builder
->add('maritalStatus', Select2MaritalStatusType::class, array(
@@ -192,6 +235,7 @@ class PersonType extends AbstractType
array('attr' => array('class' => 'cf-fields'), 'group' => $options['cFGroup']))
;
}
}
/**

View File

@@ -7,7 +7,6 @@ const personAcceptEmail = document.getElementById("personAcceptEmail");
const personPhoneNumber = document.getElementById("personPhoneNumber");
const personAcceptSMS = document.getElementById("personAcceptSMS");
new ShowHide({
froms: [maritalStatus],
container: [maritalStatusDate],
@@ -24,21 +23,24 @@ new ShowHide({
event_name: 'change'
});
new ShowHide({
froms: [personEmail],
container: [personAcceptEmail],
test: function(froms) {
for (let f of froms.values()) {
for (let input of f.querySelectorAll('input').values()) {
if (input.value) {
return true
if (personAcceptEmail) {
new ShowHide({
froms: [personEmail],
container: [personAcceptEmail],
test: function(froms) {
for (let f of froms.values()) {
for (let input of f.querySelectorAll('input').values()) {
if (input.value) {
return true
}
}
}
}
return false;
},
event_name: 'input'
});
return false;
},
event_name: 'input'
});
}
new ShowHide({
froms: [personPhoneNumber],

View File

@@ -15,4 +15,5 @@ chill_person:
phonenumber: hidden
country_of_birth: hidden
marital_status: hidden
spoken_languages: hidden
spoken_languages: hidden
civility: hidden

View File

@@ -37,6 +37,9 @@
<fieldset>
<legend><h2>{{ 'General information'|trans }}</h2></legend>
{%- if form.civility is defined -%}
{{ form_row(form.civility, {'label' : 'Civility'}) }}
{% endif %}
{{ form_row(form.firstName, {'label' : 'First name'}) }}
{{ form_row(form.lastName, {'label' : 'Last name'}) }}
{% if form.altNames is defined %}
@@ -95,6 +98,8 @@
<div id="personEmail">
{{ form_row(form.email, {'label': 'Email'}) }}
</div>
{% endif %}
{%- if form.acceptEmail is defined -%}
<div id="personAcceptEmail">
{{ form_row(form.acceptEmail, {'label' : 'Accept emails ?'}) }}
</div>
@@ -135,12 +140,11 @@
</button>
</li>
</ul>
{{ form_end(form) }}
</div>
{% endblock %}
{% block js %}
{{ encore_entry_link_tags('page_person') }}
{{ encore_entry_script_tags('page_person') }}
{% endblock %}

View File

@@ -51,6 +51,15 @@ This view should receive those arguments:
<figure class="person-details">
<h2 class="chill-red">{{ 'General information'|trans }}</h2>
<dl>
{% if person.civility is not null %}
<dt>{{ 'Civility'|trans }}&nbsp;:</dt>
<dd>
{% if person.civility.name|length > 0 %}
{{ person.civility.name|first }}
{% endif %}
</dd>
{% endif %}
<dt>{{ 'First name'|trans }}&nbsp;:</dt>
<dd>{{ person.firstName }}</dd>

View File

@@ -7,8 +7,9 @@ services:
Chill\PersonBundle\Form\PersonType:
arguments:
- '%chill_person.person_fields%'
- '@Chill\PersonBundle\Config\ConfigPersonAltNamesHelper'
$personFieldsConfiguration: '%chill_person.person_fields%'
$configAltNamesHelper: '@Chill\PersonBundle\Config\ConfigPersonAltNamesHelper'
$translatableStringHelper: '@Chill\MainBundle\Templating\TranslatableStringHelper'
tags:
- { name: form.type, alias: '@chill.person.form.person_creation' }

View File

@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace Chill\Migrations\Person;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Add Civility to Person
*/
final class Version20211108100849 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add Civility to Person';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_person_person ADD civility_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE chill_person_person ADD CONSTRAINT FK_BF210A1423D6A298 FOREIGN KEY (civility_id) REFERENCES chill_main_civility (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_BF210A1423D6A298 ON chill_person_person (civility_id)');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE chill_person_person DROP CONSTRAINT FK_BF210A1423D6A298');
$this->addSql('DROP INDEX IDX_BF210A1423D6A298');
$this->addSql('ALTER TABLE chill_person_person DROP civility_id');
}
}

View File

@@ -47,8 +47,8 @@ Phonenumber: 'Numéro de téléphone'
phonenumber: numéro de téléphone
Mobilenumber: 'Numéro de téléphone portable'
mobilenumber: numéro de téléphone portable
Accept short text message ?: Accepte les SMS?
Accept short text message: Accepte les SMS
Accept short text message ?: La personne a donné l'autorisation d'utiliser ce no de téléphone pour l'envoi de rappel par SMS
Accept short text message: La personne a donné l'autorisation d'utiliser ce no de téléphone pour l'envoi de rappel par SMS
Other phonenumber: Autre numéro de téléphone
Description: description
Add new phone: Ajouter un numéro de téléphone
@@ -80,6 +80,8 @@ Married: Marié(e)
'Contact information': 'Informations de contact'
'Administrative information': Administratif
File number: Dossier n°
Civility: Civilité
choose civility: --
# dédoublonnage
Old person: Doublon