mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Move AccompanyingPeriodType, remove custom definition.
This commit is contained in:
parent
92b6f4e206
commit
a9bdb1fe3b
@ -23,12 +23,6 @@ services:
|
||||
tags:
|
||||
- { name: form.type, alias: closing_motive }
|
||||
|
||||
Chill\PersonBundle\Form\AccompanyingPeriodType:
|
||||
arguments:
|
||||
$config: "%chill_person.accompanying_period_fields%"
|
||||
tags:
|
||||
- { name: form.type }
|
||||
|
||||
chill.person.form.type.pick_person:
|
||||
class: Chill\PersonBundle\Form\Type\PickPersonType
|
||||
arguments:
|
||||
|
@ -26,7 +26,7 @@ use Chill\PersonBundle\Privacy\PrivacyEvent;
|
||||
use Doctrine\DBAL\Exception;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Form\AccompanyingPeriodType;
|
||||
use Chill\PersonBundle\Form\Type\AccompanyingPeriodType;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Doctrine\Common\Collections\Criteria;
|
||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\PersonBundle\Form;
|
||||
namespace Chill\PersonBundle\Form\Type;
|
||||
|
||||
use Chill\MainBundle\Entity\Center;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
@ -14,12 +14,10 @@ use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use Chill\MainBundle\Form\Type\UserPickerType;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Chill\PersonBundle\Form\Type\ClosingMotivePickerType;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
|
||||
/**
|
||||
* Class AccompanyingPeriodType
|
||||
*
|
||||
* @package Chill\PersonBundle\Form
|
||||
*/
|
||||
class AccompanyingPeriodType extends AbstractType
|
||||
{
|
||||
@ -33,15 +31,11 @@ class AccompanyingPeriodType extends AbstractType
|
||||
*/
|
||||
protected $config = [];
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string[] $config configuration of visibility of some fields
|
||||
*/
|
||||
public function __construct(array $config)
|
||||
public function __construct(ParameterBagInterface $parameterBag)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->config = $parameterBag->get('chill_person.accompanying_period_fields');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param FormBuilderInterface $builder
|
||||
* @param array $options
|
||||
@ -58,12 +52,12 @@ class AccompanyingPeriodType extends AbstractType
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
// closingDate should be seen only if
|
||||
// period_action = close
|
||||
// OR ( period_action = update AND accompanying period is already closed )
|
||||
$accompanyingPeriod = $options['data'];
|
||||
|
||||
|
||||
if (
|
||||
($options['period_action'] === 'close')
|
||||
OR
|
||||
@ -71,16 +65,16 @@ class AccompanyingPeriodType extends AbstractType
|
||||
OR
|
||||
($options['period_action'] === 'update' AND !$accompanyingPeriod->isOpen())
|
||||
) {
|
||||
|
||||
|
||||
$builder->add('closingDate', DateType::class, [
|
||||
'required' => true,
|
||||
'widget' => 'single_text',
|
||||
'format' => 'dd-MM-yyyy'
|
||||
]);
|
||||
|
||||
|
||||
$builder->add('closingMotive', ClosingMotivePickerType::class);
|
||||
}
|
||||
|
||||
|
||||
if ($this->config['user'] === 'visible') {
|
||||
$builder->add('user', UserPickerType::class, [
|
||||
'center' => $options['center'],
|
||||
@ -110,7 +104,7 @@ class AccompanyingPeriodType extends AbstractType
|
||||
->setAllowedTypes('center', Center::class)
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param FormView $view
|
||||
* @param FormInterface $form
|
Loading…
x
Reference in New Issue
Block a user