diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5e33ffee0..55a152fa5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,24 @@ and this project adheres to
* fix normalisation of accompanying course requestor api (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/378)
+* [person] add a returnPath when clicking on some Person or ThirdParty badge (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/427)
+* [person] accompanying course work: fix on-the-fly update of thirdParty
+* [on-the-fly] close modal only after validation
+* [person] correct thirdparty PATCH url + add email and altnames in AddPerson and serializer (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/433)
+* change order for accompanying course work list
+* [person]: style fix in parcours listing per person. (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/432)
+* [household]: display address of current household (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/415)
+* ajoute un ordre dans les localisation (api)
+* [pick entity]: fix translations in modal (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/419)
+* [homepage_widget]: fix translation on emergency badge (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/440)
+* [person]: create person and household added to button dropdown (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/454)
+* display full address in address.text in normalization. Adapt AddressRenderBox
+* [address]: Correction residential address 'depuis le' (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/459)
+
+## Test releases
+
+### test release 2021-02-01
+
* renommer "dossier numéro" en "parcours numéro" dans les résultats de recherche
* renomme date de début en date d'ouverture dans le formulaire parcours
* [homepage widget] improve content tables, improve counter pluralization with style on number
@@ -30,9 +48,6 @@ and this project adheres to
* [fast_actions] improve fast-actions buttons override mechanism, fix https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/413
* [homepage widget] add vue homepage_widget with asynchone loading, give a global view resume of the user concerned actions, notifications, etc.
-
-## Test releases
-
### test release 2021-01-31
* [person] accompanying course: optimisation: do not fetch some resources for the banner (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/409)
diff --git a/phpstan-deprecations.neon b/phpstan-deprecations.neon
index bc372e96b..b41a746b9 100644
--- a/phpstan-deprecations.neon
+++ b/phpstan-deprecations.neon
@@ -927,15 +927,6 @@ parameters:
count: 1
path: src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php
- -
- message:
- """
- #^Parameter \\$trans of method Chill\\\\PersonBundle\\\\Controller\\\\AccompanyingCourseWorkController\\:\\:__construct\\(\\) has typehint with deprecated interface Symfony\\\\Component\\\\Translation\\\\TranslatorInterface\\:
- since Symfony 4\\.2, use Symfony\\\\Contracts\\\\Translation\\\\TranslatorInterface instead$#
- """
- count: 1
- path: src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php
-
-
message:
"""
diff --git a/src/Bundle/ChillCalendarBundle/Form/CalendarType.php b/src/Bundle/ChillCalendarBundle/Form/CalendarType.php
index 8966ecca8..05dc362b4 100644
--- a/src/Bundle/ChillCalendarBundle/Form/CalendarType.php
+++ b/src/Bundle/ChillCalendarBundle/Form/CalendarType.php
@@ -97,7 +97,6 @@ class CalendarType extends AbstractType
return $res;
},
static function (?string $dateAsString): DateTimeImmutable {
-
return new DateTimeImmutable($dateAsString);
}
));
diff --git a/src/Bundle/ChillMainBundle/Controller/LocationApiController.php b/src/Bundle/ChillMainBundle/Controller/LocationApiController.php
index 250d92980..2cf5caaf9 100644
--- a/src/Bundle/ChillMainBundle/Controller/LocationApiController.php
+++ b/src/Bundle/ChillMainBundle/Controller/LocationApiController.php
@@ -12,6 +12,8 @@ declare(strict_types=1);
namespace Chill\MainBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
+use Chill\MainBundle\Pagination\PaginatorInterface;
+use Doctrine\ORM\QueryBuilder;
use Symfony\Component\HttpFoundation\Request;
/**
@@ -19,7 +21,7 @@ use Symfony\Component\HttpFoundation\Request;
*/
class LocationApiController extends ApiController
{
- public function customizeQuery(string $action, Request $request, $query): void
+ protected function customizeQuery(string $action, Request $request, $query): void
{
$query
->leftJoin('e.locationType', 'lt')
@@ -31,4 +33,14 @@ class LocationApiController extends ApiController
)
);
}
+
+ /**
+ * @param QueryBuilder $query
+ * @param mixed $_format
+ */
+ protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator, $_format)
+ {
+ return $query
+ ->addOrderBy('e.name', 'ASC');
+ }
}
diff --git a/src/Bundle/ChillMainBundle/Controller/NotificationController.php b/src/Bundle/ChillMainBundle/Controller/NotificationController.php
index 52f58ed68..af9e1b2b1 100644
--- a/src/Bundle/ChillMainBundle/Controller/NotificationController.php
+++ b/src/Bundle/ChillMainBundle/Controller/NotificationController.php
@@ -236,6 +236,10 @@ class NotificationController extends AbstractController
'_fragment' => 'comment-' . $commentId,
]);
}
+
+ if ($editedCommentForm->isSubmitted() && !$editedCommentForm->isValid()) {
+ $this->addFlash('error', $this->translator->trans('This form contains errors'));
+ }
}
}
@@ -257,6 +261,10 @@ class NotificationController extends AbstractController
'id' => $notification->getId(),
]);
}
+
+ if ($appendCommentForm->isSubmitted() && !$appendCommentForm->isValid()) {
+ $this->addFlash('error', $this->translator->trans('This form contains errors'));
+ }
}
}
diff --git a/src/Bundle/ChillMainBundle/Controller/WorkflowController.php b/src/Bundle/ChillMainBundle/Controller/WorkflowController.php
index 247cdf552..876e095a8 100644
--- a/src/Bundle/ChillMainBundle/Controller/WorkflowController.php
+++ b/src/Bundle/ChillMainBundle/Controller/WorkflowController.php
@@ -167,6 +167,7 @@ class WorkflowController extends AbstractController
$handler = $this->entityWorkflowManager->getHandler($entityWorkflow);
$workflow = $this->registry->get($entityWorkflow, $entityWorkflow->getWorkflowName());
+ $errors = [];
if (count($workflow->getEnabledTransitions($entityWorkflow)) > 0) {
// possible transition
@@ -245,7 +246,7 @@ class WorkflowController extends AbstractController
'handler_template_data' => $handler->getTemplateData($entityWorkflow),
'transition_form' => isset($transitionForm) ? $transitionForm->createView() : null,
'entity_workflow' => $entityWorkflow,
- 'transition_form_errors' => $errors ?? [],
+ 'transition_form_errors' => $errors,
//'comment_form' => $commentForm->createView(),
]
);
diff --git a/src/Bundle/ChillMainBundle/Entity/NotificationComment.php b/src/Bundle/ChillMainBundle/Entity/NotificationComment.php
index 01911c729..5275010e6 100644
--- a/src/Bundle/ChillMainBundle/Entity/NotificationComment.php
+++ b/src/Bundle/ChillMainBundle/Entity/NotificationComment.php
@@ -18,6 +18,7 @@ use DateTimeInterface;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Event\PreFlushEventArgs;
use Doctrine\ORM\Mapping as ORM;
+use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
@@ -28,6 +29,7 @@ class NotificationComment implements TrackCreationInterface, TrackUpdateInterfac
{
/**
* @ORM\Column(type="text")
+ * @Assert\NotBlank(message="notification.Comment content might not be blank")
*/
private string $content = '';
@@ -136,9 +138,9 @@ class NotificationComment implements TrackCreationInterface, TrackUpdateInterfac
$this->recentlyPersisted = true;
}
- public function setContent(string $content): self
+ public function setContent(?string $content): self
{
- $this->content = $content;
+ $this->content = (string) $content;
return $this;
}
diff --git a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php
index a132706d7..b9773040a 100644
--- a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php
+++ b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php
@@ -135,6 +135,7 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface
if (!$this->steps->contains($step)) {
$this->steps[] = $step;
$step->setEntityWorkflow($this);
+ $this->stepsChainedCache = null;
}
return $this;
@@ -332,32 +333,26 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface
public function isFinal(): bool
{
- $steps = $this->getStepsChained();
-
- if (1 === count($steps)) {
- // the initial step cannot be finalized
- return false;
+ foreach ($this->getStepsChained() as $step) {
+ if ($step->isFinal()) {
+ return true;
+ }
}
- /** @var EntityWorkflowStep $last */
- $last = end($steps);
-
- return $last->isFinal();
+ return false;
}
public function isFreeze(): bool
{
$steps = $this->getStepsChained();
- if (1 === count($steps)) {
- // the initial step cannot be finalized
- return false;
+ foreach ($this->getStepsChained() as $step) {
+ if ($step->isFreezeAfter()) {
+ return true;
+ }
}
- /** @var EntityWorkflowStep $last */
- $last = end($steps);
-
- return $last->getPrevious()->isFreezeAfter();
+ return false;
}
public function isUserSubscribedToFinal(User $user): bool
@@ -434,7 +429,7 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface
$newStep->setCurrentStep($step);
// copy the freeze
- if ($this->getCurrentStep()->isFreezeAfter()) {
+ if ($this->isFreeze()) {
$newStep->setFreezeAfter(true);
}
diff --git a/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php b/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php
index e04a96af0..ce5587ed9 100644
--- a/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php
+++ b/src/Bundle/ChillMainBundle/Notification/Email/NotificationMailer.php
@@ -79,11 +79,8 @@ class NotificationMailer
continue;
}
- $email = new Email();
- $email
- ->subject($notification->getTitle());
-
if ($notification->isSystem()) {
+ $email = new Email();
$email
->text($notification->getMessage());
} else {
@@ -96,7 +93,9 @@ class NotificationMailer
]);
}
- $email->to($addressee->getEmail());
+ $email
+ ->subject($notification->getTitle())
+ ->to($addressee->getEmail());
try {
$this->mailer->send($email);
diff --git a/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowStepRepository.php b/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowStepRepository.php
index ad1b21c79..e4f0aa45d 100644
--- a/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowStepRepository.php
+++ b/src/Bundle/ChillMainBundle/Repository/Workflow/EntityWorkflowStepRepository.php
@@ -56,7 +56,7 @@ class EntityWorkflowStepRepository implements ObjectRepository
public function getClassName()
{
- return EntityWorkflow::class;
+ return EntityWorkflowStep::class;
}
private function buildQueryByUser(User $user): QueryBuilder
diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js b/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js
index 4cc917502..f184bf100 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js
+++ b/src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js
@@ -17,7 +17,12 @@ function loadDynamicPicker(element) {
isMultiple = parseInt(el.dataset.multiple) === 1,
uniqId = el.dataset.uniqid,
input = element.querySelector('[data-input-uniqid="'+ el.dataset.uniqid +'"]'),
- picked = (isMultiple) ? (JSON.parse(input.value)) : ((input.value === '[]') ? (null) : ([JSON.parse(input.value)]));
+ picked = isMultiple ?
+ JSON.parse(input.value) : (
+ (input.value === '[]' || input.value === '') ?
+ null : [ JSON.parse(input.value) ]
+ )
+ ;
if (!isMultiple) {
if (input.value === '[]'){
diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyAccompanyingCourses.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyAccompanyingCourses.vue
index 4292c3af5..1c3b5e152 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyAccompanyingCourses.vue
+++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyAccompanyingCourses.vue
@@ -32,7 +32,7 @@
- {{ $t('emergency') }}
+ {{ $t('emergency') }}
{{ $t('confidential') }}
@@ -80,5 +80,7 @@ export default {
\ No newline at end of file
diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/i18n.js b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/i18n.js
index 0b3d6a428..29f9dac62 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/i18n.js
+++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/i18n.js
@@ -50,7 +50,9 @@ const appMessages = {
assignated_evaluations: "{n} évaluation assignée | {n} évaluations assignées",
alert_tasks: "{n} tâche en rappel | {n} tâches en rappel",
warning_tasks: "{n} tâche à échéance | {n} tâches à échéance",
- }
+ },
+ emergency: "Urgent",
+ confidential: "Confidentiel",
}
};
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 116ed86c1..7b06776ba 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue
+++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue
@@ -90,7 +90,7 @@ export default {
OnTheFlyThirdparty,
OnTheFlyCreate
},
- props: ['type', 'id', 'action', 'buttonText', 'displayBadge', 'isDead', 'parent', 'canCloseModal'],
+ props: ['type', 'id', 'action', 'buttonText', 'displayBadge', 'isDead', 'parent'],
emits: ['saveFormOnTheFly'],
data() {
return {
@@ -160,17 +160,10 @@ export default {
},
badgeType() {
return 'entity-' + this.type + ' badge-' + this.type;
- }
- },
- watch: {
- canCloseModal: {
- handler: function(val, oldVal) {
- if (val) {
- this.closeModal();
- }
- },
- deep: true
- }
+ },
+ getReturnPath() {
+ return `?returnPath=${window.location.pathname}${window.location.search}${window.location.hash}`;
+ },
},
methods: {
closeModal() {
@@ -217,9 +210,9 @@ export default {
buildLocation(id, type) {
if (type === 'person') {
// TODO i18n
- return `/fr/person/${id}/general`;
+ return encodeURI(`/fr/person/${id}/general${this.getReturnPath}`);
} else if (type === 'thirdparty') {
- return `/fr/3party/3party/${id}/view`;
+ return encodeURI(`/fr/3party/3party/${id}/view${this.getReturnPath}`);
}
}
}
diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/PickEntity/i18n.js b/src/Bundle/ChillMainBundle/Resources/public/vuejs/PickEntity/i18n.js
index 2c4432218..f3ae3a928 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/PickEntity/i18n.js
+++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/PickEntity/i18n.js
@@ -1,4 +1,7 @@
import { personMessages } from 'ChillPersonAssets/vuejs/_js/i18n';
+import { thirdpartyMessages } from 'ChillThirdPartyAssets/vuejs/_js/i18n';
+import { addressMessages } from 'ChillMainAssets/vuejs/Address/i18n';
+import { ontheflyMessages } from 'ChillMainAssets/vuejs/OnTheFly/i18n';
const appMessages = {
fr: {
@@ -12,6 +15,6 @@ const appMessages = {
}
}
-Object.assign(appMessages.fr, personMessages.fr);
+Object.assign(appMessages.fr, personMessages.fr, thirdpartyMessages.fr, addressMessages.fr, ontheflyMessages.fr );
export { appMessages };
diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/AddressRenderBox.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/AddressRenderBox.vue
index 385f7aa3d..9a5dc2644 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/AddressRenderBox.vue
+++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Entity/AddressRenderBox.vue
@@ -42,57 +42,11 @@
class="street">
{{ address.text }}
-
- {{ address.postcode.code }} {{ address.postcode.name }}
-
-
- {{ address.country.name.fr }}
-
-
-
diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.js b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.js
index c1eac0b06..0f2b52568 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.js
+++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.js
@@ -91,11 +91,11 @@ export const multiSelectMessages = {
multiselect: {
placeholder: 'Choisir',
tag_placeholder: 'Créer un nouvel élément',
- select_label: 'Appuyer sur "Entrée" pour sélectionner',
- deselect_label: 'Appuyer sur "Entrée" pour désélectionner',
+ select_label: '"Entrée" ou cliquez pour sélectionner',
+ deselect_label: '"Entrée" ou cliquez pour désélectionner',
select_group_label: 'Appuyer sur "Entrée" pour sélectionner ce groupe',
deselect_group_label: 'Appuyer sur "Entrée" pour désélectionner ce groupe',
selected_label: 'Sélectionné'
}
}
-};
\ No newline at end of file
+};
diff --git a/src/Bundle/ChillMainBundle/Resources/views/Notification/_item_comments.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Notification/_item_comments.html.twig
index b741abf4a..121111b03 100644
--- a/src/Bundle/ChillMainBundle/Resources/views/Notification/_item_comments.html.twig
+++ b/src/Bundle/ChillMainBundle/Resources/views/Notification/_item_comments.html.twig
@@ -15,11 +15,11 @@
\ No newline at end of file
+
diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php
index 10e889344..78e8729be 100644
--- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php
+++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/AddressNormalizer.php
@@ -64,7 +64,7 @@ class AddressNormalizer implements ContextAwareNormalizerInterface, NormalizerAw
if ($address instanceof Address) {
$data = [
'address_id' => $address->getId(),
- 'text' => $address->isNoAddress() ? null : $this->addressRender->renderStreetLine($address, []),
+ 'text' => $this->addressRender->renderString($address, []),
'street' => $address->getStreet(),
'streetNumber' => $address->getStreetNumber(),
'postcode' => [
diff --git a/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php b/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php
index 66d6e9e41..3a97d0ef6 100644
--- a/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php
+++ b/src/Bundle/ChillMainBundle/Templating/Entity/AddressRender.php
@@ -124,7 +124,7 @@ class AddressRender implements ChillEntityRenderInterface
*/
public function renderString($addr, array $options): string
{
- return implode(' - ', $this->renderLines($addr));
+ return implode(' — ', $this->renderLines($addr));
}
public function supports($entity, array $options): bool
diff --git a/src/Bundle/ChillMainBundle/Tests/Entity/Workflow/EntityWorkflowTest.php b/src/Bundle/ChillMainBundle/Tests/Entity/Workflow/EntityWorkflowTest.php
index c89101c5b..91783a77b 100644
--- a/src/Bundle/ChillMainBundle/Tests/Entity/Workflow/EntityWorkflowTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Entity/Workflow/EntityWorkflowTest.php
@@ -24,30 +24,30 @@ final class EntityWorkflowTest extends TestCase
{
$entityWorkflow = new EntityWorkflow();
- $entityWorkflow->getCurrentStep()->setFinalizeAfter(true);
$entityWorkflow->setStep('final');
+ $entityWorkflow->getCurrentStep()->setIsFinal(true);
- $this->assertTrue($entityWorkflow->isFinalize());
+ $this->assertTrue($entityWorkflow->isFinal());
}
public function testIsFinalizeWith4Steps()
{
$entityWorkflow = new EntityWorkflow();
- $this->assertFalse($entityWorkflow->isFinalize());
+ $this->assertFalse($entityWorkflow->isFinal());
$entityWorkflow->setStep('two');
- $this->assertFalse($entityWorkflow->isFinalize());
+ $this->assertFalse($entityWorkflow->isFinal());
$entityWorkflow->setStep('previous_final');
- $this->assertFalse($entityWorkflow->isFinalize());
+ $this->assertFalse($entityWorkflow->isFinal());
- $entityWorkflow->getCurrentStep()->setFinalizeAfter(true);
+ $entityWorkflow->getCurrentStep()->setIsFinal(true);
$entityWorkflow->setStep('final');
- $this->assertTrue($entityWorkflow->isFinalize());
+ $this->assertTrue($entityWorkflow->isFinal());
}
public function testIsFreeze()
@@ -64,11 +64,8 @@ final class EntityWorkflowTest extends TestCase
$this->assertFalse($entityWorkflow->isFreeze());
- $entityWorkflow->getCurrentStep()->setFreezeAfter(true);
-
- $this->assertFalse($entityWorkflow->isFreeze());
-
$entityWorkflow->setStep('freezed');
+ $entityWorkflow->getCurrentStep()->setFreezeAfter(true);
$this->assertTrue($entityWorkflow->isFreeze());
diff --git a/src/Bundle/ChillMainBundle/Tests/Templating/Entity/AddressRenderTest.php b/src/Bundle/ChillMainBundle/Tests/Templating/Entity/AddressRenderTest.php
index fcd7b374a..3f828bfc5 100644
--- a/src/Bundle/ChillMainBundle/Tests/Templating/Entity/AddressRenderTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Templating/Entity/AddressRenderTest.php
@@ -48,7 +48,7 @@ final class AddressRenderTest extends KernelTestCase
$addr->setBuildingName('Résidence "Les Bleuets"');
- yield [$addr, 'Résidence "Les Bleuets" - Rue ABC, 5 - 012345 Locality - Belgium'];
+ yield [$addr, 'Résidence "Les Bleuets" — Rue ABC, 5 — 012345 Locality — Belgium'];
}
public function addressDataProviderBEWithSteps(): Iterator
@@ -68,7 +68,7 @@ final class AddressRenderTest extends KernelTestCase
$addr->setSteps('4');
- yield [$addr, 'esc 4 - Rue ABC, 5 - 012345 Locality - Belgium'];
+ yield [$addr, 'esc 4 — Rue ABC, 5 — 012345 Locality — Belgium'];
}
public function addressDataProviderFRWithBuilding(): Iterator
@@ -88,7 +88,7 @@ final class AddressRenderTest extends KernelTestCase
$addr->setBuildingName('Résidence "Les Bleuets"');
- yield [$addr, 'Résidence "Les Bleuets" - 5, Rue ABC - 012345 Locality - France'];
+ yield [$addr, 'Résidence "Les Bleuets" — 5, Rue ABC — 012345 Locality — France'];
}
public function addressDataProviderFRWithSteps(): Iterator
@@ -108,7 +108,7 @@ final class AddressRenderTest extends KernelTestCase
$addr->setSteps('4');
- yield [$addr, 'esc 4 - 5, Rue ABC - 012345 Locality - France'];
+ yield [$addr, 'esc 4 — 5, Rue ABC — 012345 Locality — France'];
}
public function complexAddressDataProviderBE(): Iterator
@@ -132,7 +132,7 @@ final class AddressRenderTest extends KernelTestCase
$addr->setCorridor('3');
$addr->setSteps('4');
- yield [$addr, 'Résidence "Les Bleuets" - appart 1 - ét 2 - coul 3 - esc 4 - Rue ABC, 5 - 012345 Locality - Belgium'];
+ yield [$addr, 'Résidence "Les Bleuets" - appart 1 - ét 2 - coul 3 - esc 4 — Rue ABC, 5 — 012345 Locality — Belgium'];
}
public function complexAddressDataProviderFR(): Iterator
@@ -158,7 +158,7 @@ final class AddressRenderTest extends KernelTestCase
$addr->setExtra('A droite de la porte');
$addr->setDistribution('CEDEX');
- yield [$addr, 'appart 1 - ét 2 - coul 3 - esc 4 - Résidence "Les Bleuets" - 5, Rue ABC - A droite de la porte - 012345 Locality CEDEX - France'];
+ yield [$addr, 'appart 1 - ét 2 - coul 3 - esc 4 — Résidence "Les Bleuets" — 5, Rue ABC — A droite de la porte — 012345 Locality CEDEX — France'];
}
public function noFullAddressDataProviderBE(): Iterator
@@ -175,7 +175,7 @@ final class AddressRenderTest extends KernelTestCase
$addr->setPostcode($postCode)
->setIsNoAddress(true);
- yield [$addr, '012345 Locality - Belgium'];
+ yield [$addr, '012345 Locality — Belgium'];
}
public function simpleAddressDataProviderBE(): Iterator
@@ -193,7 +193,7 @@ final class AddressRenderTest extends KernelTestCase
->setStreetNumber('5')
->setPostcode($postCode);
- yield [$addr, 'Rue ABC, 5 - 012345 Locality - Belgium'];
+ yield [$addr, 'Rue ABC, 5 — 012345 Locality — Belgium'];
}
public function simpleAddressDataProviderFR(): Iterator
@@ -211,7 +211,7 @@ final class AddressRenderTest extends KernelTestCase
->setStreetNumber('5')
->setPostcode($postCode);
- yield [$addr, '5, Rue ABC - 012345 Locality - France'];
+ yield [$addr, '5, Rue ABC — 012345 Locality — France'];
}
/**
diff --git a/src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php b/src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php
index 6a61e7de4..aaac6b216 100644
--- a/src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php
+++ b/src/Bundle/ChillMainBundle/Workflow/Counter/WorkflowByUserCounter.php
@@ -16,36 +16,36 @@ use Chill\MainBundle\Entity\Workflow\EntityWorkflow;
use Chill\MainBundle\Repository\Workflow\EntityWorkflowStepRepository;
use Chill\MainBundle\Templating\UI\NotificationCounterInterface;
use Psr\Cache\CacheItemPoolInterface;
+use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Workflow\Event\Event;
-use Symfony\Component\EventDispatcher\EventSubscriberInterface;
final class WorkflowByUserCounter implements NotificationCounterInterface, EventSubscriberInterface
{
- private EntityWorkflowStepRepository $workflowStepRepository;
-
private CacheItemPoolInterface $cacheItemPool;
+ private EntityWorkflowStepRepository $workflowStepRepository;
+
public function __construct(EntityWorkflowStepRepository $workflowStepRepository, CacheItemPoolInterface $cacheItemPool)
{
$this->workflowStepRepository = $workflowStepRepository;
$this->cacheItemPool = $cacheItemPool;
}
- public function addNotification(UserInterface $user): int
+ public function addNotification(UserInterface $u): int
{
- if (!$user instanceof User) {
+ if (!$u instanceof User) {
return 0;
}
- $key = self::generateCacheKeyWorkflowByUser($user);
+ $key = self::generateCacheKeyWorkflowByUser($u);
$item = $this->cacheItemPool->getItem($key);
if ($item->isHit()) {
return $item->get();
}
- $nb = $this->getCountUnreadByUser($user);
+ $nb = $this->getCountUnreadByUser($u);
$item->set($nb)
->expiresAfter(60 * 15);
@@ -54,14 +54,21 @@ final class WorkflowByUserCounter implements NotificationCounterInterface, Event
return $nb;
}
+ public static function generateCacheKeyWorkflowByUser(User $user): string
+ {
+ return 'chill_main_workflow_by_u_' . $user->getId();
+ }
+
public function getCountUnreadByUser(User $user): int
{
return $this->workflowStepRepository->countUnreadByUser($user);
}
- public static function generateCacheKeyWorkflowByUser(User $user): string
+ public static function getSubscribedEvents()
{
- return 'chill_main_workflow_by_u_'.$user->getId();
+ return [
+ 'workflow.leave' => 'resetWorkflowCache',
+ ];
}
public function resetWorkflowCache(Event $event): void
@@ -74,11 +81,12 @@ final class WorkflowByUserCounter implements NotificationCounterInterface, Event
$entityWorkflow = $event->getSubject();
$step = $entityWorkflow->getCurrentStep();
- if ($step === null) {
+ if (null === $step) {
return;
}
$keys = [];
+
foreach ($step->getDestUser() as $user) {
$keys[] = self::generateCacheKeyWorkflowByUser($user);
}
@@ -86,15 +94,5 @@ final class WorkflowByUserCounter implements NotificationCounterInterface, Event
if ([] !== $keys) {
$this->cacheItemPool->deleteItems($keys);
}
-
}
-
- public static function getSubscribedEvents()
- {
- return [
- 'workflow.leave' => 'resetWorkflowCache',
- ];
- }
-
-
}
diff --git a/src/Bundle/ChillMainBundle/Workflow/Helper/MetadataExtractor.php b/src/Bundle/ChillMainBundle/Workflow/Helper/MetadataExtractor.php
index 60b65020e..32f78a548 100644
--- a/src/Bundle/ChillMainBundle/Workflow/Helper/MetadataExtractor.php
+++ b/src/Bundle/ChillMainBundle/Workflow/Helper/MetadataExtractor.php
@@ -72,17 +72,18 @@ class MetadataExtractor
foreach ($transitions as $transition) {
if ($transition->getName() === $transitionName) {
- break;
+ $metadata = $workflow->getMetadataStore()->getTransitionMetadata($transition);
+
+ return [
+ 'name' => $transition->getName(),
+ 'text' => array_key_exists('label', $metadata) ?
+ $this->translatableStringHelper->localize($metadata['label']) : $transition->getName(),
+ 'isForward' => $metadata['isForward'] ?? null,
+ ];
}
}
- $metadata = $workflow->getMetadataStore()->getTransitionMetadata($transition);
- return [
- 'name' => $transition->getName(),
- 'text' => array_key_exists('label', $metadata) ?
- $this->translatableStringHelper->localize($metadata['label']) : $transition->getName(),
- 'isForward' => $metadata['isForward'] ?? null,
- ];
+ return [];
}
public function buildArrayPresentationForWorkflow(WorkflowInterface $workflow): array
diff --git a/src/Bundle/ChillMainBundle/translations/validators.fr.yml b/src/Bundle/ChillMainBundle/translations/validators.fr.yml
index 7bd943f25..33973f9d7 100644
--- a/src/Bundle/ChillMainBundle/translations/validators.fr.yml
+++ b/src/Bundle/ChillMainBundle/translations/validators.fr.yml
@@ -27,4 +27,4 @@ address:
notification:
At least one addressee: Indiquez au moins un destinataire
Title must be defined: Un titre doit être indiqué
-
+ Comment content might not be blank: Le commentaire ne peut pas être vide
diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php
index 7e7b9a0c2..ec5db6222 100644
--- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkController.php
@@ -15,6 +15,7 @@ use Chill\MainBundle\Pagination\PaginatorFactory;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository;
+use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodWorkVoter;
use Psr\Log\LoggerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
@@ -23,7 +24,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Serializer\SerializerInterface;
-use Symfony\Component\Translation\TranslatorInterface;
+use Symfony\Contracts\Translation\TranslatorInterface;
class AccompanyingCourseWorkController extends AbstractController
{
@@ -60,7 +61,7 @@ class AccompanyingCourseWorkController extends AbstractController
*/
public function createWork(AccompanyingPeriod $period): Response
{
- // TODO ACL
+ $this->denyAccessUnlessGranted(AccompanyingPeriodWorkVoter::CREATE, $period);
if ($period->getSocialIssues()->count() === 0) {
$this->addFlash(
@@ -93,7 +94,8 @@ class AccompanyingCourseWorkController extends AbstractController
*/
public function deleteWork(AccompanyingPeriodWork $work, Request $request): Response
{
- // TODO ACL
+ $this->denyAccessUnlessGranted(AccompanyingPeriodWorkVoter::UPDATE, $work);
+
$em = $this->getDoctrine()->getManager();
$form = $this->createDeleteForm($work->getId());
@@ -138,7 +140,8 @@ class AccompanyingCourseWorkController extends AbstractController
*/
public function editWork(AccompanyingPeriodWork $work): Response
{
- // TODO ACL
+ $this->denyAccessUnlessGranted(AccompanyingPeriodWorkVoter::UPDATE, $work);
+
$json = $this->serializer->normalize($work, 'json', ['groups' => ['read']]);
return $this->render('@ChillPerson/AccompanyingCourseWork/edit.html.twig', [
@@ -157,13 +160,13 @@ class AccompanyingCourseWorkController extends AbstractController
*/
public function listWorkByAccompanyingPeriod(AccompanyingPeriod $period): Response
{
- // TODO ACL
+ $this->denyAccessUnlessGranted(AccompanyingPeriodWorkVoter::SEE, $period);
+
$totalItems = $this->workRepository->countByAccompanyingPeriod($period);
$paginator = $this->paginator->create($totalItems);
- $works = $this->workRepository->findByAccompanyingPeriod(
+ $works = $this->workRepository->findByAccompanyingPeriodOpenFirst(
$period,
- ['startDate' => 'DESC', 'endDate' => 'DESC'],
$paginator->getItemsPerPage(),
$paginator->getCurrentPageFirstItemNumber()
);
diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php
index da8655f3d..1ebde2b57 100644
--- a/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php
@@ -50,7 +50,6 @@ class HouseholdApiController extends ApiController
*/
public function getHouseholdByAddressReference(AddressReference $addressReference): Response
{
- // TODO ACL
$this->denyAccessUnlessGranted('ROLE_USER');
$total = $this->householdACLAwareRepository->countByAddressReference($addressReference);
diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonController.php b/src/Bundle/ChillPersonBundle/Controller/PersonController.php
index 02c77ebd3..ef06e4d3e 100644
--- a/src/Bundle/ChillPersonBundle/Controller/PersonController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/PersonController.php
@@ -224,6 +224,8 @@ final class PersonController extends AbstractController
'label' => 'Add the person',
])->add('createPeriod', SubmitType::class, [
'label' => 'Add the person and create an accompanying period',
+ ])->add('createHousehold', SubmitType::class, [
+ 'label' => 'Add the person and create a household',
]);
$form->handleRequest($request);
@@ -252,6 +254,12 @@ final class PersonController extends AbstractController
]);
}
+ if ($form->get('createHousehold')->isClicked()) {
+ return $this->redirectToRoute('chill_person_household_members_editor', [
+ 'persons' => [$person->getId()],
+ ]);
+ }
+
return $this->redirectToRoute(
'chill_person_general_edit',
['person_id' => $person->getId()]
diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php
index 593cdfc83..1e7444af6 100644
--- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php
+++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php
@@ -1153,11 +1153,8 @@ class AccompanyingPeriod implements
$this->removeComment($this->pinnedComment);
}
- if ($comment instanceof Comment) {
- if (null !== $this->pinnedComment) {
- $this->addComment($this->pinnedComment);
- }
- $this->addComment($comment);
+ if (null !== $this->pinnedComment) {
+ $this->addComment($this->pinnedComment);
}
$this->pinnedComment = $comment;
diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php
index dff4ee38f..b7e8d1c5d 100644
--- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php
+++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php
@@ -44,8 +44,8 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
{
/**
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class)
- * @Serializer\Groups({"read","read:accompanyingPeriodWork:light"})
- * @Serializer\Context(normalizationContext={"groups"={"read"}}, groups={"read:accompanyingPeriodWork:light"})
+ * @Serializer\Groups({"read", "read:accompanyingPeriodWork:light"})
+ * @Serializer\Context(normalizationContext={"groups": {"read"}}, groups={"read:accompanyingPeriodWork:light"})
*/
private ?AccompanyingPeriod $accompanyingPeriod = null;
diff --git a/src/Bundle/ChillPersonBundle/Menu/AccompanyingCourseMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/AccompanyingCourseMenuBuilder.php
index 0efbf9ac3..827dfb0a6 100644
--- a/src/Bundle/ChillPersonBundle/Menu/AccompanyingCourseMenuBuilder.php
+++ b/src/Bundle/ChillPersonBundle/Menu/AccompanyingCourseMenuBuilder.php
@@ -13,7 +13,10 @@ namespace Chill\PersonBundle\Menu;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
+use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
+use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodWorkVoter;
use Knp\Menu\MenuItem;
+use Symfony\Component\Security\Core\Security;
use Symfony\Component\Workflow\Registry;
use Symfony\Contracts\Translation\TranslatorInterface;
@@ -24,15 +27,18 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
{
protected Registry $registry;
+ protected Security $security;
+
/**
* @var TranslatorInterface
*/
protected $translator;
- public function __construct(TranslatorInterface $translator, Registry $registry)
+ public function __construct(TranslatorInterface $translator, Registry $registry, Security $security)
{
$this->translator = $translator;
$this->registry = $registry;
+ $this->security = $security;
}
public function buildMenu($menuId, MenuItem $menu, array $parameters): void
@@ -47,38 +53,44 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
], ])
->setExtras(['order' => 10]);
- $menu->addChild($this->translator->trans('Edit Accompanying Course'), [
- 'route' => 'chill_person_accompanying_course_edit',
- 'routeParameters' => [
- 'accompanying_period_id' => $period->getId(),
- ], ])
- ->setExtras(['order' => 20]);
+ if ($this->security->isGranted(AccompanyingPeriodVoter::EDIT, $period)) {
+ $menu->addChild($this->translator->trans('Edit Accompanying Course'), [
+ 'route' => 'chill_person_accompanying_course_edit',
+ 'routeParameters' => [
+ 'accompanying_period_id' => $period->getId(),
+ ], ])
+ ->setExtras(['order' => 20]);
+ }
if (AccompanyingPeriod::STEP_DRAFT === $period->getStep()) {
// no more menu items if the period is draft
return;
}
- $menu->addChild($this->translator->trans('Accompanying Course History'), [
- 'route' => 'chill_person_accompanying_course_history',
- 'routeParameters' => [
- 'accompanying_period_id' => $period->getId(),
- ], ])
- ->setExtras(['order' => 30]);
+ if ($this->security->isGranted(AccompanyingPeriodVoter::SEE_DETAILS, $period)) {
+ $menu->addChild($this->translator->trans('Accompanying Course History'), [
+ 'route' => 'chill_person_accompanying_course_history',
+ 'routeParameters' => [
+ 'accompanying_period_id' => $period->getId(),
+ ], ])
+ ->setExtras(['order' => 30]);
- $menu->addChild($this->translator->trans('Accompanying Course Action'), [
- 'route' => 'chill_person_accompanying_period_work_list',
- 'routeParameters' => [
- 'id' => $period->getId(),
- ], ])
- ->setExtras(['order' => 40]);
+ $menu->addChild($this->translator->trans('Accompanying Course Comment'), [
+ 'route' => 'chill_person_accompanying_period_comment_list',
+ 'routeParameters' => [
+ 'accompanying_period_id' => $period->getId(),
+ ], ])
+ ->setExtras(['order' => 50]);
+ }
- $menu->addChild($this->translator->trans('Accompanying Course Comment'), [
- 'route' => 'chill_person_accompanying_period_comment_list',
- 'routeParameters' => [
- 'accompanying_period_id' => $period->getId(),
- ], ])
- ->setExtras(['order' => 50]);
+ if ($this->security->isGranted(AccompanyingPeriodWorkVoter::SEE, $period)) {
+ $menu->addChild($this->translator->trans('Accompanying Course Action'), [
+ 'route' => 'chill_person_accompanying_period_work_list',
+ 'routeParameters' => [
+ 'id' => $period->getId(),
+ ], ])
+ ->setExtras(['order' => 40]);
+ }
$workflow = $this->registry->get($period, 'accompanying_period_lifecycle');
diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
index 70e972aa5..9e67da458 100644
--- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
+++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php
@@ -16,17 +16,22 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
use DateTimeImmutable;
+use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
+use Doctrine\ORM\Query\ResultSetMappingBuilder;
use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ObjectRepository;
final class AccompanyingPeriodWorkRepository implements ObjectRepository
{
+ private EntityManagerInterface $em;
+
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{
+ $this->em = $entityManager;
$this->repository = $entityManager->getRepository(AccompanyingPeriodWork::class);
}
@@ -78,6 +83,36 @@ final class AccompanyingPeriodWorkRepository implements ObjectRepository
return $this->repository->findByAccompanyingPeriod($period, $orderBy, $limit, $offset);
}
+ /**
+ * Return a list of accompanying period with a defined order:.
+ *
+ * * first, opened works
+ * * then, closed works
+ *
+ * @return AccompanyingPeriodWork[]
+ */
+ public function findByAccompanyingPeriodOpenFirst(AccompanyingPeriod $period, int $limit = 10, int $offset = 0): array
+ {
+ $rsm = new ResultSetMappingBuilder($this->em);
+ $rsm->addRootEntityFromClassMetadata(AccompanyingPeriodWork::class, 'w');
+
+ $sql = "SELECT {$rsm} FROM chill_person_accompanying_period_work w
+ WHERE accompanyingPeriod_id = :periodId
+ ORDER BY
+ CASE WHEN enddate IS NULL THEN '-infinity'::timestamp ELSE 'infinity'::timestamp END ASC,
+ startdate DESC,
+ enddate DESC,
+ id DESC
+ LIMIT :limit OFFSET :offset";
+
+ $nq = $this->em->createNativeQuery($sql, $rsm)
+ ->setParameter('periodId', $period->getId(), Types::INTEGER)
+ ->setParameter('limit', $limit, Types::INTEGER)
+ ->setParameter('offset', $offset, Types::INTEGER);
+
+ return $nq->getResult();
+ }
+
public function findNearEndDateByUser(User $user, DateTimeImmutable $since, DateTimeImmutable $until, int $limit = 20, int $offset = 0): array
{
return $this->buildQueryNearEndDateByUser($user, $since, $until)
diff --git a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepository.php b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepository.php
index dc5e8f5d3..48dabd054 100644
--- a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepository.php
+++ b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdACLAwareRepository.php
@@ -14,7 +14,7 @@ namespace Chill\PersonBundle\Repository\Household;
use Chill\MainBundle\Entity\AddressReference;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Chill\PersonBundle\Entity\Household\Household;
-use Chill\PersonBundle\Security\Authorization\HouseholdVoter;
+use Chill\PersonBundle\Security\Authorization\PersonVoter;
use DateTime;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\QueryBuilder;
@@ -39,7 +39,7 @@ final class HouseholdACLAwareRepository implements HouseholdACLAwareRepositoryIn
{
$centers = $this->authorizationHelper->getReachableCenters(
$this->security->getUser(),
- HouseholdVoter::SEE
+ PersonVoter::SEE // the authorization to see a household is the same as seeing a person
);
if ([] === $centers) {
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Confirm.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Confirm.vue
index faba287c5..d12bd1184 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Confirm.vue
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Confirm.vue
@@ -60,14 +60,14 @@
{{ $t('confirm.sure_description') }}
-
+
{{ $t('confirm.no_suggested_referrer') }}
-
+
{{ $t('confirm.one_suggested_referrer') }}:
{{ $t('confirm.choose_suggested_referrer') }}
@@ -150,7 +150,6 @@ export default {
computed: {
...mapState({
accompanyingCourse: state => state.accompanyingCourse,
- filteredReferrersSuggested: state => state.filteredReferrersSuggested
}),
...mapGetters([
'isParticipationValid',
@@ -160,15 +159,16 @@ export default {
'isLocationValid',
'isJobValid',
'validationKeys',
- 'isValidToBeConfirmed'
+ 'isValidToBeConfirmed',
+ 'usersSuggestedFilteredByJob',
]),
deleteLink() {
return `/fr/parcours/${this.accompanyingCourse.id}/delete`; //TODO locale
},
disableConfirm() {
- return this.clickedDoNotChooseReferrer
- ? (this.accompanyingCourse.user === null && this.filteredReferrersSuggested.length === 0)
- : (this.accompanyingCourse.user === null && this.filteredReferrersSuggested.length === 0) || (this.filteredReferrersSuggested.length === 1);
+ return (this.accompanyingCourse.user === null
+ && this.usersSuggestedFilteredByJob.length === 1
+ && this.clickedDoNotChooseReferrer === false);
}
},
methods: {
@@ -183,7 +183,7 @@ export default {
});
},
chooseSuggestedReferrer() {
- this.$store.dispatch('updateReferrer', this.filteredReferrersSuggested[0])
+ this.$store.dispatch('updateReferrer', this.usersSuggestedFilteredByJob[0])
.catch(({name, violations}) => {
if (name === 'ValidationException' || name === 'AccessException') {
violations.forEach((violation) => this.$toast.open({message: violation}));
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue
index 2ed08ffc0..1a1a7e26e 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue
@@ -10,6 +10,7 @@
addAge : true,
hLevel : 3,
isConfidential : false,
+ isMultiline: true,
}"
:person="participation.person"
:returnPath="getAccompanyingCourseReturnPath">
@@ -28,7 +29,7 @@
-
+
{
- this.$store.dispatch('addPerson', { target: payload.target, body: response })
- this.canCloseOnTheFlyModal = true;
+ this.$store.dispatch('addPerson', { target: payload.target, body: response });
+ this.$refs.onTheFly.closeModal();
})
.catch((error) => {
if (error.name === 'ValidationException') {
@@ -143,10 +145,10 @@ export default {
body.telephone = payload.data.phonenumber;
body.address = { id: payload.data.address.address_id };
- makeFetch('PATCH', `/api/1.0/third-party/third-party/${payload.data.id}.json`, body)
+ makeFetch('PATCH', `/api/1.0/thirdparty/thirdparty/${payload.data.id}.json`, body)
.then(response => {
this.$store.dispatch('addThirdparty', { target: payload.target, body: response })
- this.canCloseOnTheFlyModal = true;
+ this.$refs.onTheFly.closeModal();
})
.catch((error) => {
if (error.name === 'ValidationException') {
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 f8cf0ae0b..0d9465f3a 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Referrer.vue
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Referrer.vue
@@ -1,164 +1,178 @@
-
-
{{ $t('referrer.title') }}
+
+
{{ $t('referrer.title') }}
-
+
- {{ $t('job.label') }}
+ {{ $t('job.label') }}
-
+ name="selectJob"
+ label="text"
+ :custom-label="customJobLabel"
+ track-by="id"
+ :multiple="false"
+ :searchable="true"
+ :placeholder="$t('job.placeholder')"
+ v-model="valueJob"
+ :options="jobs"
+ :select-label="$t('multiselect.select_label')"
+ :deselect-label="$t('multiselect.deselect_label')"
+ :selected-label="$t('multiselect.selected_label')"
+ >
- {{ $t('referrer.label') }}
+ {{ $t('referrer.label') }}
-
+ name="selectReferrer"
+ label="text"
+ track-by="id"
+ :multiple="false"
+ :searchable="true"
+ :placeholder="$t('referrer.placeholder')"
+ v-model="value"
+ :options="users"
+ :select-label="$t('multiselect.select_label')"
+ :deselect-label="$t('multiselect.deselect_label')"
+ :selected-label="$t('multiselect.selected_label')"
+ >
-
-
-
+
-
+
-
-
- {{ $t('referrer.assign_me') }}
-
-
+
+
+ {{ $t('referrer.assign_me') }}
+
+
-
+
-
+
{{ $t('job.not_valid') }}
-
+
-
+
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Requestor.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Requestor.vue
index 8f29f4771..92931cfcb 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Requestor.vue
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Requestor.vue
@@ -26,7 +26,7 @@
@@ -52,7 +52,7 @@
@@ -92,7 +92,7 @@
@@ -114,7 +114,7 @@
@@ -189,7 +189,6 @@ export default {
uniq: true,
}
},
- canCloseOnTheFlyModal: false
}
},
computed: {
@@ -261,12 +260,14 @@ export default {
if (payload.data.birthdate !== null) { body.birthdate = payload.data.birthdate; }
body.phonenumber = payload.data.phonenumber;
body.mobilenumber = payload.data.mobilenumber;
+ body.email = payload.data.email;
+ body.altNames = payload.data.altNames;
body.gender = payload.data.gender;
makeFetch('PATCH', `/api/1.0/person/person/${payload.data.id}.json`, body)
.then(response => {
this.$store.dispatch('addPerson', { target: payload.target, body: response })
- this.canCloseOnTheFlyModal = true;
+ this.$refs.onTheFly.closeModal();
})
.catch((error) => {
if (error.name === 'ValidationException') {
@@ -284,10 +285,10 @@ export default {
body.telephone = payload.data.phonenumber;
body.address = { id: payload.data.address.address_id };
- makeFetch('PATCH', `/api/1.0/third-party/third-party/${payload.data.id}.json`, body)
+ makeFetch('PATCH', `/api/1.0/thirdparty/thirdparty/${payload.data.id}.json`, body)
.then(response => {
this.$store.dispatch('addThirdparty', { target: payload.target, body: response })
- this.canCloseOnTheFlyModal = true;
+ this.$refs.onTheFly.closeModal();
})
.catch((error) => {
if (error.name === 'ValidationException') {
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 102dcf741..edd90f262 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
@@ -35,7 +35,7 @@
:id="resource.resource.id"
action="edit"
@saveFormOnTheFly="saveFormOnTheFly"
- :canCloseModal="canCloseOnTheFlyModal">
+ ref="onTheFly">
@@ -82,7 +82,7 @@
:id="resource.resource.id"
action="edit"
@saveFormOnTheFly="saveFormOnTheFly"
- :canCloseModal="canCloseOnTheFlyModal">
+ ref="onTheFly">
@@ -116,11 +116,6 @@ export default {
},
props: ['resource'],
emits: ['remove'],
- data() {
- return {
- canCloseOnTheFlyModal: false
- }
- },
computed: {
parent() {
return {
@@ -152,12 +147,14 @@ export default {
if (payload.data.birthdate !== null) { body.birthdate = payload.data.birthdate; }
body.phonenumber = payload.data.phonenumber;
body.mobilenumber = payload.data.mobilenumber;
+ body.email = payload.data.email;
+ body.altNames = payload.data.altNames;
body.gender = payload.data.gender;
makeFetch('PATCH', `/api/1.0/person/person/${payload.data.id}.json`, body)
.then(response => {
this.$store.dispatch('addPerson', { target: payload.target, body: response })
- this.canCloseOnTheFlyModal = true;
+ this.$refs.onTheFly.closeModal();
})
.catch((error) => {
if (error.name === 'ValidationException') {
@@ -175,10 +172,10 @@ export default {
body.telephone = payload.data.phonenumber;
body.address = { id: payload.data.address.address_id };
- makeFetch('PATCH', `/api/1.0/third-party/third-party/${payload.data.id}.json`, body)
+ makeFetch('PATCH', `/api/1.0/thirdparty/thirdparty/${payload.data.id}.json`, body)
.then(response => {
this.$store.dispatch('addThirdparty', { target: payload.target, body: response })
- this.canCloseOnTheFlyModal = true;
+ this.$refs.onTheFly.closeModal();
})
.catch((error) => {
if (error.name === 'ValidationException') {
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js
index 87f6d8d09..49253eab8 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js
@@ -140,7 +140,7 @@ const appMessages = {
sure_description: "Une fois le changement confirmé, il ne sera plus possible de le remettre à l'état de brouillon !",
ok: "Confirmer le parcours",
delete: "Supprimer le parcours",
- no_suggested_referrer: "Il n'y a aucun référent qui puisse être désigné pour ce parcours. Vérifiez la localisation du parcours, les métiers et service indiqués. Si le problème persiste, contactez l'administrateur du logiciel.",
+ no_suggested_referrer: "Il n'y a aucun référent qui puisse être suggéré pour ce parcours. Vérifiez la localisation du parcours, les métiers et service indiqués. Si les données sont correctes, vous pouvez confirmer ce parcours.",
one_suggested_referrer: "Un unique référent peut être suggéré pour ce parcours",
choose_suggested_referrer: "Voulez-vous le désigner directement ?",
choose_button: "Désigner",
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js
index ea8f3f556..0f682e86a 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js
@@ -40,7 +40,6 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
scopesAtBackend: accompanyingCourse.scopes.map(scope => scope),
// the users which are available for referrer
referrersSuggested: [],
- filteredReferrersSuggested: [],
// all the users available
users: [],
permissions: {}
@@ -93,6 +92,30 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
return false;
},
+ usersFilteredByJob(state) {
+ return state.users.filter(u => {
+ if (null !== state.accompanyingCourse.job) {
+ return (u.user_job === null ? null : u.user_job.id) === state.accompanyingCourse.job.id;
+ } else {
+ return true;
+ }
+ });
+ },
+ usersSuggestedFilteredByJob(state) {
+ return state.referrersSuggested.filter(u => {
+ if (null !== state.accompanyingCourse.job) {
+ return (u.user_job === null ? null : u.user_job.id) === state.accompanyingCourse.job.id;
+ } else {
+ return true;
+ }
+ }).filter(u => {
+ if (null !== state.accompanyingCourse.user) {
+ return u.id !== state.accompanyingCourse.user.id;
+ }
+
+ return true;
+ });
+ },
},
mutations: {
catchError(state, error) {
@@ -216,22 +239,6 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
return u;
});
},
- setFilteredReferrersSuggested(state) {
- state.filteredReferrersSuggested = state.referrersSuggested.filter(u => {
- if (u.user_job && state.accompanyingCourse.job && state.accompanyingCourse.user) {
- return u.user_job.id === state.accompanyingCourse.job.id && state.accompanyingCourse.user.id !== u.id
- } else {
- if (null === state.accompanyingCourse.user) {
- if (u.user_job && state.accompanyingCourse.job) {
- return u.user_job.id === state.accompanyingCourse.job.id
- } else {
- return true;
- }
- }
- return state.accompanyingCourse.user.id !== u.id;
- }
- })
- },
confirmAccompanyingCourse(state, response) {
//console.log('### mutation: confirmAccompanyingCourse: response', response);
state.accompanyingCourse.step = response.step;
@@ -689,8 +696,14 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
})
},
updateReferrer({ commit }, payload) {
+ console.log('update referrer', payload);
+ console.log('payload !== null', payload !== null);
const url = `/api/1.0/person/accompanying-course/${id}.json`;
- const body = { type: "accompanying_period", user: { id: payload.id, type: payload.type }};
+ let body = { type: "accompanying_period", user: null };
+
+ if (payload !== null) {
+ body = { type: "accompanying_period", user: { id: payload.id, type: payload.type } };
+ }
return makeFetch('PATCH', url, body)
.then((response) => {
@@ -704,12 +717,15 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
},
updateJob({ commit }, payload) {
const url = `/api/1.0/person/accompanying-course/${id}.json`;
- const body = { type: "accompanying_period", job: { id: payload.id, type: payload.type }};
+ let body = { type: "accompanying_period", job: null };
+
+ if (payload !== null) {
+ body = { type: "accompanying_period", job: { id: payload.id, type: payload.type } };
+ }
return makeFetch('PATCH', url, body)
.then((response) => {
commit('updateJob', response.job);
- commit('setFilteredReferrersSuggested');
})
.catch((error) => {
commit('catchError', error);
@@ -734,7 +750,6 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
async fetchReferrersSuggested({ state, commit}) {
let users = await getReferrersSuggested(state.accompanyingCourse);
commit('setReferrersSuggested', users);
- commit('setFilteredReferrersSuggested');
if (
null === state.accompanyingCourse.user
&& !state.accompanyingCourse.confidential
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue
index f9d1a747c..34c0794fb 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue
@@ -211,7 +211,7 @@
-
+
@@ -286,6 +286,8 @@ import ListWorkflowModal from 'ChillMainAssets/vuejs/_components/EntityWorkflow/
import PickWorkflow from 'ChillMainAssets/vuejs/_components/EntityWorkflow/PickWorkflow.vue';
import PersonText from 'ChillPersonAssets/vuejs/_components/Entity/PersonText.vue';
import {buildLinkCreate} from 'ChillMainAssets/lib/entity-workflow/api.js';
+import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods';
+
const i18n = {
messages: {
@@ -476,15 +478,27 @@ export default {
},
saveFormOnTheFly(payload) {
console.log('saveFormOnTheFly: type', payload.type, ', data', payload.data);
- payload.target = 'resource';
- this.$store.dispatch('patchOnTheFly', payload)
- .catch(({name, violations}) => {
- if (name === 'ValidationException' || name === 'AccessException') {
- violations.forEach((violation) => this.$toast.open({message: violation}));
+
+ let body = { type: payload.type };
+ body.name = payload.data.text;
+ body.email = payload.data.email;
+ body.telephone = payload.data.phonenumber;
+ body.address = { id: payload.data.address.address_id };
+
+ makeFetch('PATCH', `/api/1.0/thirdparty/thirdparty/${payload.data.id}.json`, body)
+ .then(response => {
+ this.$store.dispatch('updateThirdParty', response)
+ this.$refs.onTheFly.closeModal();
+ })
+ .catch((error) => {
+ if (error.name === 'ValidationException') {
+ for (let v of error.violations) {
+ this.$toast.open({message: v });
+ }
} else {
- this.$toast.open({message: 'An error occurred'})
+ this.$toast.open({message: 'An error occurred'});
}
- });
+ })
}
}
};
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/index.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/index.js
index 0ef2d0de4..143d34215 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/index.js
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/index.js
@@ -1,7 +1,9 @@
import { createApp } from 'vue';
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n';
import { store } from './store';
-import { personMessages } from 'ChillPersonAssets/vuejs/_js/i18n'
+import { personMessages } from 'ChillPersonAssets/vuejs/_js/i18n';
+import VueToast from 'vue-toast-notification';
+import 'vue-toast-notification/dist/theme-sugar.css';
import App from './App.vue';
const i18n = _createI18n(personMessages);
@@ -10,6 +12,12 @@ const app = createApp({
template: ` `,
})
.use(store)
+.use(VueToast, {
+ position: "bottom-right",
+ type: "error",
+ duration: 5000,
+ dismissible: true
+})
.use(i18n)
.component('app', App)
.mount('#accompanying_course_work_edit');
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js
index 0cc85fb76..6c81748d2 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js
@@ -266,6 +266,14 @@ const store = createStore({
state.thirdParties.push(unexistings[i]);
}
},
+ updateThirdParty(state, thirdParty) {
+ for (let t of state.thirdParties) {
+ if (t.id === thirdParty.id){
+ state.thirdParties = state.thirdParties.filter(t => t.id !== thirdParty.id);
+ state.thirdParties.push(thirdParty);
+ }
+ }
+ },
removeThirdParty(state, thirdParty) {
state.thirdParties = state.thirdParties
.filter(t => t.id !== thirdParty.id);
@@ -278,6 +286,10 @@ const store = createStore({
},
},
actions: {
+ updateThirdParty({ commit }, payload) {
+ console.log(payload);
+ commit('updateThirdParty', payload);
+ },
getReachablesGoalsForAction({ getters, commit, dispatch }) {
let
socialActionId = getters.socialAction.id,
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue
index 9e318ff96..1f017d28d 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue
@@ -69,7 +69,7 @@
:buttonText="$t('onthefly.create.button', {q: query})"
action="create"
@saveFormOnTheFly="saveFormOnTheFly"
- :canCloseModal="canCloseOnTheFlyModal">
+ ref="onTheFly">
@@ -121,7 +121,6 @@ export default {
selected: [],
priorSuggestion: {}
},
- canCloseOnTheFlyModal: false
}
},
computed: {
@@ -271,7 +270,7 @@ export default {
makeFetch('POST', '/api/1.0/person/person.json', data)
.then(response => {
this.newPriorSuggestion(response);
- this.canCloseOnTheFlyModal = true;
+ this.$refs.onTheFly.closeModal();
})
.catch((error) => {
if (error.name === 'ValidationException') {
@@ -287,7 +286,7 @@ export default {
makeFetch('POST', '/api/1.0/thirdparty/thirdparty.json', data)
.then(response => {
this.newPriorSuggestion(response);
- this.canCloseOnTheFlyModal = true;
+ this.$refs.onTheFly.closeModal();
})
.catch((error) => {
if (error.name === 'ValidationException') {
@@ -299,7 +298,6 @@ export default {
}
})
}
- this.canCloseOnTheFlyModal = false;
}
},
}
diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/OnTheFly/Person.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/OnTheFly/Person.vue
index 9543da3bb..0e511ce5e 100644
--- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/OnTheFly/Person.vue
+++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/OnTheFly/Person.vue
@@ -43,10 +43,11 @@
{{ $t('person.firstname') }}
-
{{ 'notification.comments_list'|trans }}
- + {% if notification.comments|length > 0 %}{{ 'Write a new comment'|trans }}
- + {{ form_start(appendCommentForm) }} {{ form_errors(appendCommentForm) }} {{ form_widget(appendCommentForm.content) }} + {{ form_errors(appendCommentForm.content) }}