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();
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
@ -364,7 +352,6 @@ final class PersonController extends AbstractController
|
||||
'lastName' => $form['lastName']->getData(),
|
||||
'birthdate' => $form['birthdate']->getData(),
|
||||
'gender' => $form['gender']->getData(),
|
||||
'creation_date' => $form['creation_date']->getData(),
|
||||
'form' => $form->createView()));
|
||||
}
|
||||
|
||||
|
@ -183,6 +183,14 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con
|
||||
private function addAPerson(array $person, ObjectManager $manager)
|
||||
{
|
||||
$p = new Person();
|
||||
$p->addAccompanyingPeriod(
|
||||
new AccompanyingPeriod(
|
||||
(new \DateTime())
|
||||
->sub(
|
||||
new \DateInterval('P'.\random_int(0, 180).'D')
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
foreach ($person as $key => $value) {
|
||||
switch ($key) {
|
||||
|
@ -379,12 +379,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
*/
|
||||
private Collection $householdAddresses;
|
||||
|
||||
/**
|
||||
* Person constructor.
|
||||
*
|
||||
* @param \DateTime|null $opening
|
||||
*/
|
||||
public function __construct(\DateTime $opening = null)
|
||||
public function __construct()
|
||||
{
|
||||
$this->accompanyingPeriodParticipations = new ArrayCollection();
|
||||
$this->spokenLanguages = new ArrayCollection();
|
||||
@ -393,12 +388,6 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
$this->otherPhoneNumbers = new ArrayCollection();
|
||||
$this->householdParticipations = new ArrayCollection();
|
||||
$this->householdAddresses = new ArrayCollection();
|
||||
|
||||
if ($opening === null) {
|
||||
$opening = new \DateTime();
|
||||
}
|
||||
|
||||
$this->open(new AccompanyingPeriod($opening));
|
||||
$this->genderComment = new CommentEmbeddable();
|
||||
$this->maritalStatusComment = new CommentEmbeddable();
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;
|
||||
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\PersonBundle\Form\Type\GenderType;
|
||||
use Chill\MainBundle\Form\Type\DataTransformer\CenterTransformer;
|
||||
@ -80,9 +80,6 @@ final class CreationPersonType extends AbstractType
|
||||
'property_path' => 'birthdate'
|
||||
))
|
||||
->add('gender', HiddenType::class)
|
||||
->add('creation_date', HiddenType::class, array(
|
||||
'mapped' => false
|
||||
))
|
||||
->add('form_status', HiddenType::class, array(
|
||||
'mapped' => false,
|
||||
'data' => $options['form_status']
|
||||
@ -99,25 +96,18 @@ final class CreationPersonType extends AbstractType
|
||||
|
||||
$builder->get('birthdate')
|
||||
->addModelTransformer($dateToStringTransformer);
|
||||
$builder->get('creation_date')
|
||||
->addModelTransformer($dateToStringTransformer);
|
||||
$builder->get('center')
|
||||
->addModelTransformer($this->centerTransformer);
|
||||
} else {
|
||||
$builder
|
||||
->add('firstName')
|
||||
->add('lastName')
|
||||
->add('birthdate', DateType::class, array('required' => false,
|
||||
'widget' => 'single_text', 'format' => 'dd-MM-yyyy'))
|
||||
->add('birthdate', ChillDateType::class, [
|
||||
'required' => false,
|
||||
])
|
||||
->add('gender', GenderType::class, array(
|
||||
'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(
|
||||
'data' => $options['form_status'],
|
||||
'mapped' => false
|
||||
|
@ -1,7 +1,6 @@
|
||||
{#
|
||||
* 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
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
@ -38,8 +37,6 @@
|
||||
{{ form_row(form.birthdate, { 'label' : 'Date of birth'|trans }) }}
|
||||
|
||||
{{ form_row(form.gender, { 'label' : 'Gender'|trans }) }}
|
||||
|
||||
{{ form_row(form.creation_date, { 'label' : 'Creation date'|trans }) }}
|
||||
|
||||
{{ form_rest(form) }}
|
||||
|
||||
|
@ -71,14 +71,15 @@
|
||||
<dd>{{ person|chill_entity_render_string }}</dd>
|
||||
|
||||
<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>
|
||||
<dd>{{ gender|trans }}</dd>
|
||||
|
||||
<dt>{{ 'Creation date'|trans }}</dt>
|
||||
<dd>{{ creation_date|format_date('long') }}</dd>
|
||||
|
||||
{% if form.altNames is defined %}
|
||||
{# mark as rendered #}
|
||||
{{ form_widget(form.altNames) }}
|
||||
@ -86,10 +87,13 @@
|
||||
</dl>
|
||||
|
||||
{{ 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) }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user