Merge branch 'issue324_person' into 'master'

fix some person issues

See merge request Chill-Projet/chill-bundles!254
This commit is contained in:
Julien Fastré 2021-12-12 14:39:59 +00:00
commit c6cda437c4
11 changed files with 52 additions and 13 deletions

View File

@ -17,6 +17,12 @@ and this project adheres to
* [action] add an unrelated issue within action creation. * [action] add an unrelated issue within action creation.
* [origin] fix origin: use correctly the translatable strings * [origin] fix origin: use correctly the translatable strings
* /!\ everyone must update the origin table. As there is only one row, execute `update chill_person_accompanying_period_origin set label = jsonb_build_object('fr', 'appel téléphonique');` * /!\ everyone must update the origin table. As there is only one row, execute `update chill_person_accompanying_period_origin set label = jsonb_build_object('fr', 'appel téléphonique');`
* [main] change order of civilities in civility fixtures (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/191)
* [person] set min attr in the minimum of children field (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/191)
* [person] add marital status date in person view (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/191)
* [person] show number of children + allow set number of children to null (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/191)
* [person] show acceptSMS option (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/191)
* [person] add death information in person render box in twig and vue render boxes (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/191)
## Test releases ## Test releases

View File

@ -26,8 +26,8 @@ class LoadCivility extends Fixture implements FixtureGroupInterface
public function load(ObjectManager $manager): void public function load(ObjectManager $manager): void
{ {
$civilities = [ $civilities = [
['name' => ['fr' => 'Monsieur'], 'abbrev' => ['fr' => 'M.']],
['name' => ['fr' => 'Madame'], 'abbrev' => ['fr' => 'Mme']], ['name' => ['fr' => 'Madame'], 'abbrev' => ['fr' => 'Mme']],
['name' => ['fr' => 'Monsieur'], 'abbrev' => ['fr' => 'M.']],
['name' => ['fr' => 'Docteur'], 'abbrev' => ['fr' => 'Dr']], ['name' => ['fr' => 'Docteur'], 'abbrev' => ['fr' => 'Dr']],
['name' => ['fr' => 'Professeur'], 'abbrev' => ['fr' => 'Pr']], ['name' => ['fr' => 'Professeur'], 'abbrev' => ['fr' => 'Pr']],
['name' => ['fr' => 'Madame la Directrice'], 'abbrev' => ['fr' => 'Mme']], ['name' => ['fr' => 'Madame la Directrice'], 'abbrev' => ['fr' => 'Mme']],

View File

@ -186,7 +186,7 @@ class HouseholdMemberController extends ApiController
$_format, $_format,
['groups' => ['read']] ['groups' => ['read']]
); );
} catch (Exception\InvalidArgumentException | Exception\UnexpectedValueException $e) { } catch (Exception\InvalidArgumentException|Exception\UnexpectedValueException $e) {
throw new BadRequestException("Deserialization error: {$e->getMessage()}", 45896, $e); throw new BadRequestException("Deserialization error: {$e->getMessage()}", 45896, $e);
} }

View File

@ -80,6 +80,7 @@ class Configuration implements ConfigurationInterface
->append($this->addFieldNode('memo')) ->append($this->addFieldNode('memo'))
->append($this->addFieldNode('number_of_children')) ->append($this->addFieldNode('number_of_children'))
->append($this->addFieldNode('acceptEmail')) ->append($this->addFieldNode('acceptEmail'))
->append($this->addFieldNode('deathdate'))
->arrayNode('alt_names') ->arrayNode('alt_names')
->defaultValue([]) ->defaultValue([])
->arrayPrototype() ->arrayPrototype()

View File

