diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationFilter.php index ed591e957..5cdce5b31 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationFilter.php @@ -50,7 +50,7 @@ class LocationFilter implements FilterInterface { $builder->add('accepted_location', PickUserLocationType::class, [ 'multiple' => true, - 'label' => 'pick location' + 'label' => 'pick location', ]); } diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/_list_item.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/_list_item.html.twig index 3a4749f3c..47dc8518c 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/_list_item.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/_list_item.html.twig @@ -137,12 +137,27 @@ {{ activity.comment|chill_entity_render_box({ 'disable_markdown': false, 'limit_lines': 3, - 'metadata': false + 'metadata': false, }) }} {% endif %} + {% if is_granted('CHILL_ACTIVITY_SEE_DETAILS', activity) and activity.privateComment.hasCommentForUser(app.user) %} +
+
+

{{ 'Private comment'|trans }}

+
+
+
+
+ {{ activity.privateComment.comments[app.user.id]|chill_markdown_to_html }} +
+
+
+
+ {% endif %} + {# Only if ACL SEE_DETAILS AND/OR only on template SHOW ?? durationTime travelTime diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/ListAsideActivity.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/ListAsideActivity.php index 8df58ca12..976f4171c 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Export/ListAsideActivity.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Export/ListAsideActivity.php @@ -13,7 +13,6 @@ namespace Chill\AsideActivityBundle\Export\Export; use Chill\AsideActivityBundle\Entity\AsideActivity; use Chill\AsideActivityBundle\Export\Declarations; -use Chill\AsideActivityBundle\Form\AsideActivityCategoryType; use Chill\AsideActivityBundle\Repository\AsideActivityCategoryRepository; use Chill\AsideActivityBundle\Security\AsideActivityVoter; use Chill\AsideActivityBundle\Templating\Entity\CategoryRender; @@ -25,32 +24,32 @@ use Chill\MainBundle\Export\Helper\UserHelper; use Chill\MainBundle\Export\ListInterface; use Chill\MainBundle\Repository\CenterRepositoryInterface; use Chill\MainBundle\Repository\ScopeRepositoryInterface; -use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\MainBundle\Templating\TranslatableStringHelperInterface; -use Closure; +use DateTimeInterface; use Doctrine\ORM\AbstractQuery; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\QueryBuilder; +use LogicException; use Symfony\Component\Form\FormBuilderInterface; final class ListAsideActivity implements ListInterface, GroupedExportInterface { - private EntityManagerInterface $em; - - private UserHelper $userHelper; - - private DateTimeHelper $dateTimeHelper; - - private ScopeRepositoryInterface $scopeRepository; - - private CenterRepositoryInterface $centerRepository; - private AsideActivityCategoryRepository $asideActivityCategoryRepository; private CategoryRender $categoryRender; + private CenterRepositoryInterface $centerRepository; + + private DateTimeHelper $dateTimeHelper; + + private EntityManagerInterface $em; + + private ScopeRepositoryInterface $scopeRepository; + private TranslatableStringHelperInterface $translatableStringHelper; + private UserHelper $userHelper; + public function __construct( EntityManagerInterface $em, DateTimeHelper $dateTimeHelper, @@ -85,11 +84,6 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface return 'export.aside_activity.List of aside activities'; } - public function getTitle() - { - return 'export.aside_activity.List of aside activities'; - } - public function getGroup(): string { return 'export.Exports of aside activities'; @@ -100,15 +94,16 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface switch ($key) { case 'id': case 'note': - return function ($value) use ($key) { + return static function ($value) use ($key) { if ('_header' === $value) { return 'export.aside_activity.' . $key; } return $value ?? ''; }; + case 'duration': - return function ($value) use ($key) { + return static function ($value) use ($key) { if ('_header' === $value) { return 'export.aside_activity.' . $key; } @@ -117,7 +112,7 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface return ''; } - if ($value instanceof \DateTimeInterface) { + if ($value instanceof DateTimeInterface) { return $value->format('H:i:s'); } @@ -127,7 +122,7 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface case 'createdAt': case 'updatedAt': case 'date': - return $this->dateTimeHelper->getLabel('export.aside_activity.'.$key); + return $this->dateTimeHelper->getLabel('export.aside_activity.' . $key); case 'agent_id': case 'creator_id': @@ -174,7 +169,7 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface }; default: - throw new \LogicException('this key is not supported : ' . $key); + throw new LogicException('this key is not supported : ' . $key); } } @@ -191,7 +186,7 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface 'aside_activity_type', 'date', 'duration', - 'note' + 'note', ]; } @@ -204,6 +199,11 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface return $query->getQuery()->getResult(AbstractQuery::HYDRATE_ARRAY); } + public function getTitle() + { + return 'export.aside_activity.List of aside activities'; + } + public function getType(): string { return Declarations::ASIDE_ACTIVITY_TYPE; @@ -213,8 +213,7 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface { $qb = $this->em->createQueryBuilder() ->from(AsideActivity::class, 'aside') - ->leftJoin('aside.agent', 'agent') - ; + ->leftJoin('aside.agent', 'agent'); $qb ->addSelect('aside.id AS id') @@ -227,8 +226,7 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface ->addSelect('IDENTITY(aside.type) AS aside_activity_type') ->addSelect('aside.date') ->addSelect('aside.duration') - ->addSelect('aside.note') - ; + ->addSelect('aside.note'); return $qb; } diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByDateFilter.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByDateFilter.php index 2d49b3d57..7a1b6f4dc 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByDateFilter.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByDateFilter.php @@ -17,7 +17,6 @@ use Chill\MainBundle\Form\Type\Export\FilterType; use Chill\MainBundle\Form\Type\PickRollingDateType; use Chill\MainBundle\Service\RollingDate\RollingDate; use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface; -use Doctrine\ORM\Query\Expr\Andx; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormError; diff --git a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserFilter.php b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserFilter.php index c2a3b4c54..795c813cd 100644 --- a/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserFilter.php +++ b/src/Bundle/ChillAsideActivityBundle/src/Export/Filter/ByUserFilter.php @@ -15,7 +15,6 @@ use Chill\AsideActivityBundle\Export\Declarations; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\PickUserDynamicType; use Chill\MainBundle\Templating\Entity\UserRender; -use Doctrine\ORM\Query\Expr\Andx; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; diff --git a/src/Bundle/ChillBudgetBundle/Calculator/CalculatorManager.php b/src/Bundle/ChillBudgetBundle/Calculator/CalculatorManager.php index a37ac68dc..934c22e36 100644 --- a/src/Bundle/ChillBudgetBundle/Calculator/CalculatorManager.php +++ b/src/Bundle/ChillBudgetBundle/Calculator/CalculatorManager.php @@ -29,10 +29,10 @@ class CalculatorManager public function addCalculator(CalculatorInterface $calculator, bool $default) { - $this->calculators[$calculator::getAlias()] = $calculator; + $this->calculators[$calculator->getAlias()] = $calculator; if ($default) { - $this->defaultCalculator[] = $calculator::getAlias(); + $this->defaultCalculator[] = $calculator->getAlias(); } } @@ -50,7 +50,7 @@ class CalculatorManager $result = $calculator->calculate($elements); if (null !== $result) { - $results[$calculator::getAlias()] = $result; + $results[$calculator->getAlias()] = $result; } } diff --git a/src/Bundle/ChillBudgetBundle/Form/Admin/ChargeKindType.php b/src/Bundle/ChillBudgetBundle/Form/Admin/ChargeKindType.php index 59adf49af..c3c2a66bf 100644 --- a/src/Bundle/ChillBudgetBundle/Form/Admin/ChargeKindType.php +++ b/src/Bundle/ChillBudgetBundle/Form/Admin/ChargeKindType.php @@ -30,7 +30,7 @@ class ChargeKindType extends AbstractType ]) ->add('kind', TextType::class, [ 'label' => 'budget.admin.form.Charge_kind_key', - 'help' => 'budget.admin.form.This kind must contains only alphabeticals characters, and dashes. This string is in use during document generation. Changes may have side effect on document' + 'help' => 'budget.admin.form.This kind must contains only alphabeticals characters, and dashes. This string is in use during document generation. Changes may have side effect on document', ]) ->add('ordering', NumberType::class) ->add('isActive', CheckboxType::class, [ diff --git a/src/Bundle/ChillBudgetBundle/Form/Admin/ResourceKindType.php b/src/Bundle/ChillBudgetBundle/Form/Admin/ResourceKindType.php index 0605b8731..41d3a8b53 100644 --- a/src/Bundle/ChillBudgetBundle/Form/Admin/ResourceKindType.php +++ b/src/Bundle/ChillBudgetBundle/Form/Admin/ResourceKindType.php @@ -30,7 +30,7 @@ class ResourceKindType extends AbstractType ]) ->add('kind', TextType::class, [ 'label' => 'budget.admin.form.Resource_kind_key', - 'help' => 'budget.admin.form.This kind must contains only alphabeticals characters, and dashes. This string is in use during document generation. Changes may have side effect on document' + 'help' => 'budget.admin.form.This kind must contains only alphabeticals characters, and dashes. This string is in use during document generation. Changes may have side effect on document', ]) ->add('ordering', NumberType::class) ->add('isActive', CheckboxType::class, [ diff --git a/src/Bundle/ChillBudgetBundle/Repository/ChargeKindRepository.php b/src/Bundle/ChillBudgetBundle/Repository/ChargeKindRepository.php index 10d02749a..01f5cd737 100644 --- a/src/Bundle/ChillBudgetBundle/Repository/ChargeKindRepository.php +++ b/src/Bundle/ChillBudgetBundle/Repository/ChargeKindRepository.php @@ -49,8 +49,7 @@ final class ChargeKindRepository implements ChargeKindRepositoryInterface ->where($qb->expr()->eq('c.isActive', 'true')) ->orderBy('c.ordering', 'ASC') ->getQuery() - ->getResult() - ; + ->getResult(); } /** diff --git a/src/Bundle/ChillBudgetBundle/Repository/ChargeKindRepositoryInterface.php b/src/Bundle/ChillBudgetBundle/Repository/ChargeKindRepositoryInterface.php index 5099a5674..fb8c9dc35 100644 --- a/src/Bundle/ChillBudgetBundle/Repository/ChargeKindRepositoryInterface.php +++ b/src/Bundle/ChillBudgetBundle/Repository/ChargeKindRepositoryInterface.php @@ -28,8 +28,6 @@ interface ChargeKindRepositoryInterface extends ObjectRepository */ public function findAllActive(): array; - public function findOneByKind(string $kind): ?ChargeKind; - /** * @return ChargeType[] */ @@ -45,5 +43,7 @@ interface ChargeKindRepositoryInterface extends ObjectRepository public function findOneBy(array $criteria): ?ChargeKind; + public function findOneByKind(string $kind): ?ChargeKind; + public function getClassName(): string; } diff --git a/src/Bundle/ChillBudgetBundle/Repository/ResourceKindRepository.php b/src/Bundle/ChillBudgetBundle/Repository/ResourceKindRepository.php index 36cecd2ec..42e5418fc 100644 --- a/src/Bundle/ChillBudgetBundle/Repository/ResourceKindRepository.php +++ b/src/Bundle/ChillBudgetBundle/Repository/ResourceKindRepository.php @@ -49,8 +49,7 @@ final class ResourceKindRepository implements ResourceKindRepositoryInterface ->where($qb->expr()->eq('r.isActive', 'true')) ->orderBy('r.ordering', 'ASC') ->getQuery() - ->getResult() - ; + ->getResult(); } public function findOneByKind(string $kind): ?ResourceKind diff --git a/src/Bundle/ChillBudgetBundle/Repository/ResourceRepository.php b/src/Bundle/ChillBudgetBundle/Repository/ResourceRepository.php index b3f0a41da..12f9fd52f 100644 --- a/src/Bundle/ChillBudgetBundle/Repository/ResourceRepository.php +++ b/src/Bundle/ChillBudgetBundle/Repository/ResourceRepository.php @@ -34,7 +34,7 @@ class ResourceRepository extends EntityRepository //->andWhere('c.startDate < :date') // TODO: there is a misconception here, the end date must be lower or null. startDate are never null //->andWhere('c.startDate < :date OR c.startDate IS NULL'); - ; +; if (null !== $sort) { $qb->orderBy($sort); diff --git a/src/Bundle/ChillBudgetBundle/Service/Summary/SummaryBudget.php b/src/Bundle/ChillBudgetBundle/Service/Summary/SummaryBudget.php index 2f401f1ec..ad2a014ed 100644 --- a/src/Bundle/ChillBudgetBundle/Service/Summary/SummaryBudget.php +++ b/src/Bundle/ChillBudgetBundle/Service/Summary/SummaryBudget.php @@ -13,9 +13,7 @@ namespace Chill\BudgetBundle\Service\Summary; use Chill\BudgetBundle\Entity\ChargeKind; use Chill\BudgetBundle\Entity\ResourceKind; -use Chill\BudgetBundle\Repository\ChargeKindRepository; use Chill\BudgetBundle\Repository\ChargeKindRepositoryInterface; -use Chill\BudgetBundle\Repository\ResourceKindRepository; use Chill\BudgetBundle\Repository\ResourceKindRepositoryInterface; use Chill\MainBundle\Templating\TranslatableStringHelperInterface; use Chill\PersonBundle\Entity\Household\Household; diff --git a/src/Bundle/ChillBudgetBundle/Tests/Service/Summary/SummaryBudgetTest.php b/src/Bundle/ChillBudgetBundle/Tests/Service/Summary/SummaryBudgetTest.php index cf8c00efe..7fcda6b11 100644 --- a/src/Bundle/ChillBudgetBundle/Tests/Service/Summary/SummaryBudgetTest.php +++ b/src/Bundle/ChillBudgetBundle/Tests/Service/Summary/SummaryBudgetTest.php @@ -20,12 +20,15 @@ use Chill\MainBundle\Templating\TranslatableStringHelperInterface; use Chill\PersonBundle\Entity\Household\Household; use Chill\PersonBundle\Entity\Household\HouseholdMember; use Chill\PersonBundle\Entity\Person; +use DateTimeImmutable; use Doctrine\ORM\AbstractQuery; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Query; use PHPUnit\Framework\TestCase; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; +use ReflectionClass; +use RuntimeException; /** * @internal @@ -47,10 +50,9 @@ final class SummaryBudgetTest extends TestCase ], ]); $queryCharges->setParameters(Argument::type('array')) - ->will(function ($args, $query) { + ->will(static function ($args, $query) { return $query; - }) - ; + }); $queryResources = $this->prophesize(AbstractQuery::class); $queryResources->getResult()->willReturn([ @@ -61,23 +63,23 @@ final class SummaryBudgetTest extends TestCase ], ]); $queryResources->setParameters(Argument::type('array')) - ->will(function ($args, $query) { + ->will(static function ($args, $query) { return $query; - }) - ; + }); $em = $this->prophesize(EntityManagerInterface::class); $em->createNativeQuery(Argument::type('string'), Argument::type(Query\ResultSetMapping::class)) - ->will(function ($args) use ($queryResources, $queryCharges) { + ->will(static function ($args) use ($queryResources, $queryCharges) { if (false !== strpos($args[0], 'chill_budget.resource')) { return $queryResources->reveal(); } + if (false !== strpos($args[0], 'chill_budget.charge')) { return $queryCharges->reveal(); } - throw new \RuntimeException('this query does not have a stub counterpart: '.$args[0]); - }) - ; + + throw new RuntimeException('this query does not have a stub counterpart: ' . $args[0]); + }); $chargeRepository = $this->prophesize(ChargeKindRepositoryInterface::class); $chargeRepository->findAll()->willReturn([ @@ -98,24 +100,23 @@ final class SummaryBudgetTest extends TestCase $resourceRepository->findOneByKind('misc')->willReturn($misc); $translatableStringHelper = $this->prophesize(TranslatableStringHelperInterface::class); - $translatableStringHelper->localize(Argument::type('array'))->will(function ($arg) { + $translatableStringHelper->localize(Argument::type('array'))->will(static function ($arg) { return $arg[0]['fr']; }); $person = new Person(); - $personReflection = new \ReflectionClass($person); + $personReflection = new ReflectionClass($person); $personIdReflection = $personReflection->getProperty('id'); $personIdReflection->setAccessible(true); $personIdReflection->setValue($person, 1); $household = new Household(); - $householdReflection = new \ReflectionClass($household); + $householdReflection = new ReflectionClass($household); $householdId = $householdReflection->getProperty('id'); $householdId->setAccessible(true); $householdId->setValue($household, 1); $householdMember = (new HouseholdMember())->setPerson($person) - ->setStartDate(new \DateTimeImmutable('1 month ago')) - ; + ->setStartDate(new DateTimeImmutable('1 month ago')); $household->addMember($householdMember); $summaryBudget = new SummaryBudget( diff --git a/src/Bundle/ChillBudgetBundle/migrations/Version20230209161546.php b/src/Bundle/ChillBudgetBundle/migrations/Version20230209161546.php index 776d08edb..4495db8a7 100644 --- a/src/Bundle/ChillBudgetBundle/migrations/Version20230209161546.php +++ b/src/Bundle/ChillBudgetBundle/migrations/Version20230209161546.php @@ -16,6 +16,12 @@ use Doctrine\Migrations\AbstractMigration; final class Version20230209161546 extends AbstractMigration { + public function down(Schema $schema): void + { + $this->addSql('DROP INDEX resource_kind_unique_type_idx'); + $this->addSql('DROP INDEX charge_kind_unique_type_idx'); + } + public function getDescription(): string { return 'Budget: add unique constraint on kind for charge_kind and resource_kind'; @@ -28,10 +34,4 @@ final class Version20230209161546 extends AbstractMigration $this->addSql('CREATE UNIQUE INDEX resource_kind_unique_type_idx ON chill_budget.resource_type (kind);'); $this->addSql('CREATE UNIQUE INDEX charge_kind_unique_type_idx ON chill_budget.charge_type (kind);'); } - - public function down(Schema $schema): void - { - $this->addSql('DROP INDEX resource_kind_unique_type_idx'); - $this->addSql('DROP INDEX charge_kind_unique_type_idx'); - } } diff --git a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php index 4e89861dd..ef2d2d585 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php +++ b/src/Bundle/ChillDocGeneratorBundle/Controller/DocGeneratorTemplateController.php @@ -39,6 +39,7 @@ use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Serializer\Normalizer\AbstractNormalizer; use Symfony\Contracts\HttpClient\HttpClientInterface; use function strlen; +use const JSON_PRETTY_PRINT; final class DocGeneratorTemplateController extends AbstractController { @@ -255,7 +256,7 @@ final class DocGeneratorTemplateController extends AbstractController // if is test, render the data or generate the doc if ($isTest && isset($form) && $form['show_data']->getData()) { return $this->render('@ChillDocGenerator/Generator/debug_value.html.twig', [ - 'datas' => json_encode($context->getData($template, $entity, $contextGenerationData), JSON_PRETTY_PRINT) + 'datas' => json_encode($context->getData($template, $entity, $contextGenerationData), JSON_PRETTY_PRINT), ]); } if ($isTest) { diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/GeneratorException.php b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/GeneratorException.php index 2124ee420..4360413b4 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/GeneratorException.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/GeneratorException.php @@ -11,18 +11,21 @@ declare(strict_types=1); namespace Chill\DocGeneratorBundle\Service\Generator; -class GeneratorException extends \RuntimeException +use RuntimeException; +use Throwable; + +class GeneratorException extends RuntimeException { /** * @var list */ private array $errors; - public function __construct(array $errors = [], \Throwable $previous = null) + public function __construct(array $errors = [], ?Throwable $previous = null) { $this->errors = $errors; parent::__construct( - "Could not generate the document", + 'Could not generate the document', 15252, $previous ); diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/ObjectReadyException.php b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/ObjectReadyException.php index 4d17f0cf8..37540a2f8 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/ObjectReadyException.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/ObjectReadyException.php @@ -11,10 +11,12 @@ declare(strict_types=1); namespace Chill\DocGeneratorBundle\Service\Generator; -class ObjectReadyException extends \RuntimeException +use RuntimeException; + +class ObjectReadyException extends RuntimeException { public function __construct() { - parent::__construct("object is already ready", 6698856); + parent::__construct('object is already ready', 6698856); } } diff --git a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/RelatedEntityNotFoundException.php b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/RelatedEntityNotFoundException.php index f504f3212..9cca0bcda 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Service/Generator/RelatedEntityNotFoundException.php +++ b/src/Bundle/ChillDocGeneratorBundle/Service/Generator/RelatedEntityNotFoundException.php @@ -11,12 +11,14 @@ declare(strict_types=1); namespace Chill\DocGeneratorBundle\Service\Generator; -class RelatedEntityNotFoundException extends \RuntimeException +use RuntimeException; + +class RelatedEntityNotFoundException extends RuntimeException { - public function __construct(string $relatedEntityClass, int $relatedEntityId, \Throwable $previous = null) + public function __construct(string $relatedEntityClass, int $relatedEntityId, ?\Throwable $previous = null) { parent::__construct( - sprintf("Related entity not found: %s, %s", $relatedEntityClass, $relatedEntityId), + sprintf('Related entity not found: %s, %s', $relatedEntityClass, $relatedEntityId), 99876652, $previous ); diff --git a/src/Bundle/ChillMainBundle/ChillMainBundle.php b/src/Bundle/ChillMainBundle/ChillMainBundle.php index 9fd6a9891..9e276311d 100644 --- a/src/Bundle/ChillMainBundle/ChillMainBundle.php +++ b/src/Bundle/ChillMainBundle/ChillMainBundle.php @@ -72,7 +72,6 @@ class ChillMainBundle extends Bundle $container->addCompilerPass(new NotificationCounterCompilerPass()); $container->addCompilerPass(new MenuCompilerPass()); $container->addCompilerPass(new ACLFlagsCompilerPass()); - $container->addCompilerPass(new GroupingCenterCompilerPass()); $container->addCompilerPass(new CRUDControllerCompilerPass()); $container->addCompilerPass(new ShortMessageCompilerPass()); } diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/GroupingCenterCompilerPass.php b/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/GroupingCenterCompilerPass.php deleted file mode 100644 index f0c06564b..000000000 --- a/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/GroupingCenterCompilerPass.php +++ /dev/null @@ -1,37 +0,0 @@ -hasDefinition('chill.main.form.pick_centers_type')) { - throw new LogicException('The service chill.main.form.pick_centers_type does ' - . 'not exists in container'); - } - - $pickCenterType = $container->getDefinition('chill.main.form.pick_centers_type'); - - foreach ($container->findTaggedServiceIds('chill.grouping_center') as $serviceId => $tagged) { - $pickCenterType->addMethodCall( - 'addGroupingCenter', - [new Reference($serviceId)] - ); - } - } -} diff --git a/src/Bundle/ChillMainBundle/Export/ExportInterface.php b/src/Bundle/ChillMainBundle/Export/ExportInterface.php index 79b59d241..95122ec0a 100644 --- a/src/Bundle/ChillMainBundle/Export/ExportInterface.php +++ b/src/Bundle/ChillMainBundle/Export/ExportInterface.php @@ -11,7 +11,6 @@ declare(strict_types=1); namespace Chill\MainBundle\Export; -use Closure; use Doctrine\ORM\QueryBuilder; /** diff --git a/src/Bundle/ChillMainBundle/Export/Helper/DateTimeHelper.php b/src/Bundle/ChillMainBundle/Export/Helper/DateTimeHelper.php index 648632e15..1c2c99083 100644 --- a/src/Bundle/ChillMainBundle/Export/Helper/DateTimeHelper.php +++ b/src/Bundle/ChillMainBundle/Export/Helper/DateTimeHelper.php @@ -12,6 +12,7 @@ declare(strict_types=1); namespace Chill\MainBundle\Export\Helper; use DateTime; +use DateTimeInterface; use Exception; use Symfony\Contracts\Translation\TranslatorInterface; @@ -35,7 +36,7 @@ class DateTimeHelper return ''; } - if ($value instanceof \DateTimeInterface) { + if ($value instanceof DateTimeInterface) { return $value; } diff --git a/src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php b/src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php index 55157b1ab..8287a8814 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/Export/PickCenterType.php @@ -11,7 +11,6 @@ declare(strict_types=1); namespace Chill\MainBundle\Form\Type\Export; -use Chill\MainBundle\Center\GroupingCenterInterface; use Chill\MainBundle\Entity\Center; use Chill\MainBundle\Entity\Regroupment; use Chill\MainBundle\Export\ExportManager; @@ -72,8 +71,10 @@ final class PickCenterType extends AbstractType return $c->getName(); }, 'data' => $centers, - ]) - ->add('regroupment', EntityType::class, [ + ]); + + if (count($this->regroupmentRepository->findAllActive()) > 0) { + $builder->add('regroupment', EntityType::class, [ 'class' => Regroupment::class, 'label' => 'regroupment', 'multiple' => true, @@ -83,6 +84,7 @@ final class PickCenterType extends AbstractType return $r->getName(); }, ]); + } $builder->setDataMapper(new ExportPickCenterDataMapper()); } diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue index 6dcca0d8a..28a51c4e6 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue @@ -233,7 +233,7 @@ export default { // console.log('data original', data); data.parent = {type: "thirdparty", id: this.parent.id}; data.civility = data.civility !== null ? {type: 'chill_main_civility', id: data.civility.id} : null; - data.profession = data.profession !== null ? {type: 'third_party_profession', id: data.profession.id} : null; + data.profession = data.profession !== '' ? data.profession : ''; } else { type = this.$refs.castNew.radioType; data = this.$refs.castNew.castDataByType(); @@ -241,8 +241,8 @@ export default { if (typeof data.civility !== 'undefined' && null !== data.civility) { data.civility = data.civility !== null ? {type: 'chill_main_civility', id: data.civility.id} : null; } - if (typeof data.profession !== 'undefined' && null !== data.profession) { - data.profession = data.profession !== null ? {type: 'third_party_profession', id: data.profession.id} : null; + if (typeof data.profession !== 'undefined' && '' !== data.profession) { + data.profession = data.profession !== '' ? data.profession : ''; } // console.log('onthefly data', data); } diff --git a/src/Bundle/ChillMainBundle/Resources/views/Export/new_centers_step.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Export/new_centers_step.html.twig index e08ec84d9..9e37dc2cd 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Export/new_centers_step.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Export/new_centers_step.html.twig @@ -41,9 +41,10 @@

{{ 'Center'|trans }}

{{ form_widget(form.centers.center) }} -

{{ 'Pick aggregated centers'|trans }}

- {{ form_widget(form.centers.regroupment) }} - + {% if form.centers.regroupment is defined %} +

{{ 'Pick aggregated centers'|trans }}

+ {{ form_widget(form.centers.regroupment) }} + {% endif %}

{{ form_widget(form.submit, { 'attr' : { 'class' : 'btn btn-action btn-create' }, 'label' : 'Go to export options' } ) }}

diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserJobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserJobFilter.php index b9d0d0b15..05d84d7b2 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserJobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/UserJobFilter.php @@ -11,7 +11,6 @@ declare(strict_types=1); namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters; -use Chill\MainBundle\Entity\User; use Chill\MainBundle\Entity\UserJob; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\PickRollingDateType; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Referrer.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Referrer.vue index c0093fa77..b16e8828a 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Referrer.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Referrer.vue @@ -2,6 +2,29 @@

{{ $t('referrer.title') }}

+ + + + + + + + + +