diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fda3903f..deb111c78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,8 +13,8 @@ and this project adheres to * [parcours] autosave of the pinned comment for draft accompanying course (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/477) * [main] filter user job in undispatch acc period to assign (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/472) - - +* [main] filter user job in undispatch acc period to assign (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/472) +* [person] Add url in accompanying period work evaluations entity and form (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/476) * [person] Add document generation in admin and in person/{id}/document (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/464) * [activity] do not override location if already exist (when validating new activity) (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/470) * [parcours] Toggle emergency/intensity only by referrer (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/442) @@ -32,6 +32,14 @@ and this project adheres to * [confidential] Fix position of toggle button so it does not cover text nor fall outside of box (no issue) * [parcours] Fix edit of both thirdparty and contact name (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/474) * [template] do not list inactive templates (for doc generator) +* [household] bugfix if position of member is null, renderbox no longer throws an error (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/480) +* [parcours] location cannot be removed if linked to a user (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/478) +* [person] email added to twig personRenderbox (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/490) +* [person] Add link to current household in person banner (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/484) +* [person] Change 'personne' with 'usager' and '&' with 'ET' (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/499) +* [thirdparty] Add parameter condition to display centers or not (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/500) +* [phonenumber] Remove placeholder in phonenumber field (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/496) +* [contact] add contact button color changed plus the pipe at the side removed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/506) ## Test releases diff --git a/phpstan-types.neon b/phpstan-types.neon index ed2de3c91..ddde5cc03 100644 --- a/phpstan-types.neon +++ b/phpstan-types.neon @@ -350,11 +350,6 @@ parameters: count: 6 path: src/Bundle/ChillPersonBundle/Command/ImportPeopleFromCSVCommand.php - - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" - count: 2 - path: src/Bundle/ChillPersonBundle/Entity/PersonPhone.php - - message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" count: 1 diff --git a/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php b/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php index e3cc9c408..3d7b95c61 100644 --- a/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php +++ b/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php @@ -12,6 +12,7 @@ declare(strict_types=1); namespace Chill\DocStoreBundle\Workflow; use Chill\DocStoreBundle\Entity\AccompanyingCourseDocument; +use Chill\DocStoreBundle\Security\Authorization\AccompanyingCourseDocumentVoter; use Chill\MainBundle\Entity\Workflow\EntityWorkflow; use Chill\MainBundle\Workflow\EntityWorkflowHandlerInterface; use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation; @@ -36,6 +37,13 @@ class AccompanyingCourseDocumentWorkflowHandler implements EntityWorkflowHandler $this->translator = $translator; } + public function getDeletionRoles(): array + { + return [ + AccompanyingCourseDocumentVoter::DELETE, + ]; + } + public function getEntityData(EntityWorkflow $entityWorkflow, array $options = []): array { $course = $this->getRelatedEntity($entityWorkflow) @@ -66,6 +74,18 @@ class AccompanyingCourseDocumentWorkflowHandler implements EntityWorkflowHandler return $this->repository->find($entityWorkflow->getRelatedEntityId()); } + /** + * @param AccompanyingCourseDocument $object + * + * @return array[] + */ + public function getRelatedObjects(object $object): array + { + return [ + ['entityClass' => AccompanyingCourseDocument::class, 'entityId' => $object->getId()], + ]; + } + public function getRoleShow(EntityWorkflow $entityWorkflow): ?string { return null; @@ -84,6 +104,11 @@ class AccompanyingCourseDocumentWorkflowHandler implements EntityWorkflowHandler ]; } + public function isObjectSupported(object $object): bool + { + return $object instanceof AccompanyingCourseDocument; + } + public function supports(EntityWorkflow $entityWorkflow, array $options = []): bool { return $entityWorkflow->getRelatedEntityClass() === AccompanyingCourseDocument::class; diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php index 5ad7348ee..09668f0e3 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php @@ -256,6 +256,13 @@ class ChillMainExtension extends Extension implements 'channels' => ['chill'], ]); + $container->prependExtensionConfig('security', [ + 'access_decision_manager' => [ + 'strategy' => 'unanimous', + 'allow_if_all_abstain' => false, + ], + ]); + //add crud api $this->prependCruds($container); } diff --git a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php index 9de76e039..b978173d9 100644 --- a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php +++ b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflowStep.php @@ -192,7 +192,7 @@ class EntityWorkflowStep * You should **not** rely on this method to get all users which are able to * apply a transition on this step. Use @see{EntityWorkflowStep::getAllDestUser} instead. */ - public function getDestUser(): collection + public function getDestUser(): Collection { return $this->destUser; } diff --git a/src/Bundle/ChillMainBundle/Form/Type/ChillPhoneNumberType.php b/src/Bundle/ChillMainBundle/Form/Type/ChillPhoneNumberType.php index 547782943..2580058e8 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/ChillPhoneNumberType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/ChillPhoneNumberType.php @@ -16,9 +16,7 @@ use libphonenumber\PhoneNumberUtil; use Misd\PhoneNumberBundle\Form\Type\PhoneNumberType; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\Form\AbstractType; -use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; -use function array_key_exists; class ChillPhoneNumberType extends AbstractType { @@ -37,21 +35,7 @@ class ChillPhoneNumberType extends AbstractType $resolver ->setDefault('default_region', $this->defaultCarrierCode) ->setDefault('format', PhoneNumberFormat::NATIONAL) - ->setDefault('type', \libphonenumber\PhoneNumberType::FIXED_LINE_OR_MOBILE) - ->setNormalizer('attr', function (Options $options, $value) { - if (array_key_exists('placeholder', $value)) { - return $value; - } - - $examplePhoneNumber = $this->phoneNumberUtil->getExampleNumberForType($this->defaultCarrierCode, $options['type']); - - return array_merge( - $value, - [ - 'placeholder' => PhoneNumberUtil::getInstance()->format($examplePhoneNumber, $options['format']), - ] - ); - }); + ->setDefault('type', \libphonenumber\PhoneNumberType::FIXED_LINE_OR_MOBILE); } public function getParent() diff --git a/src/Bundle/ChillMainBundle/Phonenumber/PhoneNumberHelperInterface.php b/src/Bundle/ChillMainBundle/Phonenumber/PhoneNumberHelperInterface.php index eeab9c38d..1ed67d967 100644 --- a/src/Bundle/ChillMainBundle/Phonenumber/PhoneNumberHelperInterface.php +++ b/src/Bundle/ChillMainBundle/Phonenumber/PhoneNumberHelperInterface.php @@ -27,7 +27,7 @@ interface PhoneNumberHelperInterface /** * Get type (mobile, landline, ...) for phone number. */ - public function getType(string $phonenumber): string; + public function getType(PhoneNumber $phonenumber): string; /** * Return true if the validation is configured and available. diff --git a/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php b/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php index c73b3dc95..22f580d78 100644 --- a/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php +++ b/src/Bundle/ChillMainBundle/Phonenumber/PhonenumberHelper.php @@ -17,6 +17,7 @@ use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\ServerException; use libphonenumber\NumberParseException; use libphonenumber\PhoneNumber; +use libphonenumber\PhoneNumberType; use libphonenumber\PhoneNumberUtil; use Psr\Cache\CacheItemPoolInterface; use Psr\Log\LoggerInterface; @@ -86,9 +87,19 @@ final class PhonenumberHelper implements PhoneNumberHelperInterface /** * Get type (mobile, landline, ...) for phone number. */ - public function getType(string $phonenumber): string + public function getType(PhoneNumber $phonenumber): string { - return $this->performTwilioLookup($phonenumber) ?? 'unknown'; + switch ($this->phoneNumberUtil->getNumberType($phonenumber)) { + case PhoneNumberType::MOBILE: + return 'mobile'; + + case PhoneNumberType::FIXED_LINE: + case PhoneNumberType::VOIP: + return 'landline'; + + default: + return 'landline'; + } } /** diff --git a/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowRepository.php b/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowRepository.php index ab58801fc..a73da74b0 100644 --- a/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowRepository.php @@ -55,6 +55,30 @@ class EntityWorkflowRepository implements ObjectRepository return (int) $qb->getQuery()->getSingleScalarResult(); } + public function countRelatedWorkflows(array $relateds): int + { + $qb = $this->repository->createQueryBuilder('w'); + + $orX = $qb->expr()->orX(); + $i = 0; + + foreach ($relateds as $related) { + $orX->add( + $qb->expr()->andX( + $qb->expr()->eq('w.relatedEntityClass', ':entity_class_' . $i), + $qb->expr()->eq('w.relatedEntityId', ':entity_id_' . $i) + ) + ); + $qb + ->setParameter('entity_class_' . $i, $related['entityClass']) + ->setParameter('entity_id_' . $i, $related['entityId']); + ++$i; + } + $qb->where($orX); + + return $qb->select('COUNT(w)')->getQuery()->getSingleScalarResult(); + } + public function find($id): ?EntityWorkflow { return $this->repository->find($id); diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss index 3a9b6df80..248b32cfc 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss @@ -25,7 +25,7 @@ $chill-theme-buttons: ( "notify": $chill-blue, "search": $gray-300, "unlink": $chill-red, - "tpchild": $chill-pink, + "tpchild": $chill-green, ); @each $button, $color in $chill-theme-buttons { diff --git a/src/Bundle/ChillMainBundle/Resources/views/Workflow/macro_breadcrumb.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Workflow/macro_breadcrumb.html.twig index 6fb3fe2ff..a62f37e0a 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Workflow/macro_breadcrumb.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Workflow/macro_breadcrumb.html.twig @@ -9,6 +9,12 @@ {{ 'Le'|trans ~ ' : ' }} {{ step.previous.transitionAt|format_datetime('short', 'short') }} +
  • + {{ 'workflow.For'|trans ~ ' : ' }} + + {% for d in step.destUser %}{{ d|chill_entity_render_string }}{% if not loop.last %}, {% endif %}{% endfor %} + +
  • {% else %}
  • {{ 'workflow.Created by'|trans ~ ' : ' }} diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/WorkflowEntityDeletionVoter.php b/src/Bundle/ChillMainBundle/Security/Authorization/WorkflowEntityDeletionVoter.php new file mode 100644 index 000000000..079c43c3b --- /dev/null +++ b/src/Bundle/ChillMainBundle/Security/Authorization/WorkflowEntityDeletionVoter.php @@ -0,0 +1,65 @@ +handlers = $handlers; + $this->entityWorkflowRepository = $entityWorkflowRepository; + } + + protected function supports($attribute, $subject) + { + if (!is_object($subject)) { + return false; + } + + foreach ($this->handlers as $handler) { + if ($handler->isObjectSupported($subject) + && in_array($attribute, $handler->getDeletionRoles($subject), true)) { + return true; + } + } + + return false; + } + + protected function voteOnAttribute($attribute, $subject, TokenInterface $token) + { + foreach ($this->handlers as $handler) { + if ($handler->isObjectSupported($subject)) { + return 0 === $this->entityWorkflowRepository->countRelatedWorkflows( + $handler->getRelatedObjects($subject) + ); + } + } + + throw new RuntimeException('no handlers found'); + } +} diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php index 78e8729be..ccb48c160 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php @@ -113,6 +113,7 @@ class AddressNormalizer implements ContextAwareNormalizerInterface, NormalizerAw [ 'postcode' => $helper->normalize(self::NULL_POSTCODE_COUNTRY, $format, $context), 'country' => $helper->normalize(self::NULL_POSTCODE_COUNTRY, $format, $context), + 'lines' => [], ] ); } diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PhonenumberNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PhonenumberNormalizer.php index cb59e6421..3562c1361 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/PhonenumberNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/PhonenumberNormalizer.php @@ -40,6 +40,10 @@ class PhonenumberNormalizer implements NormalizerInterface, DenormalizerInterfac */ public function denormalize($data, $type, $format = null, array $context = []) { + if ('' === trim($data)) { + return null; + } + try { return $this->phoneNumberUtil->parse($data, $this->defaultCarrierCode); } catch (NumberParseException $e) { diff --git a/src/Bundle/ChillMainBundle/Workflow/EntityWorkflowHandlerInterface.php b/src/Bundle/ChillMainBundle/Workflow/EntityWorkflowHandlerInterface.php index 93ba4351e..b63546742 100644 --- a/src/Bundle/ChillMainBundle/Workflow/EntityWorkflowHandlerInterface.php +++ b/src/Bundle/ChillMainBundle/Workflow/EntityWorkflowHandlerInterface.php @@ -15,12 +15,19 @@ use Chill\MainBundle\Entity\Workflow\EntityWorkflow; interface EntityWorkflowHandlerInterface { + /** + * @return array|string[] + */ + public function getDeletionRoles(): array; + public function getEntityData(EntityWorkflow $entityWorkflow, array $options = []): array; public function getEntityTitle(EntityWorkflow $entityWorkflow, array $options = []): string; public function getRelatedEntity(EntityWorkflow $entityWorkflow): ?object; + public function getRelatedObjects(object $object): array; + /** * Return a string representing the role required for seeing the workflow. * @@ -33,6 +40,8 @@ interface EntityWorkflowHandlerInterface public function getTemplateData(EntityWorkflow $entityWorkflow, array $options = []): array; + public function isObjectSupported(object $object): bool; + public function supports(EntityWorkflow $entityWorkflow, array $options = []): bool; public function supportsFreeze(EntityWorkflow $entityWorkflow, array $options = []): bool; diff --git a/src/Bundle/ChillMainBundle/config/services/security.yaml b/src/Bundle/ChillMainBundle/config/services/security.yaml index b884a92fc..3347871e3 100644 --- a/src/Bundle/ChillMainBundle/config/services/security.yaml +++ b/src/Bundle/ChillMainBundle/config/services/security.yaml @@ -75,3 +75,9 @@ services: $locker: '@Chill\MainBundle\Security\PasswordRecover\PasswordRecoverLocker' tags: - { name: security.voter } + + Chill\MainBundle\Security\Authorization\WorkflowEntityDeletionVoter: + autoconfigure: true + autowire: true + arguments: + $handlers: !tagged_iterator chill_main.workflow_handler diff --git a/src/Bundle/ChillMainBundle/translations/messages.fr.yml b/src/Bundle/ChillMainBundle/translations/messages.fr.yml index e907f187f..685a0c373 100644 --- a/src/Bundle/ChillMainBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillMainBundle/translations/messages.fr.yml @@ -413,6 +413,7 @@ workflow: Previous workflow without reaction help: Liste des workflows où vous avez été cité comme pouvant réagir à une étape, mais où un autre utilisateur a exécuté une action avant vous. Previous transitionned: Anciens workflows Previous workflow transitionned help: Workflows où vous avez exécuté une action. + For: Pour Subscribe final: Recevoir une notification à l'étape finale diff --git a/src/Bundle/ChillPersonBundle/Entity/PersonPhone.php b/src/Bundle/ChillPersonBundle/Entity/PersonPhone.php index f33646f09..7f0e28ddb 100644 --- a/src/Bundle/ChillPersonBundle/Entity/PersonPhone.php +++ b/src/Bundle/ChillPersonBundle/Entity/PersonPhone.php @@ -98,7 +98,8 @@ class PersonPhone public function isEmpty(): bool { - return empty($this->getDescription()) && empty($this->getPhonenumber()); + return ('' === $this->getDescription() || null === $this->getDescription()) + && null === $this->getPhonenumber(); } public function setDate(DateTime $date): void diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php index 1350ae6d8..9349c335e 100644 --- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php +++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/Evaluation.php @@ -62,6 +62,12 @@ class Evaluation */ private array $title = []; + /** + * @ORM\Column(type="text", nullable=true) + * @Serializer\Groups({"read", "docgen:read"}) + */ + private ?string $url = null; + public function __construct() { $this->socialActions = new ArrayCollection(); @@ -101,6 +107,11 @@ class Evaluation return $this->title; } + public function getUrl(): ?string + { + return $this->url; + } + public function removeSocialAction(SocialAction $socialAction): self { if ($this->socialActions->contains($socialAction)) { @@ -130,4 +141,11 @@ class Evaluation return $this; } + + public function setUrl(?string $url): self + { + $this->url = $url; + + return $this; + } } diff --git a/src/Bundle/ChillPersonBundle/Form/PersonType.php b/src/Bundle/ChillPersonBundle/Form/PersonType.php index acc65c6ac..68ebd3ef4 100644 --- a/src/Bundle/ChillPersonBundle/Form/PersonType.php +++ b/src/Bundle/ChillPersonBundle/Form/PersonType.php @@ -27,6 +27,7 @@ use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Entity\PersonPhone; use Chill\PersonBundle\Form\Type\GenderType; use Chill\PersonBundle\Form\Type\PersonAltNameType; +use Chill\PersonBundle\Form\Type\PersonPhoneType; use Chill\PersonBundle\Form\Type\Select2MaritalStatusType; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\Form\AbstractType; @@ -158,7 +159,7 @@ class PersonType extends AbstractType } $builder->add('otherPhoneNumbers', ChillCollectionType::class, [ - 'entry_type' => ChillPhoneNumberType::class, + 'entry_type' => PersonPhoneType::class, 'button_add_label' => 'Add new phone', 'button_remove_label' => 'Remove phone', 'required' => false, diff --git a/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php b/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php index 00243349f..3b1de28c7 100644 --- a/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php +++ b/src/Bundle/ChillPersonBundle/Form/Type/PersonPhoneType.php @@ -11,11 +11,11 @@ declare(strict_types=1); namespace Chill\PersonBundle\Form\Type; +use Chill\MainBundle\Form\Type\ChillPhoneNumberType; use Chill\MainBundle\Phonenumber\PhonenumberHelper; use Chill\PersonBundle\Entity\PersonPhone; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\Extension\Core\Type\TelType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormEvent; @@ -36,7 +36,7 @@ class PersonPhoneType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { - $builder->add('phonenumber', TelType::class, [ + $builder->add('phonenumber', ChillPhoneNumberType::class, [ 'label' => 'Other phonenumber', 'required' => true, ]); diff --git a/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss b/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss index 30eadc7b1..92542f178 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss +++ b/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss @@ -37,57 +37,68 @@ div.banner { margin-right: 1em; } } + .household-link { + border: 1px solid white; + padding: .05rem .3rem; + border-radius: 5px; + color: white; + cursor: pointer; + &:hover { + background-color: white; + color: $chill-person-context + } + } } } div.person-view { - figure.person-details { - h2 { - font-family: 'Open Sans'; - font-weight: 600; - margin-bottom: 0.3em; - font-variant: small-caps; - } - dl { - margin-top: 0.3em; - } - dt { - font-family: 'Open Sans'; - font-weight: 600; - } - dd { - margin-left: 0; - } - /* - a.sc-button { background-color: $black; padding-top: 0.2em; padding-bottom: 0.2em; } - */ - } - /* custom fields on the home page */ - div.custom-fields { - figure.person-details { - display: flex; - flex-flow: row wrap; - div.cf_title_box:nth-child(4n+1) h2 { - @extend .chill-red !optional; - } - div.cf_title_box:nth-child(4n+2) h2 { - @extend .chill-green !optional; - } - div.cf_title_box:nth-child(4n+3) h2 { - @extend .chill-orange !optional; - } - div.cf_title_box:nth-child(4n+4) h2 { - @extend .chill-blue !optional; - } - div.cf_title_box:nth-child(2n+1) { - width: 50%; - margin-right: 40px; - } - div.cf_title_box:nth-child(2n+2) { - width: calc(50% - 40px); - } - } - } + figure.person-details { + h2 { + font-family: 'Open Sans'; + font-weight: 600; + margin-bottom: 0.3em; + font-variant: small-caps; + } + dl { + margin-top: 0.3em; + } + dt { + font-family: 'Open Sans'; + font-weight: 600; + } + dd { + margin-left: 0; + } + /* + a.sc-button { background-color: $black; padding-top: 0.2em; padding-bottom: 0.2em; } + */ + } + /* custom fields on the home page */ + div.custom-fields { + figure.person-details { + display: flex; + flex-flow: row wrap; + div.cf_title_box:nth-child(4n+1) h2 { + @extend .chill-red !optional; + } + div.cf_title_box:nth-child(4n+2) h2 { + @extend .chill-green !optional; + } + div.cf_title_box:nth-child(4n+3) h2 { + @extend .chill-orange !optional; + } + div.cf_title_box:nth-child(4n+4) h2 { + @extend .chill-blue !optional; + } + div.cf_title_box:nth-child(2n+1) { + width: 50%; + margin-right: 40px; + } + div.cf_title_box:nth-child(2n+2) { + width: calc(50% - 40px); + } + } + } } /* diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/CourseLocation.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/CourseLocation.vue index e32f9b05e..42f974dd1 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/CourseLocation.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/CourseLocation.vue @@ -59,14 +59,6 @@ ref="addAddress">
  • -
  • - -
  • @@ -180,22 +172,6 @@ export default { } this.$store.commit('setAddressContext', context); }, - removeAddress() { - let payload = { - target: this.context.target.name, - targetId: this.context.target.id, - locationStatusTo: 'none' - }; - //console.log('remove address'); - this.$store.dispatch('updateLocation', payload) - .catch(({name, violations}) => { - if (name === 'ValidationException' || name === 'AccessException') { - violations.forEach((violation) => this.$toast.open({message: violation})); - } else { - this.$toast.open({message: 'An error occurred'}) - } - }); - }, displayErrors() { return this.$refs.addAddress.errorMsg; }, diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue index 8d897da13..37321e0bb 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue @@ -170,7 +170,9 @@ export default { console.log('data', payload.data) body.name = payload.data.name; body.email = payload.data.email; - body.telephone = payload.data.phonenumber; + body.telephone = payload.data.telephone; + body.civility = payload.data.civility; + body.profession = payload.data.profession; body.address = payload.data.address ? { id: payload.data.address.address_id } : null; makeFetch('PATCH', `/api/1.0/thirdparty/thirdparty/${payload.data.id}.json`, body) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue index 579d0b306..8ea3ecec2 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue @@ -5,6 +5,11 @@ {{ evaluation.evaluation.title.fr }} +
    + + {{ evaluation.evaluation.url }} +
    +
    @@ -21,7 +26,7 @@ > -
  • +
  • @@ -93,6 +98,19 @@ export default { pickedEvaluations() { return this.$store.state.evaluationsPicked; }, + canDelete() { + if (this.evaluation.workflows.length > 0) { + return false; + } + + for (let doc of this.evaluation.documents) { + if (doc.workflows.length > 0) { + return false; + } + } + + return true; + }, }, methods: { removeEvaluation(e) { @@ -128,4 +146,11 @@ export default { } } } + div.item-url { + i { + color: unset!important; + margin-left: 1rem; + margin-right: 0.5rem; + } + } diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue index b077cfefa..24e1c202f 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/FormEvaluation.vue @@ -101,7 +101,7 @@
  • -
  • +
  • diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/HouseholdRenderBox.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/HouseholdRenderBox.vue index 16d0fa2ff..163f49bcf 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/HouseholdRenderBox.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/HouseholdRenderBox.vue @@ -87,10 +87,14 @@ export default { currentMembers() { let members = this.household.members.filter(m => this.household.current_members_id.includes(m.id)) .sort((a, b) => { - if (a.position.ordering < b.position.ordering) { + + const orderA = a.position ? a.position.ordering : 0; + const orderB = b.position ? b.position.ordering : 0; + + if (orderA < orderB) { return -1; } - if (a.position.ordering > b.position.ordering) { + if (orderA > orderB) { return 1; } if (a.holder && !b.holder) { diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/_item.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/_item.html.twig index 5af04c843..d7e4f4e96 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/_item.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/_item.html.twig @@ -130,11 +130,13 @@ href="{{ chill_path_add_return_path('chill_person_accompanying_period_work_edit', { 'id': w.id }) }}" > -
  • - -
  • + {% if is_granted('CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_DELETE', w) %} +
  • + +
  • + {% endif %} {% endif %}
    diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list_item.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list_item.html.twig index 11517def2..65e514b14 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list_item.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list_item.html.twig @@ -117,12 +117,15 @@ {% endif %}
    -
    - {% set notif_counter = chill_count_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod', period.id) %} - {% if notif_counter.total > 0 %} - {{ chill_counter_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod', period.id) }} - {% endif %} -
    + {% set notif_counter = chill_count_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod', period.id) %} + {% if notif_counter.total > 0 %} +
    + {{ chill_counter_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod', period.id) }} +
    + {% endif %} + {% if itemMeta is defined %} + {{ itemMeta }} + {% endif %}
    {% if recordAction is defined %}
    diff --git a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkVoter.php b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkVoter.php index 7193c524e..24df2bbc5 100644 --- a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkVoter.php +++ b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodWorkVoter.php @@ -24,6 +24,8 @@ class AccompanyingPeriodWorkVoter extends Voter { public const CREATE = 'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_CREATE'; + public const DELETE = 'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_DELETE'; + public const SEE = 'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_SEE'; public const UPDATE = 'CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_UPDATE'; @@ -60,6 +62,7 @@ class AccompanyingPeriodWorkVoter extends Voter case self::CREATE: case self::UPDATE: + case self::DELETE: return $this->security->isGranted(AccompanyingPeriodVoter::EDIT, $subject->getAccompanyingPeriod()); default: @@ -86,6 +89,6 @@ class AccompanyingPeriodWorkVoter extends Voter private function getRoles(): array { - return [self::SEE, self::CREATE, self::UPDATE]; + return [self::SEE, self::CREATE, self::UPDATE, self::DELETE]; } } diff --git a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkEvaluationContext.php b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkEvaluationContext.php index 918b68dc1..90712c64d 100644 --- a/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkEvaluationContext.php +++ b/src/Bundle/ChillPersonBundle/Service/DocGenerator/AccompanyingPeriodWorkEvaluationContext.php @@ -179,7 +179,8 @@ class AccompanyingPeriodWorkEvaluationContext implements $doc = new AccompanyingPeriodWorkEvaluationDocument(); $doc->setStoredObject($storedObject) ->setAccompanyingPeriodWorkEvaluation($entity) - ->setTemplate($template); + ->setTemplate($template) + ->setTitle($this->translatableStringHelper->localize($template->getName())); $this->em->persist($doc); } } diff --git a/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler.php b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler.php index eac460ee5..1e02d0465 100644 --- a/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler.php +++ b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler.php @@ -37,6 +37,13 @@ class AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler implements EntityW $this->translator = $translator; } + public function getDeletionRoles(): array + { + return [ + '_', + ]; + } + public function getEntityData(EntityWorkflow $entityWorkflow, array $options = []): array { $doc = $this->getRelatedEntity($entityWorkflow); @@ -63,6 +70,18 @@ class AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler implements EntityW return $this->repository->find($entityWorkflow->getRelatedEntityId()); } + /** + * @param AccompanyingPeriodWorkEvaluationDocument $object + * + * @return array[] + */ + public function getRelatedObjects(object $object): array + { + return [ + ['entityClass' => AccompanyingPeriodWorkEvaluationDocument::class, $object->getId()], + ]; + } + public function getRoleShow(EntityWorkflow $entityWorkflow): ?string { return AccompanyingPeriodWorkEvaluationDocumentVoter::SEE; @@ -84,6 +103,11 @@ class AccompanyingPeriodWorkEvaluationDocumentWorkflowHandler implements EntityW ]; } + public function isObjectSupported(object $object): bool + { + return $object instanceof AccompanyingPeriodWorkEvaluationDocument; + } + public function supports(EntityWorkflow $entityWorkflow, array $options = []): bool { return $entityWorkflow->getRelatedEntityClass() === AccompanyingPeriodWorkEvaluationDocument::class; diff --git a/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationWorkflowHandler.php b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationWorkflowHandler.php index 5af305ac5..ddd6ded38 100644 --- a/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationWorkflowHandler.php +++ b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkEvaluationWorkflowHandler.php @@ -15,6 +15,7 @@ use Chill\MainBundle\Entity\Workflow\EntityWorkflow; use Chill\MainBundle\Templating\TranslatableStringHelperInterface; use Chill\MainBundle\Workflow\EntityWorkflowHandlerInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluation; +use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluationDocument; use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkEvaluationRepository; use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodWorkEvaluationVoter; use Symfony\Contracts\Translation\TranslatorInterface; @@ -37,6 +38,11 @@ class AccompanyingPeriodWorkEvaluationWorkflowHandler implements EntityWorkflowH $this->translator = $translator; } + public function getDeletionRoles(): array + { + return ['_']; + } + public function getEntityData(EntityWorkflow $entityWorkflow, array $options = []): array { $evaluation = $this->getRelatedEntity($entityWorkflow); @@ -61,6 +67,21 @@ class AccompanyingPeriodWorkEvaluationWorkflowHandler implements EntityWorkflowH return $this->repository->find($entityWorkflow->getRelatedEntityId()); } + /** + * @param AccompanyingPeriodWorkEvaluation $object + */ + public function getRelatedObjects(object $object): array + { + $relateds = []; + $relateds[] = ['entityClass' => AccompanyingPeriodWorkEvaluation::class, 'entityId' => $object->getId()]; + + foreach ($object->getDocuments() as $doc) { + $relateds[] = ['entityClass' => AccompanyingPeriodWorkEvaluationDocument::class, 'entityId' => $doc->getId()]; + } + + return $relateds; + } + public function getRoleShow(EntityWorkflow $entityWorkflow): ?string { return AccompanyingPeriodWorkEvaluationVoter::SEE; @@ -79,6 +100,11 @@ class AccompanyingPeriodWorkEvaluationWorkflowHandler implements EntityWorkflowH ]; } + public function isObjectSupported(object $object): bool + { + return $object instanceof AccompanyingPeriodWorkEvaluation; + } + public function supports(EntityWorkflow $entityWorkflow, array $options = []): bool { return $entityWorkflow->getRelatedEntityClass() === AccompanyingPeriodWorkEvaluation::class; diff --git a/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkWorkflowHandler.php b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkWorkflowHandler.php index 1385cb841..3fda24c4f 100644 --- a/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkWorkflowHandler.php +++ b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkWorkflowHandler.php @@ -15,7 +15,10 @@ use Chill\MainBundle\Entity\Workflow\EntityWorkflow; use Chill\MainBundle\Templating\TranslatableStringHelperInterface; use Chill\MainBundle\Workflow\EntityWorkflowHandlerInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork; +use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluation; +use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluationDocument; use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository; +use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodWorkVoter; use Symfony\Contracts\Translation\TranslatorInterface; class AccompanyingPeriodWorkWorkflowHandler implements EntityWorkflowHandlerInterface @@ -36,6 +39,11 @@ class AccompanyingPeriodWorkWorkflowHandler implements EntityWorkflowHandlerInte $this->translator = $translator; } + public function getDeletionRoles(): array + { + return [AccompanyingPeriodWorkVoter::DELETE]; + } + public function getEntityData(EntityWorkflow $entityWorkflow, array $options = []): array { return [ @@ -58,6 +66,25 @@ class AccompanyingPeriodWorkWorkflowHandler implements EntityWorkflowHandlerInte return $this->repository->find($entityWorkflow->getRelatedEntityId()); } + /** + * @param AccompanyingPeriodWork $object + */ + public function getRelatedObjects(object $object): array + { + $relateds = []; + $relateds[] = ['entityClass' => AccompanyingPeriodWork::class, 'entityId' => $object->getId()]; + + foreach ($object->getAccompanyingPeriodWorkEvaluations() as $evaluation) { + $relateds[] = ['entityClass' => AccompanyingPeriodWorkEvaluation::class, 'entityId' => $evaluation->getId()]; + + foreach ($evaluation->getDocuments() as $doc) { + $relateds[] = ['entityClass' => AccompanyingPeriodWorkEvaluationDocument::class, 'entityId' => $doc->getId()]; + } + } + + return $relateds; + } + public function getRoleShow(EntityWorkflow $entityWorkflow): ?string { return null; @@ -76,6 +103,11 @@ class AccompanyingPeriodWorkWorkflowHandler implements EntityWorkflowHandlerInte ]; } + public function isObjectSupported(object $object): bool + { + return $object instanceof AccompanyingPeriodWork; + } + public function supports(EntityWorkflow $entityWorkflow, array $options = []): bool { return $entityWorkflow->getRelatedEntityClass() === AccompanyingPeriodWork::class; diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20220303113855.php b/src/Bundle/ChillPersonBundle/migrations/Version20220303113855.php new file mode 100644 index 000000000..7840cdfce --- /dev/null +++ b/src/Bundle/ChillPersonBundle/migrations/Version20220303113855.php @@ -0,0 +1,37 @@ +addSql('ALTER TABLE chill_person_social_work_evaluation DROP url'); + } + + public function getDescription(): string + { + return 'Add url to SocialWork Evaluation'; + } + + public function up(Schema $schema): void + { + $this->addSql('ALTER TABLE chill_person_social_work_evaluation ADD url TEXT DEFAULT NULL'); + $this->addSql("UPDATE chill_person_social_work_evaluation SET url = CASE WHEN title->>'fr' LIKE 'http%' THEN title->>'fr' ELSE null END;"); + } +} diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index ba990125c..e4265fca0 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -124,8 +124,8 @@ address_country_code: Code pays 'Alreay existing person': 'Dossiers déjà encodés' 'Add the person': 'Ajouter la personne' -'Add the person and create an accompanying period': "Créer la personne & créer une période d'accompagnement" -'Add the person and create a household': "Créer la personne & créer un ménage" +'Add the person and create an accompanying period': "Créer l'usager ET créer une période d'accompagnement" +'Add the person and create a household': "Créer l'usager' ET créer un ménage" Show person: Voir le dossier de la personne 'Confirm the creation': 'Confirmer la création' 'You will create this person': 'Vous allez créer le dossier suivant' diff --git a/src/Bundle/ChillTaskBundle/translations/messages.fr.yml b/src/Bundle/ChillTaskBundle/translations/messages.fr.yml index 5633c0219..a2a57708f 100644 --- a/src/Bundle/ChillTaskBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillTaskBundle/translations/messages.fr.yml @@ -46,6 +46,7 @@ User: Utilisateur "Associated tasks": "Tâches associées" "My tasks": "Mes tâches" "Tasks for this accompanying period": "Tâches pour ce parcours d'accompagnement" +"Tasks for {{ name }}": "Tâches pour {{ name }}" "No description": "Pas de description" "No dates specified": "Dates non spécifiées" "No one assignee": "Aucune personne assignée" diff --git a/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php b/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php index 61797a22c..637ce68e4 100644 --- a/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php +++ b/src/Bundle/ChillThirdPartyBundle/Controller/ThirdPartyController.php @@ -20,6 +20,7 @@ use Chill\ThirdPartyBundle\Entity\ThirdParty; use Chill\ThirdPartyBundle\Repository\ThirdPartyACLAwareRepositoryInterface; use Chill\ThirdPartyBundle\Security\Voter\ThirdPartyVoter; use LogicException; +use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; @@ -31,37 +32,39 @@ use function array_merge; final class ThirdPartyController extends CRUDController { - /** - * @var AuthorizationHelper - */ - protected $authorizationHelper; + protected AuthorizationHelper $authorizationHelper; - /** - * @var PaginatorFactory - */ - protected $paginatorFactory; + protected PaginatorFactory $paginatorFactory; protected RequestStack $requestStack; protected ThirdPartyACLAwareRepositoryInterface $thirdPartyACLAwareRepository; - /** - * @var TranslatorInterface - */ - protected $translator; + protected TranslatorInterface $translator; + + private bool $askCenter; public function __construct( AuthorizationHelper $authorizationHelper, TranslatorInterface $translator, PaginatorFactory $paginatorFactory, RequestStack $requestStack, - ThirdPartyACLAwareRepositoryInterface $thirdPartyACLAwareRepository + ThirdPartyACLAwareRepositoryInterface $thirdPartyACLAwareRepository, + ParameterBagInterface $parameterBag ) { $this->authorizationHelper = $authorizationHelper; $this->translator = $translator; $this->paginatorFactory = $paginatorFactory; $this->requestStack = $requestStack; $this->thirdPartyACLAwareRepository = $thirdPartyACLAwareRepository; + $this->askCenter = $parameterBag->get('chill_main')['acl']['form_show_centers']; + } + + public function generateTemplateParameter(string $action, $entity, Request $request, array $defaultTemplateParameters = []) + { + $defaultTemplateParameters['askCenter'] = $this->askCenter; + + return $defaultTemplateParameters; } protected function buildFilterOrderHelper(string $action, Request $request): ?FilterOrderHelper diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyRenderBox.vue b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyRenderBox.vue index 1555ec66a..662911714 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyRenderBox.vue +++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyRenderBox.vue @@ -36,7 +36,7 @@