mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Allow to enable multiple simultaneous accompanyingPeriods
This commit is contained in:
parent
fa5d0fbd21
commit
1d6a8987e9
@ -293,11 +293,15 @@ class AccompanyingPeriodController extends AbstractController
|
||||
$errors = $this->validator->validate($person, null,
|
||||
['Default']);
|
||||
|
||||
$errors_accompanying_period = $this->validator->validate($person, null,
|
||||
['accompanying_period_consistent']);
|
||||
|
||||
foreach($errors_accompanying_period as $error ) {
|
||||
$errors->add($error);
|
||||
// Can be disabled with config
|
||||
if (false === $this->container->getParameter('chill_person.allow_multiple_simultaneous_accompanying_periods')) {
|
||||
|
||||
$errors_accompanying_period = $this->validator->validate($person, null,
|
||||
['accompanying_period_consistent']);
|
||||
|
||||
foreach($errors_accompanying_period as $error ) {
|
||||
$errors->add($error);
|
||||
}
|
||||
}
|
||||
|
||||
return $errors;
|
||||
|
@ -56,6 +56,9 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
|
||||
$this->handlePersonFieldsParameters($container, $config['person_fields']);
|
||||
$this->handleAccompanyingPeriodsFieldsParameters($container, $config['accompanying_periods_fields']);
|
||||
|
||||
$container->setParameter('chill_person.allow_multiple_simultaneous_accompanying_periods',
|
||||
$config['allow_multiple_simultaneous_accompanying_periods']);
|
||||
|
||||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config'));
|
||||
$loader->load('services.yaml');
|
||||
@ -140,7 +143,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
}
|
||||
|
||||
$container->prependExtensionConfig('chill_custom_fields',
|
||||
array('customizables_entities' =>
|
||||
array('customizables_entities' =>
|
||||
array(
|
||||
array('class' => 'Chill\PersonBundle\Entity\Person', 'name' => 'PersonEntity')
|
||||
)
|
||||
@ -152,7 +155,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
* @param ContainerBuilder $container
|
||||
* @throws MissingBundleException
|
||||
*/
|
||||
public function prepend(ContainerBuilder $container)
|
||||
public function prepend(ContainerBuilder $container)
|
||||
{
|
||||
$this->prependRoleHierarchy($container);
|
||||
$this->prependHomepageWidget($container);
|
||||
@ -189,7 +192,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
|
||||
/**
|
||||
* Add a widget "add a person" on the homepage, automatically
|
||||
*
|
||||
*
|
||||
* @param \Chill\PersonBundle\DependencyInjection\containerBuilder $container
|
||||
*/
|
||||
protected function prependHomepageWidget(containerBuilder $container)
|
||||
@ -208,7 +211,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
|
||||
/**
|
||||
* Add role hierarchy.
|
||||
*
|
||||
*
|
||||
* @param ContainerBuilder $container
|
||||
*/
|
||||
protected function prependRoleHierarchy(ContainerBuilder $container)
|
||||
@ -217,7 +220,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
'role_hierarchy' => array(
|
||||
'CHILL_PERSON_UPDATE' => array('CHILL_PERSON_SEE'),
|
||||
'CHILL_PERSON_CREATE' => array('CHILL_PERSON_SEE'),
|
||||
PersonVoter::LISTS => [ ChillExportVoter::EXPORT ],
|
||||
PersonVoter::LISTS => [ ChillExportVoter::EXPORT ],
|
||||
PersonVoter::STATS => [ ChillExportVoter::EXPORT ]
|
||||
)
|
||||
));
|
||||
@ -225,7 +228,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
|
||||
/**
|
||||
* Add DQL function linked with person
|
||||
*
|
||||
*
|
||||
* @param ContainerBuilder $container
|
||||
*/
|
||||
protected function prependDoctrineDQL(ContainerBuilder $container)
|
||||
|
@ -104,8 +104,21 @@ class Configuration implements ConfigurationInterface
|
||||
->canBeDisabled()
|
||||
->children()
|
||||
->append($this->addFieldNode('user'))
|
||||
->append($this->addFieldNode('createdBy'))
|
||||
->append($this->addFieldNode('step'))
|
||||
->append($this->addFieldNode('origin'))
|
||||
->append($this->addFieldNode('intensity'))
|
||||
->append($this->addFieldNode('scopes'))
|
||||
->append($this->addFieldNode('requestor'))
|
||||
->append($this->addFieldNode('anonymous'))
|
||||
->append($this->addFieldNode('emergency'))
|
||||
->append($this->addFieldNode('confidential'))
|
||||
->end() //children for 'accompanying_person_fields', parent = array 'person_fields'
|
||||
->end() // paccompanying_person_fields, parent = children of root
|
||||
->booleanNode('allow_multiple_simultaneous_accompanying_periods')
|
||||
->info('Can we have more than one simultaneous accompanying period in the same time. Default false.')
|
||||
->defaultValue(false)
|
||||
->end()
|
||||
->end() // children of 'root', parent = root
|
||||
;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user