mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Remove creation of AccompanyingPeriod on person creation
The data fixtures still create accompanying period for each person.
This commit is contained in:
parent
65198937c0
commit
692e63aba3
@ -252,18 +252,6 @@ final class PersonController extends AbstractController
|
|||||||
*/
|
*/
|
||||||
$person = $form->getData();
|
$person = $form->getData();
|
||||||
|
|
||||||
$periods = $person->getAccompanyingPeriodsOrdered();
|
|
||||||
$period = $periods[0];
|
|
||||||
$period->setOpeningDate($form['creation_date']->getData());
|
|
||||||
// $person = new Person($form['creation_date']->getData());
|
|
||||||
//
|
|
||||||
// $person->setFirstName($form['firstName']->getData())
|
|
||||||
// ->setLastName($form['lastName']->getData())
|
|
||||||
// ->setGender($form['gender']->getData())
|
|
||||||
// ->setBirthdate($form['birthdate']->getData())
|
|
||||||
// ->setCenter($form['center']->getData())
|
|
||||||
// ;
|
|
||||||
|
|
||||||
return $person;
|
return $person;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -364,7 +352,6 @@ final class PersonController extends AbstractController
|
|||||||
'lastName' => $form['lastName']->getData(),
|
'lastName' => $form['lastName']->getData(),
|
||||||
'birthdate' => $form['birthdate']->getData(),
|
'birthdate' => $form['birthdate']->getData(),
|
||||||
'gender' => $form['gender']->getData(),
|
'gender' => $form['gender']->getData(),
|
||||||
'creation_date' => $form['creation_date']->getData(),
|
|
||||||
'form' => $form->createView()));
|
'form' => $form->createView()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,6 +183,14 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con
|
|||||||
private function addAPerson(array $person, ObjectManager $manager)
|
private function addAPerson(array $person, ObjectManager $manager)
|
||||||
{
|
{
|
||||||
$p = new Person();
|
$p = new Person();
|
||||||
|
$p->addAccompanyingPeriod(
|
||||||
|
new AccompanyingPeriod(
|
||||||
|
(new \DateTime())
|
||||||
|
->sub(
|
||||||
|
new \DateInterval('P'.\random_int(0, 180).'D')
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
foreach ($person as $key => $value) {
|
foreach ($person as $key => $value) {
|
||||||
switch ($key) {
|
switch ($key) {
|
||||||
|
@ -379,12 +379,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
|||||||
*/
|
*/
|
||||||
private Collection $householdAddresses;
|
private Collection $householdAddresses;
|
||||||
|
|
||||||
/**
|
public function __construct()
|
||||||
* Person constructor.
|
|
||||||
*
|
|
||||||
* @param \DateTime|null $opening
|
|
||||||
*/
|
|
||||||
public function __construct(\DateTime $opening = null)
|
|
||||||
{
|
{
|
||||||
$this->accompanyingPeriodParticipations = new ArrayCollection();
|
$this->accompanyingPeriodParticipations = new ArrayCollection();
|
||||||
$this->spokenLanguages = new ArrayCollection();
|
$this->spokenLanguages = new ArrayCollection();
|
||||||
@ -393,12 +388,6 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
|||||||
$this->otherPhoneNumbers = new ArrayCollection();
|
$this->otherPhoneNumbers = new ArrayCollection();
|
||||||
$this->householdParticipations = new ArrayCollection();
|
$this->householdParticipations = new ArrayCollection();
|
||||||
$this->householdAddresses = new ArrayCollection();
|
$this->householdAddresses = new ArrayCollection();
|
||||||
|
|
||||||
if ($opening === null) {
|
|
||||||
$opening = new \DateTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->open(new AccompanyingPeriod($opening));
|
|
||||||
$this->genderComment = new CommentEmbeddable();
|
$this->genderComment = new CommentEmbeddable();
|
||||||
$this->maritalStatusComment = new CommentEmbeddable();
|
$this->maritalStatusComment = new CommentEmbeddable();
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;
|
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||||
use Chill\MainBundle\Form\Type\CenterType;
|
use Chill\MainBundle\Form\Type\CenterType;
|
||||||
use Chill\PersonBundle\Form\Type\GenderType;
|
use Chill\PersonBundle\Form\Type\GenderType;
|
||||||
use Chill\MainBundle\Form\Type\DataTransformer\CenterTransformer;
|
use Chill\MainBundle\Form\Type\DataTransformer\CenterTransformer;
|
||||||
@ -80,9 +80,6 @@ final class CreationPersonType extends AbstractType
|
|||||||
'property_path' => 'birthdate'
|
'property_path' => 'birthdate'
|
||||||
))
|
))
|
||||||
->add('gender', HiddenType::class)
|
->add('gender', HiddenType::class)
|
||||||
->add('creation_date', HiddenType::class, array(
|
|
||||||
'mapped' => false
|
|
||||||
))
|
|
||||||
->add('form_status', HiddenType::class, array(
|
->add('form_status', HiddenType::class, array(
|
||||||
'mapped' => false,
|
'mapped' => false,
|
||||||
'data' => $options['form_status']
|
'data' => $options['form_status']
|
||||||
@ -99,25 +96,18 @@ final class CreationPersonType extends AbstractType
|
|||||||
|
|
||||||
$builder->get('birthdate')
|
$builder->get('birthdate')
|
||||||
->addModelTransformer($dateToStringTransformer);
|
->addModelTransformer($dateToStringTransformer);
|
||||||
$builder->get('creation_date')
|
|
||||||
->addModelTransformer($dateToStringTransformer);
|
|
||||||
$builder->get('center')
|
$builder->get('center')
|
||||||
->addModelTransformer($this->centerTransformer);
|
->addModelTransformer($this->centerTransformer);
|
||||||
} else {
|
} else {
|
||||||
$builder
|
$builder
|
||||||
->add('firstName')
|
->add('firstName')
|
||||||
->add('lastName')
|
->add('lastName')
|
||||||
->add('birthdate', DateType::class, array('required' => false,
|
->add('birthdate', ChillDateType::class, [
|
||||||
'widget' => 'single_text', 'format' => 'dd-MM-yyyy'))
|
'required' => false,
|
||||||
|
])
|
||||||
->add('gender', GenderType::class, array(
|
->add('gender', GenderType::class, array(
|
||||||
'required' => true, 'placeholder' => null
|
'required' => true, 'placeholder' => null
|
||||||
))
|
))
|
||||||
->add('creation_date', DateType::class, array(
|
|
||||||
'required' => true,
|
|
||||||
'widget' => 'single_text',
|
|
||||||
'format' => 'dd-MM-yyyy',
|
|
||||||
'mapped' => false,
|
|
||||||
'data' => new \DateTime()))
|
|
||||||
->add('form_status', HiddenType::class, array(
|
->add('form_status', HiddenType::class, array(
|
||||||
'data' => $options['form_status'],
|
'data' => $options['form_status'],
|
||||||
'mapped' => false
|
'mapped' => false
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
{#
|
{#
|
||||||
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||||
*
|
* * This program is free software: you can redistribute it and/or modify
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
* it under the terms of the GNU Affero General Public License as
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
* License, or (at your option) any later version.
|
* License, or (at your option) any later version.
|
||||||
@ -39,8 +38,6 @@
|
|||||||
|
|
||||||
{{ form_row(form.gender, { 'label' : 'Gender'|trans }) }}
|
{{ form_row(form.gender, { 'label' : 'Gender'|trans }) }}
|
||||||
|
|
||||||
{{ form_row(form.creation_date, { 'label' : 'Creation date'|trans }) }}
|
|
||||||
|
|
||||||
{{ form_rest(form) }}
|
{{ form_rest(form) }}
|
||||||
|
|
||||||
<button class="btn btn-create" type="submit" alt="add a person">
|
<button class="btn btn-create" type="submit" alt="add a person">
|
||||||
|
@ -71,14 +71,15 @@
|
|||||||
<dd>{{ person|chill_entity_render_string }}</dd>
|
<dd>{{ person|chill_entity_render_string }}</dd>
|
||||||
|
|
||||||
<dt>{{ 'Date of birth'|trans }}</dt>
|
<dt>{{ 'Date of birth'|trans }}</dt>
|
||||||
<dd>{{ birthdate|format_date('long')|default( 'Unknown date of birth'|trans ) }}</dd>
|
{% if birthdate is empty %}
|
||||||
|
<dd>{{ 'Unknown date of birth'|trans }}</dd>
|
||||||
|
{% else %}
|
||||||
|
<dd>{{ birthdate|format_date('long') }}</dd>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<dt>{{ 'Gender'|trans }}</dt>
|
<dt>{{ 'Gender'|trans }}</dt>
|
||||||
<dd>{{ gender|trans }}</dd>
|
<dd>{{ gender|trans }}</dd>
|
||||||
|
|
||||||
<dt>{{ 'Creation date'|trans }}</dt>
|
|
||||||
<dd>{{ creation_date|format_date('long') }}</dd>
|
|
||||||
|
|
||||||
{% if form.altNames is defined %}
|
{% if form.altNames is defined %}
|
||||||
{# mark as rendered #}
|
{# mark as rendered #}
|
||||||
{{ form_widget(form.altNames) }}
|
{{ form_widget(form.altNames) }}
|
||||||
@ -86,10 +87,13 @@
|
|||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
{{ form_rest(form) }}
|
{{ form_rest(form) }}
|
||||||
<button class="btn btn-submit" type="submit"><i class="fa fa-check"></i> {{ 'Confirm the creation'|trans }}</button>
|
<ul class="record_actions">
|
||||||
|
<li>
|
||||||
|
<button class="sc-button bt-create change-icon" type="submit"><i class="fa fa-check"></i> {{ 'Confirm the creation'|trans }}</button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
{{ form_end(form) }}
|
{{ form_end(form) }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user