@ -244,6 +244,8 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
* @Assert\Date( * @Assert\Date(
* groups={"general", "creation"} * groups={"general", "creation"}
* ) * )
* @Assert\GreaterThan(propertyPath="birthDate")
* @Assert\LessThanOrEqual("today")
*/ */
private ?DateTimeImmutable $deathdate = null; private ?DateTimeImmutable $deathdate = null;
@ -1774,7 +1776,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
return $this; return $this;
} }
public function setNumberOfChildren(int $numberOfChildren): self public function setNumberOfChildren(?int $numberOfChildren): self
{ {
$this->numberOfChildren = $numberOfChildren; $this->numberOfChildren = $numberOfChildren;

View File

@ -93,6 +93,7 @@ class PersonType extends AbstractType
]) ])
->add('numberOfChildren', IntegerType::class, [ ->add('numberOfChildren', IntegerType::class, [
'required' => false, 'required' => false,
'attr' => ['min' => 0],
]); ]);
if ($this->configAltNamesHelper->hasAltNames()) { if ($this->configAltNamesHelper->hasAltNames()) {

View File

@ -18,6 +18,7 @@
<span class="firstname">{{ person.firstName }}</span> <span class="firstname">{{ person.firstName }}</span>
<span class="lastname">{{ person.lastName }}</span> <span class="lastname">{{ person.lastName }}</span>
<span v-if="person.deathdate" class="deathdate"> ()</span>
<span v-if="person.altNames && options.addAltNames == true" class="altnames"> <span v-if="person.altNames && options.addAltNames == true" class="altnames">
<span :class="'altname altname-' + altNameKey">{{ altNameLabel }}</span> <span :class="'altname altname-' + altNameKey">{{ altNameLabel }}</span>
</span> </span>

View File

@ -10,6 +10,7 @@
* addAge bool * addAge bool
* addCenter bool * addCenter bool
* hLevel integer * hLevel integer
* addDeath bool
* address_multiline bool * address_multiline bool
* customButtons [ * customButtons [
'before' Twig\Markup, (injected with macro) 'before' Twig\Markup, (injected with macro)
@ -24,7 +25,12 @@
{% macro raw(person, options) %} {% macro raw(person, options) %}
<span class="firstname">{{ person.firstName }}</span> <span class="firstname">{{ person.firstName }}</span>
<span class="lastname">{{ person.lastName }}</span> <span class="lastname">
{{ person.lastName }}
{%- if options['addDeath'] -%}
{% if person.deathdate is not null %} (‡){% endif %}
{% endif %}
</span>
{%- if options['addAltNames'] -%} {%- if options['addAltNames'] -%}
<span class="altnames"> <span class="altnames">
{%- for n in person.altNames -%} {%- for n in person.altNames -%}
@ -82,21 +88,17 @@
{{ 'Date of death'|trans }}: {{ 'Date of death'|trans }}:
{%- endif -%} {%- endif -%}
{#- must be on one line to avoid spaces with dash -#} {#- must be on one line to avoid spaces with dash -#}
<time datetime="{{ person.deathdate|date('Y-m-d') }}" title="{{ 'Deathdate'|trans }}">{{ person.deathdate|format_date("medium") }}</time> <time datetime="{{ person.deathdate|date('Y-m-d') }}" title="{{ 'deathdate'|trans }}">{{ person.deathdate|format_date("medium") }}</time>
{% if options['addAge'] %} {%- if options['addAge'] -%}
<span class="age"> <span class="age">{{ 'years_old'|trans({ 'age': person.age }) }}</span>
({{ 'years_old'|trans({ 'age': person.age }) }}) {%- endif -%}
</span>
{% endif %}
{%- elseif person.birthdate is not null -%} {%- elseif person.birthdate is not null -%}
<time datetime="{{ person.birthdate|date('Y-m-d') }}" title="{{ 'Birthdate'|trans }}"> <time datetime="{{ person.birthdate|date('Y-m-d') }}" title="{{ 'Birthdate'|trans }}">
{{ 'Born the date'|trans({'gender': person.gender, {{ 'Born the date'|trans({'gender': person.gender,
'birthdate': person.birthdate|format_date("medium") }) }} 'birthdate': person.birthdate|format_date("medium") }) }}
</time> </time>
{%- if options['addAge'] -%} {%- if options['addAge'] -%}
<span class="age"> <span class="age">{{- 'years_old'|trans({ 'age': person.age }) -}}</span>
{{- 'years_old'|trans({ 'age': person.age }) -}}
</span>
{%- endif -%} {%- endif -%}
{%- endif -%} {%- endif -%}
</p> </p>

View File

@ -92,6 +92,13 @@ This view should receive those arguments:
{%- endif -%} {%- endif -%}
</dd> </dd>
{%- if chill_person.fields.deathdate == 'visible' -%}
{%- if person.deathdate is not null -%}
<dt>{{ 'Date of death'|trans }}&nbsp;:</dt>
<dd>{{ person.deathdate|format_date('long') }}</dd>
{%- endif -%}
{%- endif -%}
{%- if chill_person.fields.place_of_birth == 'visible' -%} {%- if chill_person.fields.place_of_birth == 'visible' -%}
<dt>{{ 'Place of birth'|trans }}&nbsp;:</dt> <dt>{{ 'Place of birth'|trans }}&nbsp;:</dt>
{% if person.placeOfBirth is not empty %} {% if person.placeOfBirth is not empty %}
@ -111,6 +118,7 @@ This view should receive those arguments:
{% endif %} {% endif %}
{% endapply %}</dd> {% endapply %}</dd>
{%- endif -%} {%- endif -%}
</dl> </dl>
</figure> </figure>
</div> </div>
@ -159,12 +167,27 @@ This view should receive those arguments:
</dd> </dd>
</dl> </dl>
{%- endif -%} {%- endif -%}
{%- if chill_person.fields.number_of_children == 'visible' -%}
<dl>
<dt>{{'Number of children'|trans}}&nbsp;:</dt>
<dd>
{% if person.numberOfChildren is not null %}
{{ person.numberOfChildren }}
{% else %}
<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>
{% endif %}
</dd>
</dl>
{%- endif -%}
{%- if chill_person.fields.marital_status == 'visible' -%} {%- if chill_person.fields.marital_status == 'visible' -%}
<dl> <dl>
<dt>{{'Marital status'|trans}}&nbsp;:</dt> <dt>{{'Marital status'|trans}}&nbsp;:</dt>
<dd> <dd>
{% if person.maritalStatus is not null %} {% if person.maritalStatus is not null %}
{{ person.maritalStatus.name|localize_translatable_string }} {{ person.maritalStatus.name|localize_translatable_string }}
{% if person.maritalStatusDate is not null %}
{{ 'person.from_the'|trans }} {{ person.maritalStatusDate|format_date('long') }}
{% endif %}
{% else %} {% else %}
<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span> <span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>
{% endif %} {% endif %}
@ -217,6 +240,7 @@ This view should receive those arguments:
<dl> <dl>
<dt>{{ 'Mobilenumber'|trans }}&nbsp;:</dt> <dt>{{ 'Mobilenumber'|trans }}&nbsp;:</dt>
<dd>{% if person.mobilenumber is not empty %}<a href="tel:{{ person.mobilenumber }}">{{ person.mobilenumber|chill_format_phonenumber }}</a>{% else %}<span class="chill-no-data-statement">{{ 'No data given'|trans }}{% endif %}</dd> <dd>{% if person.mobilenumber is not empty %}<a href="tel:{{ person.mobilenumber }}">{{ person.mobilenumber|chill_format_phonenumber }}</a>{% else %}<span class="chill-no-data-statement">{{ 'No data given'|trans }}{% endif %}</dd>
<p>{% if person.acceptSMS %}{{ 'Accept short text message'|trans }}{% endif %}</p>
</dl> </dl>
{% endif %} {% endif %}

View File

@ -51,6 +51,7 @@ class PersonRender extends AbstractChillEntityRender
'hLevel' => $options['hLevel'] ?? 3, 'hLevel' => $options['hLevel'] ?? 3,
'customButtons' => $options['customButtons'] ?? [], 'customButtons' => $options['customButtons'] ?? [],
'customArea' => $options['customArea'] ?? [], 'customArea' => $options['customArea'] ?? [],
'addDeath' => $options['addDeath'] ?? true,
]; ];
return return

View File

@ -19,6 +19,7 @@ person:
woman {et elle-même} woman {et elle-même}
other {et lui·elle-même} other {et lui·elle-même}
} }
from_the: depuis le
household: household:
Household: Ménage Household: Ménage