mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
Merge branch 'calendar/finalization' into testing
This commit is contained in:
@@ -15,7 +15,7 @@ use Chill\MainBundle\CRUD\Controller\CRUDController;
|
||||
use Chill\MainBundle\Entity\GroupCenter;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Form\Type\ComposedGroupCenterType;
|
||||
use Chill\MainBundle\Form\Type\Select2UserLocationType;
|
||||
use Chill\MainBundle\Form\UserCurrentLocationType;
|
||||
use Chill\MainBundle\Form\UserPasswordType;
|
||||
use Chill\MainBundle\Form\UserType;
|
||||
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||
@@ -234,7 +234,7 @@ class UserController extends CRUDController
|
||||
public function editCurrentLocationAction(Request $request)
|
||||
{
|
||||
$user = $this->getUser();
|
||||
$form = $this->createForm(Select2UserLocationType::class, $user)
|
||||
$form = $this->createForm(UserCurrentLocationType::class, $user)
|
||||
->add('submit', SubmitType::class, ['label' => 'Save'])
|
||||
->handleRequest($request);
|
||||
|
||||
|
@@ -28,6 +28,7 @@ use Chill\MainBundle\Doctrine\DQL\GetJsonFieldByKey;
|
||||
use Chill\MainBundle\Doctrine\DQL\JsonAggregate;
|
||||
use Chill\MainBundle\Doctrine\DQL\JsonbArrayLength;
|
||||
use Chill\MainBundle\Doctrine\DQL\JsonbExistsInArray;
|
||||
use Chill\MainBundle\Doctrine\DQL\JsonExtract;
|
||||
use Chill\MainBundle\Doctrine\DQL\OverlapsI;
|
||||
use Chill\MainBundle\Doctrine\DQL\Replace;
|
||||
use Chill\MainBundle\Doctrine\DQL\Similarity;
|
||||
@@ -235,6 +236,7 @@ class ChillMainExtension extends Extension implements
|
||||
'GET_JSON_FIELD_BY_KEY' => GetJsonFieldByKey::class,
|
||||
'AGGREGATE' => JsonAggregate::class,
|
||||
'REPLACE' => Replace::class,
|
||||
'JSON_EXTRACT' => JsonExtract::class,
|
||||
],
|
||||
'numeric_functions' => [
|
||||
'JSONB_EXISTS_IN_ARRAY' => JsonbExistsInArray::class,
|
||||
|
@@ -11,6 +11,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\MainBundle\DependencyInjection\CompilerPass;
|
||||
|
||||
use Chill\MainBundle\Export\ExportManager;
|
||||
use LogicException;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
@@ -30,53 +31,19 @@ class ExportsCompilerPass implements CompilerPassInterface
|
||||
{
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->has('Chill\MainBundle\Export\ExportManager')) {
|
||||
throw new LogicException('service Chill\MainBundle\Export\ExportManager '
|
||||
if (!$container->has(ExportManager::class)) {
|
||||
throw new LogicException('service ' . ExportManager::class . ' '
|
||||
. 'is not defined. It is required by ExportsCompilerPass');
|
||||
}
|
||||
|
||||
$chillManagerDefinition = $container->findDefinition(
|
||||
'Chill\MainBundle\Export\ExportManager'
|
||||
ExportManager::class
|
||||
);
|
||||
|
||||
$this->compileExports($chillManagerDefinition, $container);
|
||||
$this->compileFilters($chillManagerDefinition, $container);
|
||||
$this->compileAggregators($chillManagerDefinition, $container);
|
||||
$this->compileFormatters($chillManagerDefinition, $container);
|
||||
$this->compileExportElementsProvider($chillManagerDefinition, $container);
|
||||
}
|
||||
|
||||
private function compileAggregators(
|
||||
Definition $chillManagerDefinition,
|
||||
ContainerBuilder $container
|
||||
) {
|
||||
$taggedServices = $container->findTaggedServiceIds(
|
||||
'chill.export_aggregator'
|
||||
);
|
||||
|
||||
$knownAliases = [];
|
||||
|
||||
foreach ($taggedServices as $id => $tagAttributes) {
|
||||
foreach ($tagAttributes as $attributes) {
|
||||
if (!isset($attributes['alias'])) {
|
||||
throw new LogicException("the 'alias' attribute is missing in your " .
|
||||
"service '{$id}' definition");
|
||||
}
|
||||
|
||||
if (array_search($attributes['alias'], $knownAliases, true)) {
|
||||
throw new LogicException('There is already a chill.export_aggregator service with alias '
|
||||
. $attributes['alias'] . '. Choose another alias.');
|
||||
}
|
||||
$knownAliases[] = $attributes['alias'];
|
||||
|
||||
$chillManagerDefinition->addMethodCall(
|
||||
'addAggregator',
|
||||
[new Reference($id), $attributes['alias']]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function compileExportElementsProvider(
|
||||
Definition $chillManagerDefinition,
|
||||
ContainerBuilder $container
|
||||
@@ -108,68 +75,6 @@ class ExportsCompilerPass implements CompilerPassInterface
|
||||
}
|
||||
}
|
||||
|
||||
private function compileExports(
|
||||
Definition $chillManagerDefinition,
|
||||
ContainerBuilder $container
|
||||
) {
|
||||
$taggedServices = $container->findTaggedServiceIds(
|
||||
'chill.export'
|
||||
);
|
||||
|
||||
$knownAliases = [];
|
||||
|
||||
foreach ($taggedServices as $id => $tagAttributes) {
|
||||
foreach ($tagAttributes as $attributes) {
|
||||
if (!isset($attributes['alias'])) {
|
||||
throw new LogicException("the 'alias' attribute is missing in your " .
|
||||
"service '{$id}' definition");
|
||||
}
|
||||
|
||||
if (array_search($attributes['alias'], $knownAliases, true)) {
|
||||
throw new LogicException('There is already a chill.export service with alias '
|
||||
. $attributes['alias'] . '. Choose another alias.');
|
||||
}
|
||||
$knownAliases[] = $attributes['alias'];
|
||||
|
||||
$chillManagerDefinition->addMethodCall(
|
||||
'addExport',
|
||||
[new Reference($id), $attributes['alias']]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function compileFilters(
|
||||
Definition $chillManagerDefinition,
|
||||
ContainerBuilder $container
|
||||
) {
|
||||
$taggedServices = $container->findTaggedServiceIds(
|
||||
'chill.export_filter'
|
||||
);
|
||||
|
||||
$knownAliases = [];
|
||||
|
||||
foreach ($taggedServices as $id => $tagAttributes) {
|
||||
foreach ($tagAttributes as $attributes) {
|
||||
if (!isset($attributes['alias'])) {
|
||||
throw new LogicException("the 'alias' attribute is missing in your " .
|
||||
"service '{$id}' definition");
|
||||
}
|
||||
|
||||
if (array_search($attributes['alias'], $knownAliases, true)) {
|
||||
throw new LogicException('There is already a chill.export_filter service with alias '
|
||||
. $attributes['alias'] . '. Choose another alias.');
|
||||
}
|
||||
$knownAliases[] = $attributes['alias'];
|
||||
|
||||
$chillManagerDefinition->addMethodCall(
|
||||
'addFilter',
|
||||
[new Reference($id), $attributes['alias']]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function compileFormatters(
|
||||
Definition $chillManagerDefinition,
|
||||
ContainerBuilder $container
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* Chill is a software for social workers.
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
@@ -9,6 +9,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\DependencyInjection\CompilerPass;
|
||||
|
||||
use Chill\MainBundle\Service\ShortMessage\NullShortMessageSender;
|
||||
|
43
src/Bundle/ChillMainBundle/Doctrine/DQL/JsonExtract.php
Normal file
43
src/Bundle/ChillMainBundle/Doctrine/DQL/JsonExtract.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Doctrine\DQL;
|
||||
|
||||
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
|
||||
use Doctrine\ORM\Query\Lexer;
|
||||
use Doctrine\ORM\Query\Parser;
|
||||
use Doctrine\ORM\Query\SqlWalker;
|
||||
|
||||
class JsonExtract extends FunctionNode
|
||||
{
|
||||
private $element;
|
||||
|
||||
private $keyToExtract;
|
||||
|
||||
public function getSql(SqlWalker $sqlWalker)
|
||||
{
|
||||
return sprintf('%s->>%s', $this->element->dispatch($sqlWalker), $this->keyToExtract->dispatch($sqlWalker));
|
||||
}
|
||||
|
||||
public function parse(Parser $parser)
|
||||
{
|
||||
$parser->match(Lexer::T_IDENTIFIER);
|
||||
$parser->match(Lexer::T_OPEN_PARENTHESIS);
|
||||
|
||||
$this->element = $parser->ArithmeticPrimary();
|
||||
|
||||
$parser->match(Lexer::T_COMMA);
|
||||
|
||||
$this->keyToExtract = $parser->ArithmeticExpression();
|
||||
|
||||
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
|
||||
}
|
||||
}
|
@@ -14,10 +14,8 @@ namespace Chill\MainBundle\Export;
|
||||
use Chill\MainBundle\Form\Type\Export\ExportType;
|
||||
use Chill\MainBundle\Form\Type\Export\PickCenterType;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Generator;
|
||||
use InvalidArgumentException;
|
||||
use LogicException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RuntimeException;
|
||||
@@ -50,8 +48,6 @@ class ExportManager
|
||||
|
||||
private AuthorizationHelperInterface $authorizationHelper;
|
||||
|
||||
private EntityManagerInterface $em;
|
||||
|
||||
/**
|
||||
* Collected Exports, injected by DI.
|
||||
*
|
||||
@@ -82,16 +78,28 @@ class ExportManager
|
||||
|
||||
public function __construct(
|
||||
LoggerInterface $logger,
|
||||
EntityManagerInterface $em,
|
||||
AuthorizationCheckerInterface $authorizationChecker,
|
||||
AuthorizationHelperInterface $authorizationHelper,
|
||||
TokenStorageInterface $tokenStorage
|
||||
TokenStorageInterface $tokenStorage,
|
||||
iterable $exports,
|
||||
iterable $aggregators,
|
||||
iterable $filters
|
||||
//iterable $formatters,
|
||||
//iterable $exportElementProvider
|
||||
) {
|
||||
$this->logger = $logger;
|
||||
$this->em = $em;
|
||||
$this->authorizationChecker = $authorizationChecker;
|
||||
$this->authorizationHelper = $authorizationHelper;
|
||||
$this->user = $tokenStorage->getToken()->getUser();
|
||||
$this->exports = iterator_to_array($exports);
|
||||
$this->aggregators = iterator_to_array($aggregators);
|
||||
$this->filters = iterator_to_array($filters);
|
||||
// NOTE: PHP crashes on the next line (exit error code 11). This is desactivated until further investigation
|
||||
//$this->formatters = iterator_to_array($formatters);
|
||||
|
||||
//foreach ($exportElementProvider as $prefix => $provider) {
|
||||
// $this->addExportElementsProvider($provider, $prefix);
|
||||
//}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,52 +149,17 @@ class ExportManager
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* add an aggregator.
|
||||
*
|
||||
* @internal used by DI
|
||||
*
|
||||
* @param string $alias
|
||||
*/
|
||||
public function addAggregator(AggregatorInterface $aggregator, $alias)
|
||||
{
|
||||
$this->aggregators[$alias] = $aggregator;
|
||||
}
|
||||
|
||||
/**
|
||||
* add an export.
|
||||
*
|
||||
* @internal used by DI
|
||||
*
|
||||
* @param DirectExportInterface|ExportInterface $export
|
||||
* @param type $alias
|
||||
*/
|
||||
public function addExport($export, $alias)
|
||||
{
|
||||
if ($export instanceof ExportInterface || $export instanceof DirectExportInterface) {
|
||||
$this->exports[$alias] = $export;
|
||||
} else {
|
||||
throw new InvalidArgumentException(sprintf(
|
||||
'The export with alias %s '
|
||||
. 'does not implements %s or %s.',
|
||||
$alias,
|
||||
ExportInterface::class,
|
||||
DirectExportInterface::class
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
public function addExportElementsProvider(ExportElementsProviderInterface $provider, $prefix)
|
||||
{
|
||||
foreach ($provider->getExportElements() as $suffix => $element) {
|
||||
$alias = $prefix . '_' . $suffix;
|
||||
|
||||
if ($element instanceof ExportInterface) {
|
||||
$this->addExport($element, $alias);
|
||||
$this->exports[$alias] = $element;
|
||||
} elseif ($element instanceof FilterInterface) {
|
||||
$this->addFilter($element, $alias);
|
||||
$this->filters[$alias] = $element;
|
||||
} elseif ($element instanceof AggregatorInterface) {
|
||||
$this->addAggregator($element, $alias);
|
||||
$this->aggregators[$alias] = $element;
|
||||
} elseif ($element instanceof FormatterInterface) {
|
||||
$this->addFormatter($element, $alias);
|
||||
} else {
|
||||
@@ -196,24 +169,12 @@ class ExportManager
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* add a Filter.
|
||||
*
|
||||
* @internal Normally used by the dependency injection
|
||||
*
|
||||
* @param string $alias
|
||||
*/
|
||||
public function addFilter(FilterInterface $filter, $alias)
|
||||
{
|
||||
$this->filters[$alias] = $filter;
|
||||
}
|
||||
|
||||
/**
|
||||
* add a formatter.
|
||||
*
|
||||
* @internal used by DI
|
||||
*
|
||||
* @param type $alias
|
||||
* @param string $alias
|
||||
*/
|
||||
public function addFormatter(FormatterInterface $formatter, $alias)
|
||||
{
|
||||
@@ -231,7 +192,6 @@ class ExportManager
|
||||
public function generate($exportAlias, array $pickedCentersData, array $data, array $formatterData)
|
||||
{
|
||||
$export = $this->getExport($exportAlias);
|
||||
//$qb = $this->em->createQueryBuilder();
|
||||
$centers = $this->getPickedCenters($pickedCentersData);
|
||||
|
||||
if ($export instanceof DirectExportInterface) {
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* Chill is a software for social workers.
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
@@ -9,6 +9,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Form\DataTransformer;
|
||||
|
||||
use Closure;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* Chill is a software for social workers.
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
@@ -9,6 +9,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Form\DataTransformer;
|
||||
|
||||
use Chill\MainBundle\Repository\LocationRepository;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* Chill is a software for social workers.
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
@@ -9,6 +9,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Form\DataTransformer;
|
||||
|
||||
use Chill\MainBundle\Repository\UserRepository;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* Chill is a software for social workers.
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
@@ -9,6 +9,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Form\DataTransformer;
|
||||
|
||||
use Chill\MainBundle\Repository\UserRepository;
|
||||
|
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Form\Type;
|
||||
|
||||
use Chill\MainBundle\Entity\LocationType;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class PickLocationTypeType extends AbstractType
|
||||
{
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver
|
||||
->setDefaults([
|
||||
'class' => LocationType::class,
|
||||
'choice_label' => function (LocationType $type) {
|
||||
return $this->translatableStringHelper->localize($type->getTitle());
|
||||
},
|
||||
'placeholder' => 'Pick a location type',
|
||||
'required' => false,
|
||||
'attr' => ['class' => 'select2'],
|
||||
'label' => 'Location type',
|
||||
'multiple' => false,
|
||||
])
|
||||
->setAllowedTypes('multiple', ['bool']);
|
||||
}
|
||||
|
||||
public function getParent(): string
|
||||
{
|
||||
return EntityType::class;
|
||||
}
|
||||
}
|
@@ -16,10 +16,9 @@ use Chill\MainBundle\Repository\LocationRepository;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class Select2UserLocationType extends AbstractType
|
||||
class PickUserLocationType extends AbstractType
|
||||
{
|
||||
private LocationRepository $locationRepository;
|
||||
|
||||
@@ -31,10 +30,10 @@ class Select2UserLocationType extends AbstractType
|
||||
$this->locationRepository = $locationRepository;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$builder
|
||||
->add('currentLocation', EntityType::class, [
|
||||
$resolver
|
||||
->setDefaults([
|
||||
'class' => Location::class,
|
||||
'choices' => $this->locationRepository->findByPublicLocations(),
|
||||
'choice_label' => function (Location $entity) {
|
||||
@@ -44,24 +43,15 @@ class Select2UserLocationType extends AbstractType
|
||||
},
|
||||
'placeholder' => 'Pick a location',
|
||||
'required' => false,
|
||||
'label' => $options['label'],
|
||||
'label_attr' => $options['label_attr'],
|
||||
'multiple' => $options['multiple'],
|
||||
'attr' => ['class' => 'select2'],
|
||||
]);
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver
|
||||
->setDefault('label', 'Current location')
|
||||
->setDefault('label_attr', [])
|
||||
->setDefault('multiple', false)
|
||||
'label' => 'Current location',
|
||||
'multiple' => false,
|
||||
])
|
||||
->setAllowedTypes('multiple', ['bool']);
|
||||
}
|
||||
|
||||
public function getBlockPrefix(): string
|
||||
public function getParent(): string
|
||||
{
|
||||
return 'select2_user_location_type';
|
||||
return EntityType::class;
|
||||
}
|
||||
}
|
@@ -1,59 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Form\Type;
|
||||
|
||||
use Chill\MainBundle\Entity\LocationType;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class Select2LocationTypeType extends AbstractType
|
||||
{
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder->add('locationtype', EntityType::class, [
|
||||
'class' => LocationType::class,
|
||||
'choice_label' => function (LocationType $type) {
|
||||
return $this->translatableStringHelper->localize($type->getTitle());
|
||||
},
|
||||
'placeholder' => 'Pick a location type',
|
||||
'required' => false,
|
||||
'label' => $options['label'],
|
||||
'label_attr' => $options['label_attr'],
|
||||
'multiple' => $options['multiple'],
|
||||
'attr' => ['class' => 'select2'],
|
||||
]);
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver
|
||||
->setDefault('label', 'Location type')
|
||||
->setDefault('label_attr', [])
|
||||
->setDefault('multiple', false)
|
||||
->setAllowedTypes('multiple', ['bool']);
|
||||
}
|
||||
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'select2_location_type_type';
|
||||
}
|
||||
}
|
24
src/Bundle/ChillMainBundle/Form/UserCurrentLocationType.php
Normal file
24
src/Bundle/ChillMainBundle/Form/UserCurrentLocationType.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Form;
|
||||
|
||||
use Chill\MainBundle\Form\Type\PickUserLocationType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class UserCurrentLocationType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder->add('currentLocation', PickUserLocationType::class);
|
||||
}
|
||||
}
|
@@ -5,6 +5,10 @@ ul.record_actions {
|
||||
justify-content: flex-end;
|
||||
padding: 0.5em 0;
|
||||
|
||||
&.inline {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
&.column {
|
||||
flex-direction: column;
|
||||
}
|
||||
@@ -18,6 +22,13 @@ ul.record_actions {
|
||||
padding-right: 1em;
|
||||
}
|
||||
|
||||
&.small {
|
||||
.btn {
|
||||
padding: .25rem .5rem;
|
||||
font-size: .75rem;
|
||||
}
|
||||
}
|
||||
|
||||
li {
|
||||
display: inline-block;
|
||||
list-style-type: none;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* Chill is a software for social workers.
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
@@ -9,6 +9,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Service\ShortMessage;
|
||||
|
||||
class NullShortMessageSender implements ShortMessageSenderInterface
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* Chill is a software for social workers.
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
@@ -9,6 +9,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Service\ShortMessage;
|
||||
|
||||
use libphonenumber\PhoneNumber;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* Chill is a software for social workers.
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
@@ -9,6 +9,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Service\ShortMessage;
|
||||
|
||||
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* Chill is a software for social workers.
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
@@ -9,6 +9,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Service\ShortMessage;
|
||||
|
||||
interface ShortMessageSenderInterface
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* Chill is a software for social workers.
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
@@ -9,6 +9,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Service\ShortMessage;
|
||||
|
||||
class ShortMessageTransporter implements ShortMessageTransporterInterface
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* Chill is a software for social workers.
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
@@ -9,6 +9,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Service\ShortMessage;
|
||||
|
||||
interface ShortMessageTransporterInterface
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* Chill is a software for social workers.
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
@@ -9,6 +9,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Service\ShortMessageOvh;
|
||||
|
||||
use Chill\MainBundle\Service\ShortMessage\ShortMessage;
|
||||
|
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DQL;
|
||||
|
||||
use Chill\MainBundle\Entity\Country;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
final class JsonExtractTest extends KernelTestCase
|
||||
{
|
||||
private EntityManagerInterface $em;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->em = self::$container->get(EntityManagerInterface::class);
|
||||
}
|
||||
|
||||
public function dataGenerateDql(): iterable
|
||||
{
|
||||
yield ['SELECT JSON_EXTRACT(c.name, \'fr\') FROM ' . Country::class . ' c', []];
|
||||
|
||||
yield ['SELECT JSON_EXTRACT(c.name, :lang) FROM ' . Country::class . ' c', ['lang' => 'fr']];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider dataGenerateDql
|
||||
*/
|
||||
public function testJsonExtract(string $dql, array $args)
|
||||
{
|
||||
$results = $this->em->createQuery($dql)
|
||||
->setMaxResults(2)
|
||||
->setParameters($args)
|
||||
->getResult();
|
||||
|
||||
$this->assertIsArray($results, 'simply test that the query return a result');
|
||||
}
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* Chill is a software for social workers.
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
@@ -9,6 +9,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Form\DataTransformer;
|
||||
|
||||
use Chill\MainBundle\Form\DataTransformer\IdToEntityDataTransformer;
|
||||
|
@@ -72,7 +72,7 @@ final class ValidPhonenumber extends ConstraintValidator
|
||||
}
|
||||
|
||||
if (false === $isValid) {
|
||||
$this->context->addViolation($message, ['%phonenumber%' => $value]);
|
||||
$this->context->addViolation($message, ['%phonenumber%' => $value, '%formatted%' => $this->phonenumberHelper->format($value)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -91,6 +91,14 @@ services:
|
||||
Chill\MainBundle\Export\ExportManager:
|
||||
autoconfigure: true
|
||||
autowire: true
|
||||
arguments:
|
||||
$exports: !tagged_iterator { tag: chill.export, index_by: alias }
|
||||
$aggregators: !tagged_iterator { tag: chill.export_aggregator, index_by: alias }
|
||||
$filters: !tagged_iterator { tag: chill.export_filter, index_by: alias }
|
||||
# for an unknown reason, iterator_to_array($formatter) cause a segmentation fault error (php-fpm code 11). removed temporarily
|
||||
# $formatters: !tagged_iterator { tag: chill.export_formatter, index_by: alias }
|
||||
# remove until we can properly test it
|
||||
# $exportElementProvider: !tagged_iterator { tag: chill.export_elements_provider, index_by: prefix }
|
||||
|
||||
Chill\MainBundle\Security\Resolver\CenterResolverDispatcherInterface: '@Chill\MainBundle\Security\Resolver\CenterResolverDispatcher'
|
||||
|
||||
|
@@ -130,14 +130,6 @@ services:
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
|
||||
Chill\MainBundle\Form\Type\Select2UserLocationType:
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
|
||||
Chill\MainBundle\Form\Type\Select2LocationTypeType:
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
|
||||
Chill\MainBundle\Form\Type\LocationFormType: ~
|
||||
|
||||
Chill\MainBundle\Form\WorkflowStepType: ~
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
* Chill is a software for social workers.
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
@@ -9,6 +9,13 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\Migrations\Main;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
|
@@ -189,6 +189,7 @@ Main scope: Cercle
|
||||
Main center: Centre
|
||||
user job: Métier de l'utilisateur
|
||||
Job: Métier
|
||||
Jobs: Métiers
|
||||
Choose a main center: Choisir un centre
|
||||
Choose a main scope: Choisir un cercle
|
||||
choose a job: Choisir un métier
|
||||
|
Reference in New Issue
Block a user