From 4fa1bb4341b6570f87bb7126cf1fb9915174cf88 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 12:45:02 +0100 Subject: [PATCH 01/23] demandeur not displayed in search list if anonymous --- .../views/Person/list_with_period.html.twig | 61 ++++++++++--------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig index 6f107a593..708766dc2 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig @@ -99,11 +99,12 @@ {% endif %}
- {% if acp.requestorPerson == person %} + {% if acp.requestoranonymous == false and acp.requestorPerson == person %} {{ 'Requestor'|trans({'gender': person.gender}) }} {% endif %} + {% if acp.emergency %} {{- 'Emergency'|trans|upper -}} {% endif %} @@ -186,39 +187,39 @@ - - {% if (acp.requestorPerson is not null and acp.requestorPerson.id != person.id) or acp.requestorThirdParty is not null %} -
-
-

- {% if acp.requestorPerson is not null %} - {{ 'Requestor'|trans({'gender': acp.requestorPerson.gender}) }} + {% if acp.requestoranonymous == false %} + {% if (acp.requestorPerson is not null and acp.requestorPerson.id != person.id) or acp.requestorThirdParty is not null %} +
+
+

+ {% if acp.requestorPerson is not null %} + {{ 'Requestor'|trans({'gender': acp.requestorPerson.gender}) }} + {% else %} + {{ 'Requestor'|trans({'gender': 'other'})}} + {% endif %} +

+
+
+ {% if acp.requestorThirdParty is not null %} + {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { + targetEntity: { name: 'thirdparty', id: acp.requestorThirdParty.id }, + action: 'show', + displayBadge: true, + buttonText: acp.requestorThirdParty|chill_entity_render_string + } %} {% else %} - {{ 'Requestor'|trans({'gender': 'other'})}} + {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { + targetEntity: { name: 'person', id: acp.requestorPerson.id }, + action: 'show', + displayBadge: true, + buttonText: acp.requestorPerson|chill_entity_render_string, + isDead: acp.requestorPerson.deathdate is not null + } %} {% endif %} -

+
-
- {% if acp.requestorThirdParty is not null %} - {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { - targetEntity: { name: 'thirdparty', id: acp.requestorThirdParty.id }, - action: 'show', - displayBadge: true, - buttonText: acp.requestorThirdParty|chill_entity_render_string - } %} - {% else %} - {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { - targetEntity: { name: 'person', id: acp.requestorPerson.id }, - action: 'show', - displayBadge: true, - buttonText: acp.requestorPerson|chill_entity_render_string, - isDead: acp.requestorPerson.deathdate is not null - } %} - {% endif %} -
-
+ {% endif %} {% endif %} - {% endfor %} From 68d99050bc7554702dc594929429257e03797746 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 13:06:59 +0100 Subject: [PATCH 02/23] commentfield for marital status is always visible --- .../ChillPersonBundle/Resources/views/Person/edit.html.twig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig index d394a75a8..dc71d9981 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig @@ -85,9 +85,11 @@
{{ form_row(form.maritalStatusDate, { 'label' : 'Date of last marital status change'} ) }} - {{ form_row(form.maritalStatusComment, { 'label' : 'Comment on the marital status'} ) }}
{%- endif -%} +
+ {{ form_row(form.maritalStatusComment, { 'label' : 'Comment on the marital status'} ) }} +
{%- endif -%} From faebb0fe30a7597d03dbc0a82d18436a83a9f3a7 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 13:08:55 +0100 Subject: [PATCH 03/23] changelog updated --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dcd149841..92e3085e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,8 @@ and this project adheres to * [parcours]: component added to change the opening date of a parcours (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/411) * [search]: listing of parcours display changed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/410) * [user]: page with accompanying periods to which is user is referent (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/408) - +* [person]: Comment on marital status is possible even if marital status is not defined (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/421) +* [parcours]: In the list of person results the requestor is not displayed if defined as anonymous (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/424) ## Test releases From bc1a63354cfd497fa6cab56142b7e675c279ec7d Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 13:11:25 +0100 Subject: [PATCH 04/23] php csfixes --- .../Controller/UserAccompanyingPeriodController.php | 11 ++++++----- .../ChillPersonBundle/Entity/AccompanyingPeriod.php | 2 +- src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php | 3 --- .../Repository/AccompanyingPeriodRepository.php | 10 +++++----- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php index ddaf1b856..aa849ac2b 100644 --- a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php +++ b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php @@ -9,7 +9,6 @@ declare(strict_types=1); - namespace Chill\PersonBundle\Controller; use Chill\MainBundle\Pagination\PaginatorFactory; @@ -20,7 +19,6 @@ use Symfony\Component\Routing\Annotation\Route; class UserAccompanyingPeriodController extends AbstractController { - private AccompanyingPeriodRepository $accompanyingPeriodRepository; private PaginatorFactory $paginatorFactory; @@ -38,13 +36,16 @@ class UserAccompanyingPeriodController extends AbstractController { $total = $this->accompanyingPeriodRepository->countBy(['user' => $this->getUser()]); $pagination = $this->paginatorFactory->create($total); - $accompanyingPeriods = $this->accompanyingPeriodRepository->findBy(['user' => $this->getUser()], - ['openingDate' => 'DESC'], $pagination->getItemsPerPage(), $pagination->getCurrentPageFirstItemNumber()); + $accompanyingPeriods = $this->accompanyingPeriodRepository->findBy( + ['user' => $this->getUser()], + ['openingDate' => 'DESC'], + $pagination->getItemsPerPage(), + $pagination->getCurrentPageFirstItemNumber() + ); return $this->render('@ChillPerson/AccompanyingPeriod/user_periods_list.html.twig', [ 'accompanyingPeriods' => $accompanyingPeriods, 'pagination' => $pagination, ]); - } } diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index c457d2863..e7a1c514b 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -212,7 +212,7 @@ class AccompanyingPeriod implements * * @ORM\Column(type="date") * @Groups({"read", "write", "docgen:read"}) - * @Assert\LessThan(value= "today", groups={AccompanyingPeriod::STEP_CONFIRMED}) + * @Assert\LessThan(value="today", groups={AccompanyingPeriod::STEP_CONFIRMED}) * @Assert\LessThan(propertyPath="closingDate", groups={AccompanyingPeriod::STEP_CONFIRMED}) */ private ?DateTime $openingDate = null; diff --git a/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php index 3e56b423c..0a9d2a31c 100644 --- a/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php +++ b/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php @@ -12,9 +12,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Menu; use Chill\MainBundle\Routing\LocalMenuBuilderInterface; -use Chill\TaskBundle\Templating\UI\CountNotificationTask; use Knp\Menu\MenuItem; -use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; use Symfony\Contracts\Translation\TranslatorInterface; @@ -25,7 +23,6 @@ class UserMenuBuilder implements LocalMenuBuilderInterface */ public $authorizationChecker; - /** * @var TranslatorInterface */ diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php index 9554f2a3b..edb4b4f3d 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php @@ -26,6 +26,11 @@ final class AccompanyingPeriodRepository implements ObjectRepository $this->repository = $entityManager->getRepository(AccompanyingPeriod::class); } + public function countBy(array $criteria): int + { + return $this->repository->count($criteria); + } + public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder { return $this->repository->createQueryBuilder($alias, $indexBy); @@ -49,11 +54,6 @@ final class AccompanyingPeriodRepository implements ObjectRepository return $this->repository->findBy($criteria, $orderBy, $limit, $offset); } - public function countBy(array $criteria): int - { - return $this->repository->count($criteria); - } - public function findOneBy(array $criteria): ?AccompanyingPeriod { return $this->findOneBy($criteria); From 695d22adbad74e7af87f148207a02542a729343c Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 13:39:52 +0100 Subject: [PATCH 05/23] bugfix creation of person or thirdparty through onTheFly --- .../Resources/public/vuejs/_components/AddPersons.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue index 59647e160..c880ad2fd 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue @@ -299,6 +299,7 @@ export default { } }) } + this.canCloseOnTheFlyModal = false; } }, } From 15393d9da903188a32beb08e084ab609e55882d1 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 13:45:41 +0100 Subject: [PATCH 06/23] changelog updated with bugfix --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 92e3085e8..fe26e1978 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to * [user]: page with accompanying periods to which is user is referent (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/408) * [person]: Comment on marital status is possible even if marital status is not defined (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/421) * [parcours]: In the list of person results the requestor is not displayed if defined as anonymous (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/424) +* [bugfix]: modal closes and newly created person/thirdparty is selected when multiple persons/thirdparties are created through the modal (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/429) ## Test releases From 1162c436c14a577b9e80196a8162361774b0a909 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 12:45:02 +0100 Subject: [PATCH 07/23] demandeur not displayed in search list if anonymous --- .../views/Person/list_with_period.html.twig | 61 ++++++++++--------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig index 109e2024a..86459337d 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig @@ -99,11 +99,12 @@ {% endif %}
- {% if acp.requestorPerson == person %} + {% if acp.requestoranonymous == false and acp.requestorPerson == person %} {{ 'Requestor'|trans({'gender': person.gender}) }} {% endif %} + {% if acp.emergency %} {{- 'Emergency'|trans|upper -}} {% endif %} @@ -186,39 +187,39 @@ - - {% if (acp.requestorPerson is not null and acp.requestorPerson.id != person.id) or acp.requestorThirdParty is not null %} -
-
-

- {% if acp.requestorPerson is not null %} - {{ 'Requestor'|trans({'gender': acp.requestorPerson.gender}) }} + {% if acp.requestoranonymous == false %} + {% if (acp.requestorPerson is not null and acp.requestorPerson.id != person.id) or acp.requestorThirdParty is not null %} +
+
+

+ {% if acp.requestorPerson is not null %} + {{ 'Requestor'|trans({'gender': acp.requestorPerson.gender}) }} + {% else %} + {{ 'Requestor'|trans({'gender': 'other'})}} + {% endif %} +

+
+
+ {% if acp.requestorThirdParty is not null %} + {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { + targetEntity: { name: 'thirdparty', id: acp.requestorThirdParty.id }, + action: 'show', + displayBadge: true, + buttonText: acp.requestorThirdParty|chill_entity_render_string + } %} {% else %} - {{ 'Requestor'|trans({'gender': 'other'})}} + {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { + targetEntity: { name: 'person', id: acp.requestorPerson.id }, + action: 'show', + displayBadge: true, + buttonText: acp.requestorPerson|chill_entity_render_string, + isDead: acp.requestorPerson.deathdate is not null + } %} {% endif %} -

+
-
- {% if acp.requestorThirdParty is not null %} - {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { - targetEntity: { name: 'thirdparty', id: acp.requestorThirdParty.id }, - action: 'show', - displayBadge: true, - buttonText: acp.requestorThirdParty|chill_entity_render_string - } %} - {% else %} - {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { - targetEntity: { name: 'person', id: acp.requestorPerson.id }, - action: 'show', - displayBadge: true, - buttonText: acp.requestorPerson|chill_entity_render_string, - isDead: acp.requestorPerson.deathdate is not null - } %} - {% endif %} -
-
+ {% endif %} {% endif %} - {% endfor %} From af1c2687841c462ec988090da28d0e8e34092a4a Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 13:06:59 +0100 Subject: [PATCH 08/23] commentfield for marital status is always visible --- .../ChillPersonBundle/Resources/views/Person/edit.html.twig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig index d394a75a8..dc71d9981 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/edit.html.twig @@ -85,9 +85,11 @@
{{ form_row(form.maritalStatusDate, { 'label' : 'Date of last marital status change'} ) }} - {{ form_row(form.maritalStatusComment, { 'label' : 'Comment on the marital status'} ) }}
{%- endif -%} +
+ {{ form_row(form.maritalStatusComment, { 'label' : 'Comment on the marital status'} ) }} +
{%- endif -%} From 0689ca366d198391f4b8edce26023fd21f704b90 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 13:08:55 +0100 Subject: [PATCH 09/23] changelog updated --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a198c0929..78637ad4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,10 +29,14 @@ and this project adheres to * [parcours]: component added to change the opening date of a parcours (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/411) * [search]: listing of parcours display changed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/410) * [user]: page with accompanying periods to which is user is referent (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/408) +* [person]: Comment on marital status is possible even if marital status is not defined (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/421) +* [parcours]: In the list of person results the requestor is not displayed if defined as anonymous (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/424) * [person] age added to renderstring + renderbox/ vue component created to display person text (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/389) * [household member editor] allow to push to existing household * [workflow][notification] improve how notifications and workflows are 'attached' to entities: contextual list, counter, buttons and vue modal +## Test releases + ### test release 2021-01-28 From 69dd920fd6468893e2f11a8b752bdbc89989ab45 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 13:11:25 +0100 Subject: [PATCH 10/23] php csfixes --- src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index d71ac2b9f..07fb859b7 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -213,7 +213,7 @@ class AccompanyingPeriod implements * * @ORM\Column(type="date") * @Groups({"read", "write", "docgen:read"}) - * @Assert\LessThan(value= "today", groups={AccompanyingPeriod::STEP_CONFIRMED}) + * @Assert\LessThan(value="today", groups={AccompanyingPeriod::STEP_CONFIRMED}) * @Assert\LessThan(propertyPath="closingDate", groups={AccompanyingPeriod::STEP_CONFIRMED}) */ private ?DateTime $openingDate = null; From b79885cd215165040c919e94693c0fe56a9d44d5 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 13:39:52 +0100 Subject: [PATCH 11/23] bugfix creation of person or thirdparty through onTheFly --- .../Resources/public/vuejs/_components/AddPersons.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue index 3ef7b4037..f9b32f091 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue @@ -299,6 +299,7 @@ export default { } }) } + this.canCloseOnTheFlyModal = false; } }, } From 2eb1ebd2639870fdb1a4b5ffc094fa8a714d3729 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 13:45:41 +0100 Subject: [PATCH 12/23] changelog updated with bugfix --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78637ad4b..aa0d8c08b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ and this project adheres to * [user]: page with accompanying periods to which is user is referent (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/408) * [person]: Comment on marital status is possible even if marital status is not defined (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/421) * [parcours]: In the list of person results the requestor is not displayed if defined as anonymous (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/424) +* [bugfix]: modal closes and newly created person/thirdparty is selected when multiple persons/thirdparties are created through the modal (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/429) * [person] age added to renderstring + renderbox/ vue component created to display person text (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/389) * [household member editor] allow to push to existing household * [workflow][notification] improve how notifications and workflows are 'attached' to entities: contextual list, counter, buttons and vue modal From a4457664d45d215fed71142ea90fed1f1a70bfd9 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 18:33:29 +0100 Subject: [PATCH 13/23] bugfix addPersons --- .../public/vuejs/_components/AddPersons.vue | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue index f9b32f091..3958e39ef 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue @@ -195,18 +195,18 @@ export default { setTimeout(function() { if (query === "") { - this.loadSuggestions([]); - return; + this.loadSuggestions([]); + return; } if (query === this.search.query) { - if (this.currentSearchQueryController !== undefined) { - this.currentSearchQueryController.abort() - } - this.currentSearchQueryController = new AbortController(); - searchEntities({ query, options: this.options }, this.currentSearchQueryController) + if (this.currentSearchQueryController !== undefined) { + this.currentSearchQueryController.abort() + } + this.currentSearchQueryController = new AbortController(); + searchEntities({ query, options: this.options }, this.currentSearchQueryController) .then(suggested => new Promise((resolve, reject) => { - this.loadSuggestions(suggested.results); - resolve(); + this.loadSuggestions(suggested.results); + resolve(); })); } }.bind(this), query.length > 3 ? 300 : 700); @@ -241,13 +241,14 @@ export default { return item.result.type + item.result.id; }, addPriorSuggestion() { - //console.log('addPriorSuggestion', this.hasPriorSuggestion); + // console.log('prior suggestion', this.priorSuggestion); if (this.hasPriorSuggestion) { - console.log('addPriorSuggestion',); + // console.log('addPriorSuggestion',); this.suggested.unshift(this.priorSuggestion); this.selected.unshift(this.priorSuggestion); - console.log('reset priorSuggestion'); + // console.log('selected', this.selected); + // console.log('suggested', this.suggested); this.newPriorSuggestion(null); } }, @@ -260,13 +261,14 @@ export default { result: entity } this.search.priorSuggestion = suggestion; - console.log('search priorSuggestion', this.search.priorSuggestion); + // console.log('search priorSuggestion', this.search.priorSuggestion); + this.addPriorSuggestion(suggestion) } else { this.search.priorSuggestion = {}; } }, saveFormOnTheFly({ type, data }) { - console.log('saveFormOnTheFly from addPersons, type', type, ', data', data); + // console.log('saveFormOnTheFly from addPersons, type', type, ', data', data); if (type === 'person') { makeFetch('POST', '/api/1.0/person/person.json', data) .then(response => { @@ -276,10 +278,10 @@ export default { .catch((error) => { if (error.name === 'ValidationException') { for (let v of error.violations) { - this.$toast.open({message: v }); + this.$toast.open({message: v }); } } else { - this.$toast.open({message: 'An error occurred'}); + this.$toast.open({message: 'An error occurred'}); } }) } @@ -292,10 +294,10 @@ export default { .catch((error) => { if (error.name === 'ValidationException') { for (let v of error.violations) { - this.$toast.open({message: v }); + this.$toast.open({message: v }); } } else { - this.$toast.open({message: 'An error occurred'}); + this.$toast.open({message: 'An error occurred'}); } }) } From a0bc6c76047a278f9d8157058f081194053e3c14 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 31 Jan 2022 18:47:06 +0100 Subject: [PATCH 14/23] csfixes --- .../Entity/ActivityType.php | 2 +- .../ChillMainBundle/Form/WorkflowStepType.php | 34 +++++++++---------- .../AccompanyingPeriodRepository.php | 10 +++--- .../public/vuejs/_components/AddPersons.vue | 4 +-- 4 files changed, 24 insertions(+), 26 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php index 94f732a89..bdf75ed05 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php @@ -271,7 +271,7 @@ class ActivityType public function checkSocialActionsVisibility(ExecutionContextInterface $context, $payload) { if ($this->socialIssuesVisible !== $this->socialActionsVisible) { - if (!($this->socialIssuesVisible === 2 && $this->socialActionsVisible === 1)) { + if (!(2 === $this->socialIssuesVisible && 1 === $this->socialActionsVisible)) { $context ->buildViolation('The socialActionsVisible value is not compatible with the socialIssuesVisible value') ->atPath('socialActionsVisible') diff --git a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php index 18ac10c47..b843890c2 100644 --- a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php +++ b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php @@ -76,32 +76,32 @@ class WorkflowStepType extends AbstractType 'expanded' => true, 'choices' => $choices, 'choice_label' => function (Transition $transition) use ($workflow) { - $meta = $workflow->getMetadataStore()->getTransitionMetadata($transition); + $meta = $workflow->getMetadataStore()->getTransitionMetadata($transition); - if (array_key_exists('label', $meta)) { - return $this->translatableStringHelper->localize($meta['label']); - } + if (array_key_exists('label', $meta)) { + return $this->translatableStringHelper->localize($meta['label']); + } - return $transition->getName(); - }, + return $transition->getName(); + }, 'choice_attr' => static function (Transition $transition) use ($workflow) { - $toFinal = true; + $toFinal = true; - foreach ($transition->getTos() as $to) { - $meta = $workflow->getMetadataStore()->getPlaceMetadata($to); + foreach ($transition->getTos() as $to) { + $meta = $workflow->getMetadataStore()->getPlaceMetadata($to); - if ( + if ( !array_key_exists('isFinal', $meta) || false === $meta['isFinal'] ) { - $toFinal = false; - } + $toFinal = false; } + } - return [ - 'data-is-transition' => 'data-is-transition', - 'data-to-final' => $toFinal ? '1' : '0', - ]; - }, + return [ + 'data-is-transition' => 'data-is-transition', + 'data-to-final' => $toFinal ? '1' : '0', + ]; + }, ]) ->add('future_dest_users', PickUserDynamicType::class, [ 'label' => 'workflow.dest for next steps', diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php index 3f0c30e47..10b424cef 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php @@ -28,6 +28,11 @@ final class AccompanyingPeriodRepository implements ObjectRepository $this->repository = $entityManager->getRepository(AccompanyingPeriod::class); } + public function countBy(array $criteria): int + { + return $this->repository->count($criteria); + } + public function countByRecentUserHistory(User $user, DateTimeImmutable $since): int { $qb = $this->buildQueryByRecentUserHistory($user, $since); @@ -35,11 +40,6 @@ final class AccompanyingPeriodRepository implements ObjectRepository return $qb->select('count(a)')->getQuery()->getSingleScalarResult(); } - public function countBy(array $criteria): int - { - return $this->repository->count($criteria); - } - public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder { return $this->repository->createQueryBuilder($alias, $indexBy); diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue index 3958e39ef..9e318ff96 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue @@ -247,8 +247,6 @@ export default { this.suggested.unshift(this.priorSuggestion); this.selected.unshift(this.priorSuggestion); - // console.log('selected', this.selected); - // console.log('suggested', this.suggested); this.newPriorSuggestion(null); } }, @@ -262,7 +260,7 @@ export default { } this.search.priorSuggestion = suggestion; // console.log('search priorSuggestion', this.search.priorSuggestion); - this.addPriorSuggestion(suggestion) + this.addPriorSuggestion(suggestion); } else { this.search.priorSuggestion = {}; } From 0f31a49890fe7beee6b7ded3ea86e22c1350e7ba Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Tue, 1 Feb 2022 09:10:32 +0100 Subject: [PATCH 15/23] fix: Update namespace to prevent having issues with PSR4 autoloading. --- .../Tests/Export/Aggregator/ActivityReasonAggregatorTest.php | 2 +- .../Tests/Export/Aggregator/ActivityTypeAggregatorTest.php | 2 +- .../Tests/Export/Aggregator/ActivityUserAggregatorTest.php | 2 +- .../Tests/Export/Filter/ActivityReasonFilterTest.php | 2 +- .../Filter/PersonHavingActivityBetweenDateFilterTest.php | 2 +- .../Tests/CustomFields/CustomFieldsChoiceTest.php | 2 +- .../Tests/CustomFields/CustomFieldsNumberTest.php | 2 +- .../Tests/CustomFields/CustomFieldsTextTest.php | 3 ++- .../Tests/Routing/RoutingLoaderTest.php | 2 +- .../Tests/Authorization/ParentRoleHelperTest.php | 2 +- .../ChillMainBundle/Tests/Form/Type/PickCenterTypeTest.php | 3 ++- src/Bundle/ChillMainBundle/Tests/Search/SearchProviderTest.php | 2 +- .../Tests/Security/PasswordRecover/TokenManagerTest.php | 2 +- .../Tests/DependencyInjection/ChillReportExtensionTest.php | 3 ++- .../Serializer/Normalizer/ThirdPartyJsonDenormalizerTest.php | 2 +- 15 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityReasonAggregatorTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityReasonAggregatorTest.php index fb98f0a8e..436bfc697 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityReasonAggregatorTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityReasonAggregatorTest.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\ActivityBundle\Tests\Aggregator; +namespace Chill\ActivityBundle\Tests\Export\Aggregator; use Chill\MainBundle\Test\Export\AbstractAggregatorTest; diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityTypeAggregatorTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityTypeAggregatorTest.php index 7959825a7..f6efe17a5 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityTypeAggregatorTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityTypeAggregatorTest.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\ActivityBundle\Tests\Aggregator; +namespace Chill\ActivityBundle\Tests\Export\Aggregator; use Chill\MainBundle\Test\Export\AbstractAggregatorTest; diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityUserAggregatorTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityUserAggregatorTest.php index 056ba6049..1447f473b 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityUserAggregatorTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Aggregator/ActivityUserAggregatorTest.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\ActivityBundle\Tests\Aggregator; +namespace Chill\ActivityBundle\Tests\Export\Aggregator; use Chill\MainBundle\Test\Export\AbstractAggregatorTest; diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ActivityReasonFilterTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ActivityReasonFilterTest.php index cbac6febd..5b8ae08c3 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ActivityReasonFilterTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/ActivityReasonFilterTest.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\ActivityBundle\Tests\Filter; +namespace Chill\ActivityBundle\Tests\Export\Filter; use Chill\MainBundle\Test\Export\AbstractFilterTest; use Doctrine\Common\Collections\ArrayCollection; diff --git a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonHavingActivityBetweenDateFilterTest.php b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonHavingActivityBetweenDateFilterTest.php index f444c368b..94d99c2a7 100644 --- a/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonHavingActivityBetweenDateFilterTest.php +++ b/src/Bundle/ChillActivityBundle/Tests/Export/Filter/PersonHavingActivityBetweenDateFilterTest.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\ActivityBundle\Tests\Filter; +namespace Chill\ActivityBundle\Tests\Export\Filter; use Chill\MainBundle\Test\Export\AbstractFilterTest; use DateTime; diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsChoiceTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsChoiceTest.php index db27ec921..d3355b9ce 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsChoiceTest.php +++ b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsChoiceTest.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\CustomFieldsBundle\Tests; +namespace Chill\CustomFieldsBundle\Tests\CustomFields; use Chill\CustomFieldsBundle\CustomFields\CustomFieldChoice; use Chill\CustomFieldsBundle\Entity\CustomField; diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsNumberTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsNumberTest.php index 60381f567..fb0079f05 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsNumberTest.php +++ b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsNumberTest.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\CustomFieldsBundle\Tests; +namespace Chill\CustomFieldsBundle\Tests\CustomFields; use Chill\CustomFieldsBundle\CustomFields\CustomFieldNumber; use Chill\CustomFieldsBundle\Entity\CustomField; diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsTextTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsTextTest.php index 50bf689d4..c1dca44c0 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsTextTest.php +++ b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsTextTest.php @@ -9,10 +9,11 @@ declare(strict_types=1); -namespace Chill\CustomFieldsBundle\Tests; +namespace Chill\CustomFieldsBundle\Tests\CustomFields; use Chill\CustomFieldsBundle\CustomFields\CustomFieldText; use Chill\CustomFieldsBundle\Entity\CustomField; +use Chill\CustomFieldsBundle\Tests\CustomFieldTestHelper; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; /** diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/Routing/RoutingLoaderTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/Routing/RoutingLoaderTest.php index 3cde3890a..32c6639bc 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Tests/Routing/RoutingLoaderTest.php +++ b/src/Bundle/ChillCustomFieldsBundle/Tests/Routing/RoutingLoaderTest.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\CustomFieldsBundle\Tests; +namespace Chill\CustomFieldsBundle\Tests\Routing; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Component\HttpFoundation\Response; diff --git a/src/Bundle/ChillMainBundle/Tests/Authorization/ParentRoleHelperTest.php b/src/Bundle/ChillMainBundle/Tests/Authorization/ParentRoleHelperTest.php index 69a3ac733..05b18407a 100644 --- a/src/Bundle/ChillMainBundle/Tests/Authorization/ParentRoleHelperTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Authorization/ParentRoleHelperTest.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\MainBundle\Tests\Security\Authorization; +namespace Chill\MainBundle\Tests\Authorization; use Chill\MainBundle\Security\ParentRoleHelper; use Chill\PersonBundle\Security\Authorization\PersonVoter; diff --git a/src/Bundle/ChillMainBundle/Tests/Form/Type/PickCenterTypeTest.php b/src/Bundle/ChillMainBundle/Tests/Form/Type/PickCenterTypeTest.php index 55f9b64c5..e7a6ee096 100644 --- a/src/Bundle/ChillMainBundle/Tests/Form/Type/PickCenterTypeTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Form/Type/PickCenterTypeTest.php @@ -9,10 +9,11 @@ declare(strict_types=1); -namespace Chill\MainBundle\Form\Type; +namespace Chill\MainBundle\Tests\Form\Type; use Chill\MainBundle\Entity\GroupCenter; use Chill\MainBundle\Entity\User; +use Chill\MainBundle\Form\CenterType; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Test\TypeTestCase; diff --git a/src/Bundle/ChillMainBundle/Tests/Search/SearchProviderTest.php b/src/Bundle/ChillMainBundle/Tests/Search/SearchProviderTest.php index 07d7c7ab7..e9cbd5e3c 100644 --- a/src/Bundle/ChillMainBundle/Tests/Search/SearchProviderTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Search/SearchProviderTest.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\MainBundle\Test\Search; +namespace Chill\MainBundle\Tests\Search; use Chill\MainBundle\Search\ParsingException; use Chill\MainBundle\Search\SearchInterface; diff --git a/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php b/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php index 7208c3ee9..8e29a190b 100644 --- a/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Security/PasswordRecover/TokenManagerTest.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\MainBundle\Tests\PasswordRecover; +namespace Chill\MainBundle\Tests\Security\PasswordRecover; use Chill\MainBundle\Entity\User; use Chill\MainBundle\Security\PasswordRecover\TokenManager; diff --git a/src/Bundle/ChillReportBundle/Tests/DependencyInjection/ChillReportExtensionTest.php b/src/Bundle/ChillReportBundle/Tests/DependencyInjection/ChillReportExtensionTest.php index 3a883b780..689e24699 100644 --- a/src/Bundle/ChillReportBundle/Tests/DependencyInjection/ChillReportExtensionTest.php +++ b/src/Bundle/ChillReportBundle/Tests/DependencyInjection/ChillReportExtensionTest.php @@ -9,8 +9,9 @@ declare(strict_types=1); -namespace Chill\ReportBundle\Tests\Controller; +namespace Chill\ReportBundle\Tests\DependencyInjection; +use Exception; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; /** diff --git a/src/Bundle/ChillThirdPartyBundle/Tests/Serializer/Normalizer/ThirdPartyJsonDenormalizerTest.php b/src/Bundle/ChillThirdPartyBundle/Tests/Serializer/Normalizer/ThirdPartyJsonDenormalizerTest.php index 1134652f7..39c0f58e4 100644 --- a/src/Bundle/ChillThirdPartyBundle/Tests/Serializer/Normalizer/ThirdPartyJsonDenormalizerTest.php +++ b/src/Bundle/ChillThirdPartyBundle/Tests/Serializer/Normalizer/ThirdPartyJsonDenormalizerTest.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\ThirdPartyBundle\Test\Serializer\Normalizer; +namespace Chill\ThirdPartyBundle\Tests\Serializer\Normalizer; use Chill\ThirdPartyBundle\Entity\ThirdParty; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; From ebdcc5a07dc8b145ff13878ce03b75f840c8b9d4 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Tue, 1 Feb 2022 09:11:14 +0100 Subject: [PATCH 16/23] fix: Update namespace to prevent having issues with PSR4 autoloading. --- .../Serializer/Normalizer/ThirdPartyDocGenNormalizerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillThirdPartyBundle/Tests/Serializer/Normalizer/ThirdPartyDocGenNormalizerTest.php b/src/Bundle/ChillThirdPartyBundle/Tests/Serializer/Normalizer/ThirdPartyDocGenNormalizerTest.php index 48a3ab8dd..1aaad8531 100644 --- a/src/Bundle/ChillThirdPartyBundle/Tests/Serializer/Normalizer/ThirdPartyDocGenNormalizerTest.php +++ b/src/Bundle/ChillThirdPartyBundle/Tests/Serializer/Normalizer/ThirdPartyDocGenNormalizerTest.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\ThirdPartyBundle\Test\Serializer\Normalizer; +namespace Chill\ThirdPartyBundle\Tests\Serializer\Normalizer; use Chill\MainBundle\Entity\Civility; use Chill\ThirdPartyBundle\Entity\ThirdParty; From 50e722e637dfd74e67afb9c74b47d9085ec69cb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 31 Jan 2022 21:09:00 +0100 Subject: [PATCH 17/23] fix workflow redirection in accompanying period work edit --- .../EntityWorkflow/ListWorkflowModal.vue | 33 +++++++++++++------ .../EntityWorkflow/PickWorkflow.vue | 15 +++++++-- .../vuejs/AccompanyingCourseWorkEdit/App.vue | 12 ++++++- .../components/AddEvaluation.vue | 11 +++---- .../vuejs/AccompanyingCourseWorkEdit/store.js | 1 + 5 files changed, 53 insertions(+), 19 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/EntityWorkflow/ListWorkflowModal.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/EntityWorkflow/ListWorkflowModal.vue index a188a3a02..2e4125c1a 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/EntityWorkflow/ListWorkflowModal.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/EntityWorkflow/ListWorkflowModal.vue @@ -1,5 +1,5 @@ @@ -53,6 +56,7 @@ export default { PickWorkflow, ListWorkflowVue }, + emits: ['goToGenerateWorkflow'], props: { workflows: { type: Array, @@ -73,9 +77,14 @@ export default { workflowsAvailables: { type: Array, required: true, - } + }, + preventDefaultMoveToGenerate: { + type: Boolean, + required: false, + default: false, + }, }, - data() { + data() { return { modal: { showModal: false, @@ -95,6 +104,10 @@ export default { openModal() { this.modal.showModal = true; }, + goToGenerateWorkflow(data) { + console.log('go to generate workflow intercepted'); + this.$emit('goToGenerateWorkflow', data); + } }, i18n: { messages: { @@ -108,4 +121,4 @@ export default { } - \ No newline at end of file + diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/EntityWorkflow/PickWorkflow.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/EntityWorkflow/PickWorkflow.vue index 3a39c0eff..e74cd7ef2 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/EntityWorkflow/PickWorkflow.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/EntityWorkflow/PickWorkflow.vue @@ -6,7 +6,7 @@ @@ -31,7 +31,12 @@ export default { workflowsAvailables: { type: Array, required: true, - } + }, + preventDefaultMoveToGenerate: { + type: Boolean, + required: false, + default: false, + }, }, emits: ['goToGenerateWorkflow'], methods: { @@ -39,6 +44,12 @@ export default { return buildLinkCreate(workflowName, this.relatedEntityClass, this.relatedEntityId); }, goToGenerateWorkflow(event, workflowName) { + console.log('goToGenerateWorkflow', event, workflowName); + + if (!this.$props.preventDefaultMoveToGenerate) { + event.target.click(); + } + this.$emit('goToGenerateWorkflow', {event, workflowName, link: this.makeLink(workflowName)}); } } diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue index c88de825b..f9d1a747c 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue @@ -251,6 +251,7 @@ relatedEntityClass="Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork" :relatedEntityId="this.work.id" :workflowsAvailables="this.work.workflows_availables" + @go-to-generate-workflow="goToGenerateWorkflow" > @@ -284,6 +285,7 @@ import OnTheFly from 'ChillMainAssets/vuejs/OnTheFly/components/OnTheFly.vue'; import ListWorkflowModal from 'ChillMainAssets/vuejs/_components/EntityWorkflow/ListWorkflowModal.vue'; 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'; const i18n = { messages: { @@ -334,7 +336,6 @@ export default { ListWorkflowModal, OnTheFly, PickWorkflow, - OnTheFly, PersonText, }, i18n, @@ -461,6 +462,15 @@ export default { removeThirdParty(t) { this.$store.commit('removeThirdParty', t); }, + goToGenerateWorkflow({link}) { + console.log('save before leave to generate workflow') + const callback = (data) => { + window.location.assign(link); + }; + + return this.$store.dispatch('submit', callback) + .catch(e => { console.log(e); throw e; }); + }, submit() { this.$store.dispatch('submit'); }, 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 08cb6b3e6..faf4b0ed0 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/AddEvaluation.vue @@ -10,16 +10,16 @@
  • - + - +
  • @@ -106,8 +106,7 @@ export default { this.toggleEditEvaluation(); }, goToGenerateWorkflow({event, link, workflowName}) { - event.preventDefault(); - console.log(event, link, workflowName); + console.log('goToGenerate in evaluation', event, link, workflowName); const callback = (data) => { let evaluationId = data.accompanyingPeriodWorkEvaluations.find(e => e.key === this.evaluation.key).id; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js index a46a0e221..0cc85fb76 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js @@ -210,6 +210,7 @@ const store = createStore({ editEvaluation: true, workflows_availables: state.work.workflows_availables_evaluation, documents: [], + workflows: [], }; state.evaluationsPicked.push(e); }, From a612d7dd9f13901fb596e2b8f7bb6036f29b5983 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 1 Feb 2022 10:02:33 +0100 Subject: [PATCH 18/23] improve workflow decision form --- .../Entity/ActivityType.php | 2 +- .../Entity/Workflow/EntityWorkflow.php | 14 ++++ .../ChillMainBundle/Form/WorkflowStepType.php | 75 +++++++++++++---- .../public/lib/show_hide/show_hide.js | 65 ++++++++------- .../public/page/workflow-show/index.js | 83 ++++++++++++++----- .../views/Workflow/_decision.html.twig | 55 +++++++++++- .../views/Workflow/_history.html.twig | 12 +++ .../translations/messages.fr.yml | 6 +- .../Entity/AccompanyingPeriod.php | 2 +- .../AccompanyingPeriodRepository.php | 10 +-- 10 files changed, 250 insertions(+), 74 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php index 94f732a89..bdf75ed05 100644 --- a/src/Bundle/ChillActivityBundle/Entity/ActivityType.php +++ b/src/Bundle/ChillActivityBundle/Entity/ActivityType.php @@ -271,7 +271,7 @@ class ActivityType public function checkSocialActionsVisibility(ExecutionContextInterface $context, $payload) { if ($this->socialIssuesVisible !== $this->socialActionsVisible) { - if (!($this->socialIssuesVisible === 2 && $this->socialActionsVisible === 1)) { + if (!(2 === $this->socialIssuesVisible && 1 === $this->socialActionsVisible)) { $context ->buildViolation('The socialActionsVisible value is not compatible with the socialIssuesVisible value') ->atPath('socialActionsVisible') diff --git a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php index c7a322338..a132706d7 100644 --- a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php +++ b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php @@ -174,6 +174,20 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface return null; } + public function getCurrentStepChained(): ?EntityWorkflowStep + { + $steps = $this->getStepsChained(); + $currentStep = $this->getCurrentStep(); + + foreach ($steps as $step) { + if ($step === $currentStep) { + return $step; + } + } + + return null; + } + public function getCurrentStepCreatedAt(): ?DateTimeInterface { if (null !== $previous = $this->getPreviousStepIfAny()) { diff --git a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php index 18ac10c47..eaca35812 100644 --- a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php +++ b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php @@ -48,6 +48,8 @@ class WorkflowStepType extends AbstractType $entityWorkflow = $options['entity_workflow']; $handler = $this->entityWorkflowManager->getHandler($entityWorkflow); $workflow = $this->registry->get($entityWorkflow, $entityWorkflow->getWorkflowName()); + $place = $workflow->getMarking($entityWorkflow); + $placeMetadata = $workflow->getMetadataStore()->getPlaceMetadata(array_keys($place->getPlaces())[0]); if (true === $options['transition']) { if (null === $options['entity_workflow']) { @@ -68,40 +70,77 @@ class WorkflowStepType extends AbstractType $transitions ); + if (array_key_exists('validationFilterInputLabels', $placeMetadata)) { + $inputLabels = $placeMetadata['validationFilterInputLabels']; + + $builder->add('transitionFilter', ChoiceType::class, [ + 'multiple' => false, + 'label' => 'workflow.My decision', + 'choices' => [ + 'forward' => 'forward', + 'backward' => 'backward', + 'neutral' => 'neutral', + ], + 'choice_label' => function (string $key) use ($inputLabels) { + return $this->translatableStringHelper->localize($inputLabels[$key]); + }, + 'choice_attr' => static function (string $key) { + return [ + $key => $key, + ]; + }, + 'mapped' => false, + 'expanded' => true, + 'data' => 'forward', + ]); + } + $builder ->add('transition', ChoiceType::class, [ - 'label' => 'workflow.Transition to apply', + 'label' => 'workflow.Next step', 'mapped' => false, 'multiple' => false, 'expanded' => true, 'choices' => $choices, 'choice_label' => function (Transition $transition) use ($workflow) { - $meta = $workflow->getMetadataStore()->getTransitionMetadata($transition); + $meta = $workflow->getMetadataStore()->getTransitionMetadata($transition); - if (array_key_exists('label', $meta)) { - return $this->translatableStringHelper->localize($meta['label']); - } + if (array_key_exists('label', $meta)) { + return $this->translatableStringHelper->localize($meta['label']); + } - return $transition->getName(); - }, + return $transition->getName(); + }, 'choice_attr' => static function (Transition $transition) use ($workflow) { - $toFinal = true; + $toFinal = true; + $isForward = 'neutral'; - foreach ($transition->getTos() as $to) { - $meta = $workflow->getMetadataStore()->getPlaceMetadata($to); + $metadata = $workflow->getMetadataStore()->getTransitionMetadata($transition); - if ( + if (array_key_exists('isForward', $metadata)) { + if ($metadata['isForward']) { + $isForward = 'forward'; + } else { + $isForward = 'backward'; + } + } + + foreach ($transition->getTos() as $to) { + $meta = $workflow->getMetadataStore()->getPlaceMetadata($to); + + if ( !array_key_exists('isFinal', $meta) || false === $meta['isFinal'] ) { - $toFinal = false; - } + $toFinal = false; } + } - return [ - 'data-is-transition' => 'data-is-transition', - 'data-to-final' => $toFinal ? '1' : '0', - ]; - }, + return [ + 'data-is-transition' => 'data-is-transition', + 'data-to-final' => $toFinal ? '1' : '0', + 'data-is-forward' => $isForward, + ]; + }, ]) ->add('future_dest_users', PickUserDynamicType::class, [ 'label' => 'workflow.dest for next steps', diff --git a/src/Bundle/ChillMainBundle/Resources/public/lib/show_hide/show_hide.js b/src/Bundle/ChillMainBundle/Resources/public/lib/show_hide/show_hide.js index f2bcc9b45..25307a120 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/lib/show_hide/show_hide.js +++ b/src/Bundle/ChillMainBundle/Resources/public/lib/show_hide/show_hide.js @@ -1,19 +1,19 @@ /** * Create a control to show or hide values - * + * * Possible options are: - * + * * - froms: an Element, an Array of Element, or a NodeList. A * listener will be attached to **all** input of those elements * and will trigger the check on changes - * - test: a function which will test the element and will return true + * - test: a function which will test the element and will return true * if the content must be shown, false if it must be hidden. - * The function will receive the `froms` as first argument, and the + * The function will receive the `froms` as first argument, and the * event as second argument. - * - container: an Element, an Array of Element, or a Node List. The + * - container: an Element, an Array of Element, or a Node List. The * child nodes will be hidden / shown inside this container * - event_name: the name of the event to listen to. `'change'` by default. - * + * * @param object options */ var ShowHide = function(options) { @@ -26,8 +26,10 @@ var ShowHide = function(options) { container_content = [], debug = 'debug' in options ? options.debug : false, load_event = 'load_event' in options ? options.load_event : 'load', - id = 'uid' in options ? options.id : Math.random(); - + id = 'uid' in options ? options.id : Math.random(), + toggle_callback = 'toggle_callback' in options ? options.toggle_callback : null + ; + var bootstrap = function(event) { if (debug) { console.log('debug is activated on this show-hide', this); @@ -39,15 +41,14 @@ var ShowHide = function(options) { contents.push(el); } container_content.push(contents); - // console.log('container content', container_content); } // attach the listener on each input for (let f of froms.values()) { - let - inputs = f.querySelectorAll('input'), + let + inputs = f.querySelectorAll('input'), selects = f.querySelectorAll('select'); - + for (let input of inputs.values()) { if (debug) { console.log('attaching event to input', input); @@ -67,10 +68,10 @@ var ShowHide = function(options) { } // first launch of the show/hide - onChange(event); + onChange(event); }; - + var onChange = function (event) { var result = test(froms, event), me; @@ -89,45 +90,53 @@ var ShowHide = function(options) { } else { throw "the result of test is not a boolean"; } - + }; - + var forceHide = function() { if (debug) { console.log('force hide'); } - for (let contents of container_content.values()) { - for (let el of contents.values()) { - el.remove(); + if (toggle_callback !== null) { + toggle_callback(container, 'hide'); + } else { + for (let contents of container_content.values()) { + for (let el of contents.values()) { + el.remove(); + } } } is_shown = false; }; - + var forceShow = function() { if (debug) { console.log('show'); } - for (let i of container_content.keys()) { - var contents = container_content[i]; - for (let el of contents.values()) { - container[i].appendChild(el); + if (toggle_callback !== null) { + toggle_callback(container, 'show'); + } else { + for (let i of container_content.keys()) { + var contents = container_content[i]; + for (let el of contents.values()) { + container[i].appendChild(el); + } } } is_shown = true; }; - + var forceCompute = function(event) { onChange(event); }; - - + + if (load_event !== null) { window.addEventListener('load', bootstrap); } else { bootstrap(null); } - + return { forceHide: forceHide, forceShow: forceShow, diff --git a/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js b/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js index 2e2d4e89c..f589ee7d5 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js @@ -2,29 +2,74 @@ import {ShowHide} from 'ChillMainAssets/lib/show_hide/show_hide.js'; window.addEventListener('DOMContentLoaded', function() { let - finalizeAfterContainer = document.querySelector('#finalizeAfter'), + divTransitions = document.querySelector('#transitions'), futureDestUsersContainer = document.querySelector('#futureDestUsers') ; - if (null === finalizeAfterContainer) { - return; - } - - new ShowHide({ - load_event: null, - froms: [finalizeAfterContainer], - container: [futureDestUsersContainer], - test: function(containers, arg2, arg3) { - for (let container of containers) { - for (let input of container.querySelectorAll('input')) { - if (!input.checked) { - return true; - } else { - return false; + if (null !== divTransitions) { + new ShowHide({ + load_event: null, + froms: [divTransitions], + container: [futureDestUsersContainer], + test: function(divs, arg2, arg3) { + for (let div of divs) { + for (let input of div.querySelectorAll('input')) { + if (input.checked) { + if (input.dataset.toFinal === "1") { + return false; + } else { + return true; + } + } } } - } - }, - }) + return true; + }, + }); + } + + let + transitionFilterContainer = document.querySelector('#transitionFilter'), + transitions = document.querySelector('#transitions') + ; + + if (null !== transitionFilterContainer) { + transitions.querySelectorAll('.form-check').forEach(function(row) { + + const isForward = row.querySelector('input').dataset.isForward; + console.log(row); + console.log(isForward); + + new ShowHide({ + load_event: null, + froms: [transitionFilterContainer], + container: row, + test: function (containers) { + for (let container of containers) { + for (let input of container.querySelectorAll('input')) { + if (input.checked) { + return isForward === input.value; + } + } + } + }, + toggle_callback: function (c, dir) { + for (let div of c) { + let input = div.querySelector('input'); + if ('hide' === dir) { + input.checked = false; + input.disabled = true; + } else { + input.disabled = false; + } + } + }, + }); + }); + } + + + + }); diff --git a/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig index 4b14b39bc..e557d9e89 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig @@ -3,7 +3,60 @@ {% if transition_form is not null %} {{ form_start(transition_form) }} - {{ form_row(transition_form.transition) }} + {% set step = entity_workflow.currentStepChained %} + {% set labels = workflow_metadata(entity_workflow, 'label', step.currentStep) %} + {% set label = labels is null ? step.currentStep : labels|localize_translatable_string %} + +
    +
    +
    +
    + {{ 'workflow.Current step'|trans }} : + {{ label }} +
    +
    + + {% if step.previous is not null %} + {% if step.previous.comment is not empty %} +
    +
    +
    + {{ step.previous.comment|chill_markdown_to_html }} +
    +
    +
    + {% endif %} +
    +
    + {{ 'By'|trans }} + {{ step.previous.transitionBy|chill_entity_render_box }}, + {{ step.previous.transitionAt|format_datetime('short', 'short') }} +
    +
    + {% else %} +
    +
    {{ 'workflow.Created by'|trans }}
    +
    {{ step.entityWorkflow.createdBy|chill_entity_render_box }}
    +
    +
    +
    {{ 'Le'|trans }}
    +
    {{ step.entityWorkflow.createdAt|format_datetime('short', 'short') }}
    +
    + {% endif %} +
    +
    + + + +
    + {% if transition_form.transitionFilter is defined %} + {{ form_row(transition_form.transitionFilter) }} + {% endif %} +
    + +
    + {{ form_row(transition_form.transition) }} +
    {% if transition_form.freezeAfter is defined %} {{ form_row(transition_form.freezeAfter) }} diff --git a/src/Bundle/ChillMainBundle/Resources/views/Workflow/_history.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_history.html.twig index cee9d219c..e40e82dab 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Workflow/_history.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_history.html.twig @@ -69,6 +69,18 @@ {% endif %} + {% if loop.last and step.destUser|length > 0 %} +
    +
    +

    {{ 'workflow.Users allowed to apply transition'|trans }} :

    +
      + {% for u in step.destUser %} +
    • {{ u|chill_entity_render_box }}
    • + {% endfor %} +
    +
    +
    + {% endif %} {% endfor %} diff --git a/src/Bundle/ChillMainBundle/translations/messages.fr.yml b/src/Bundle/ChillMainBundle/translations/messages.fr.yml index 605cafe8e..d3173bd7c 100644 --- a/src/Bundle/ChillMainBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillMainBundle/translations/messages.fr.yml @@ -370,7 +370,8 @@ Workflow history: Historique de la décision workflow: Created by: Créé par - Transition to apply: Ma décision + My decision: Ma décision + Next step: Prochaine étape dest for next steps: Utilisateurs qui valideront la prochaine étape Freeze: Geler Freezed: Gelé @@ -392,6 +393,9 @@ workflow: dest: Workflows en attente d'action you subscribed to all steps: Vous recevrez une notification à chaque étape you subscribed to final step: Vous recevrez une notification à l'étape finale + Current step: Étape actuelle + Comment on last change: Commentaire à la transition précédente + Users allowed to apply transition: Utilisateurs pouvant valider cette étape Subscribe final: Recevoir une notification à l'étape finale Subscribe all steps: Recevoir une notification à chaque étape diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index d71ac2b9f..07fb859b7 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -213,7 +213,7 @@ class AccompanyingPeriod implements * * @ORM\Column(type="date") * @Groups({"read", "write", "docgen:read"}) - * @Assert\LessThan(value= "today", groups={AccompanyingPeriod::STEP_CONFIRMED}) + * @Assert\LessThan(value="today", groups={AccompanyingPeriod::STEP_CONFIRMED}) * @Assert\LessThan(propertyPath="closingDate", groups={AccompanyingPeriod::STEP_CONFIRMED}) */ private ?DateTime $openingDate = null; diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php index 3f0c30e47..10b424cef 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriodRepository.php @@ -28,6 +28,11 @@ final class AccompanyingPeriodRepository implements ObjectRepository $this->repository = $entityManager->getRepository(AccompanyingPeriod::class); } + public function countBy(array $criteria): int + { + return $this->repository->count($criteria); + } + public function countByRecentUserHistory(User $user, DateTimeImmutable $since): int { $qb = $this->buildQueryByRecentUserHistory($user, $since); @@ -35,11 +40,6 @@ final class AccompanyingPeriodRepository implements ObjectRepository return $qb->select('count(a)')->getQuery()->getSingleScalarResult(); } - public function countBy(array $criteria): int - { - return $this->repository->count($criteria); - } - public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder { return $this->repository->createQueryBuilder($alias, $indexBy); From de1dddbb85b47da8eb8b0b6ec1a81658164e120a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 1 Feb 2022 12:19:22 +0100 Subject: [PATCH 19/23] validation: no more workflow without dest --- .../Controller/WorkflowController.php | 15 +++++- .../public/page/workflow-show/index.js | 19 ++++++- .../views/Workflow/_decision.html.twig | 2 - .../Workflow/Validator/StepDestValid.php | 26 ++++++++++ .../Validator/StepDestValidValidator.php | 49 +++++++++++++++++++ 5 files changed, 105 insertions(+), 6 deletions(-) create mode 100644 src/Bundle/ChillMainBundle/Workflow/Validator/StepDestValid.php create mode 100644 src/Bundle/ChillMainBundle/Workflow/Validator/StepDestValidValidator.php diff --git a/src/Bundle/ChillMainBundle/Controller/WorkflowController.php b/src/Bundle/ChillMainBundle/Controller/WorkflowController.php index 33f1bd774..247cdf552 100644 --- a/src/Bundle/ChillMainBundle/Controller/WorkflowController.php +++ b/src/Bundle/ChillMainBundle/Controller/WorkflowController.php @@ -19,6 +19,7 @@ use Chill\MainBundle\Pagination\PaginatorFactory; use Chill\MainBundle\Repository\Workflow\EntityWorkflowRepository; use Chill\MainBundle\Security\Authorization\EntityWorkflowVoter; use Chill\MainBundle\Workflow\EntityWorkflowManager; +use Chill\MainBundle\Workflow\Validator\StepDestValid; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; @@ -201,9 +202,18 @@ class WorkflowController extends AbstractController $entityWorkflow->getCurrentStep()->addDestUser($user); } - $this->entityManager->flush(); + $errors = $this->validator->validate( + $entityWorkflow->getCurrentStep(), + new StepDestValid() + ); - return $this->redirectToRoute('chill_main_workflow_show', ['id' => $entityWorkflow->getId()]); + if (count($errors) === 0) { + $this->entityManager->flush(); + + return $this->redirectToRoute('chill_main_workflow_show', ['id' => $entityWorkflow->getId()]); + } + + return new Response((string) $errors, Response::HTTP_UNPROCESSABLE_ENTITY); } if ($transitionForm->isSubmitted() && !$transitionForm->isValid()) { @@ -235,6 +245,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 ?? [], //'comment_form' => $commentForm->createView(), ] ); diff --git a/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js b/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js index f589ee7d5..bd05a8aaa 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js @@ -38,8 +38,6 @@ window.addEventListener('DOMContentLoaded', function() { transitions.querySelectorAll('.form-check').forEach(function(row) { const isForward = row.querySelector('input').dataset.isForward; - console.log(row); - console.log(isForward); new ShowHide({ load_event: null, @@ -69,7 +67,24 @@ window.addEventListener('DOMContentLoaded', function() { }); } + // validate form + let form = document.querySelector('form[name="workflow_step"]'); + if (form === null) { + console.error('form to validate not found'); + } + form.addEventListener('submit', function (event) { + const datas = new FormData(event.target); + + if (datas.has('workflow_step[future_dest_users]')) { + const dests = JSON.parse(datas.get('workflow_step[future_dest_users]')); + if (dests === null || (dests instanceof Array && dests.length === 0)) { + event.preventDefault(); + console.log('no users!'); + window.alert('Indiquez un utilisateur pour traiter la prochaine étape.'); + } + } + }); }); diff --git a/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig index e557d9e89..64482c067 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig @@ -46,8 +46,6 @@ - -
    {% if transition_form.transitionFilter is defined %} {{ form_row(transition_form.transitionFilter) }} diff --git a/src/Bundle/ChillMainBundle/Workflow/Validator/StepDestValid.php b/src/Bundle/ChillMainBundle/Workflow/Validator/StepDestValid.php new file mode 100644 index 000000000..7c2d954b2 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Workflow/Validator/StepDestValid.php @@ -0,0 +1,26 @@ +isFinal() && 0 < count($value->getDestUser())) { + $this->context->buildViolation($constraint->messageDestNotAllowed) + ->addViolation(); + } + + if (!$value->isFinal() && 0 === count($value->getDestUser())) { + $this->context->buildViolation($constraint->messageRequireDest) + ->addViolation(); + } + } +} From 5d2cb8c712b9b402565d896f524c2c1df4770cac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 1 Feb 2022 14:14:55 +0100 Subject: [PATCH 20/23] homepage: add social action in evaluation serialisation --- .../Normalizer/NotificationNormalizer.php | 1 - ...nyingPeriodWorkEvaluationApiController.php | 4 ++-- .../AccompanyingPeriodWork.php | 21 ++++++++++--------- .../AccompanyingPeriodWorkEvaluation.php | 2 ++ ...mpanyingPeriodWorkEvaluationNormalizer.php | 1 + .../AccompanyingPeriodConfidentialTest.php | 1 - 6 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php index 08deac745..4c09aaa55 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php @@ -44,7 +44,6 @@ class NotificationNormalizer implements NormalizerAwareInterface, NormalizerInte */ public function normalize($object, ?string $format = null, array $context = []) { - dump($object); $entity = $this->entityManager ->getRepository($object->getRelatedEntityClass()) ->find($object->getRelatedEntityId()); diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php index 1bb4bc1fe..757e8df79 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php @@ -99,7 +99,7 @@ class AccompanyingPeriodWorkEvaluationApiController if ($request->query->getBoolean('countOnly', false)) { return new JsonResponse( - $this->serializer->serialize(new Counter($total), 'json', ['groups' => 'read']), + $this->serializer->serialize(new Counter($total), 'json', ['groups' => ['read']]), JsonResponse::HTTP_OK, [], true @@ -117,7 +117,7 @@ class AccompanyingPeriodWorkEvaluationApiController $collection = new Collection($works, $paginator); return new JsonResponse( - $this->serializer->serialize($collection, 'json', ['groups' => 'read']), + $this->serializer->serialize($collection, 'json', ['groups' => ['read', 'read:evaluation:include-work']]), JsonResponse::HTTP_OK, [], true diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php index 97424c2e3..9a80fde3d 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php @@ -44,7 +44,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues { /** * @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class) - * @Serializer\Groups({"read"}) + * @Serializer\Groups({"read","read:accompanyingPeriodWork:light"}) */ private ?AccompanyingPeriod $accompanyingPeriod = null; @@ -63,26 +63,26 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues /** * @ORM\Column(type="datetime_immutable") - * @Serializer\Groups({"read", "docgen:read"}) + * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) */ private ?DateTimeImmutable $createdAt = null; /** * @ORM\Column(type="boolean") - * @Serializer\Groups({"read", "docgen:read"}) + * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) */ private bool $createdAutomatically = false; /** * @ORM\Column(type="text") - * @Serializer\Groups({"read", "docgen:read"}) + * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) */ private string $createdAutomaticallyReason = ''; /** * @ORM\ManyToOne(targetEntity=User::class) * @ORM\JoinColumn(nullable=false) - * @Serializer\Groups({"read", "docgen:read"}) + * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) */ private ?User $createdBy = null; @@ -90,7 +90,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues * @ORM\Column(type="date_immutable", nullable=true, options={"default": null}) * @Serializer\Groups({"accompanying_period_work:create"}) * @Serializer\Groups({"accompanying_period_work:edit"}) - * @Serializer\Groups({"read", "docgen:read"}) + * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) * @Assert\GreaterThan(propertyPath="startDate", * message="accompanying_course_work.The endDate should be greater than the start date" * ) @@ -122,7 +122,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") - * @Serializer\Groups({"read", "docgen:read"}) + * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light", "read:evaluation:include-work"}) */ private ?int $id = null; @@ -135,7 +135,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues /** * @ORM\ManyToMany(targetEntity=Person::class) * @ORM\JoinTable(name="chill_person_accompanying_period_work_person") - * @Serializer\Groups({"read", "docgen:read"}) + * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) * @Serializer\Groups({"accompanying_period_work:edit"}) * @Serializer\Groups({"accompanying_period_work:create"}) */ @@ -151,8 +151,9 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues /** * @ORM\ManyToOne(targetEntity=SocialAction::class) - * @Serializer\Groups({"read", "docgen:read"}) + * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) * @Serializer\Groups({"accompanying_period_work:create"}) + * @Serializer\Context(normalizationContext={"groups"={"read"}}, groups={"read:accompanyingPeriodWork:light"}) */ private ?SocialAction $socialAction = null; @@ -160,7 +161,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues * @ORM\Column(type="date_immutable") * @Serializer\Groups({"accompanying_period_work:create"}) * @Serializer\Groups({"accompanying_period_work:edit"}) - * @Serializer\Groups({"read", "docgen:read"}) + * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) */ private ?DateTimeImmutable $startDate = null; diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php index f9fbc95f9..483495ebd 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php @@ -39,6 +39,8 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU * targetEntity=AccompanyingPeriodWork::class, * inversedBy="accompanyingPeriodWorkEvaluations" * ) + * @Serializer\Groups({"read:evaluation:include-work"}) + * @Serializer\Context(normalizationContext={"groups"={"read:accompanyingPeriodWork:light"}}, groups={"read:evaluation:include-work"}) */ private ?AccompanyingPeriodWork $accompanyingPeriodWork = null; diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php index 1e4649dd7..a5156a78a 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php @@ -44,6 +44,7 @@ class AccompanyingPeriodWorkEvaluationNormalizer implements ContextAwareNormaliz */ public function normalize($object, ?string $format = null, array $context = []): array { + dump($context); $initial = $this->normalizer->normalize($object, $format, array_merge( $context, [self::IGNORE_EVALUATION => spl_object_hash($object)] diff --git a/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/AccompanyingPeriodConfidentialTest.php b/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/AccompanyingPeriodConfidentialTest.php index b20df016a..2dc51335c 100644 --- a/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/AccompanyingPeriodConfidentialTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/AccompanyingPeriodConfidentialTest.php @@ -109,7 +109,6 @@ final class AccompanyingPeriodConfidentialTest extends WebTestCase $user = new stdClass(); $user->id = 0; $user->type = 'user'; - dump($user); $this->client->request( Request::METHOD_PATCH, From c6373a075d327985170f76550568b33384b463cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 1 Feb 2022 15:49:23 +0100 Subject: [PATCH 21/23] refactor pickTemplate and adapt existing usage --- .../Controller/ActivityController.php | 19 ++++- .../Resources/public/vuejs/Activity/index.js | 58 +++++++++++++++ .../Resources/views/Activity/edit.html.twig | 2 +- .../Resources/views/Activity/new.html.twig | 1 + .../Activity/newAccompanyingCourse.html.twig | 6 +- .../views/Activity/newPerson.html.twig | 2 + .../public/lib/document-generator.js | 13 ++++ .../public/vuejs/_components/PickTemplate.vue | 74 ++++++------------- .../components/FormEvaluation.vue | 11 ++- 9 files changed, 126 insertions(+), 60 deletions(-) create mode 100644 src/Bundle/ChillDocGeneratorBundle/Resources/public/lib/document-generator.js diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index 3e32edfce..d8f69035d 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -34,6 +34,7 @@ use Psr\Log\LoggerInterface; use RuntimeException; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\Request; @@ -393,9 +394,25 @@ final class ActivityController extends AbstractController 'role' => new Role('CHILL_ACTIVITY_CREATE'), 'activityType' => $entity->getActivityType(), 'accompanyingPeriod' => $accompanyingPeriod, - ])->handleRequest($request); + ]); + + if ($form->has('documents')) { + $form->add('gendocTemplateId', HiddenType::class, [ + 'mapped' => false, + 'data' => null, + 'attr' => [ + // required for js + 'data-template-id' => 'data-template-id', + ], + ]); + } + + $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { + if ($form->has('gendocTemplateId')) { + dd($form->get('gendocTemplateId')->getData()); + } $this->entityManager->persist($entity); $this->entityManager->flush(); diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/index.js b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/index.js index b7a5c791b..7bd6ae03d 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/index.js +++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/index.js @@ -2,11 +2,15 @@ import { createApp } from 'vue'; import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n' import { activityMessages } from './i18n' import store from './store' +import PickTemplate from 'ChillDocGeneratorAssets/vuejs/_components/PickTemplate.vue'; +import {fetchTemplates} from 'ChillDocGeneratorAssets/api/pickTemplate.js'; import App from './App.vue'; const i18n = _createI18n(activityMessages); +// app for activity + const hasSocialIssues = document.querySelector('#social-issues-acc') !== null; const hasLocation = document.querySelector('#location') !== null; const hasPerson = document.querySelector('#add-persons') !== null; @@ -29,3 +33,57 @@ const app = createApp({ .use(i18n) .component('app', App) .mount('#activity'); + + +// app for picking template + +const i18nGendoc = _createI18n({}); + +document.querySelectorAll('div[data-docgen-template-picker]').forEach(el => { + fetchTemplates(el.dataset.entityClass).then(templates => { + let + picker = { + template: '', + components: { + PickTemplate, + }, + data() { + return { + templates: templates, + entityId: el.dataset.entityId, + } + }, + methods: { + generateDoc({event, link, template}) { + console.log('generateDoc'); + console.log('link', link); + console.log('template', template); + + event.preventDefault(); + let hiddenInput = document.querySelector("input[data-template-id]"); + + if (hiddenInput === null) { + console.error('hidden input not found'); + return; + } + + hiddenInput.value = template; + + let form = document.querySelect('form[name="chill_activitybundle_activity"'); + + if (form === null) { + console.error('form not found'); + return; + } + + console.log('subbmitting formt'); + + form.submit(); + } + } + } + ; + createApp(picker).use(i18nGendoc).mount(el); + }) + +}); diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig index a59c596c3..3da97efd6 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/edit.html.twig @@ -89,9 +89,9 @@ {%- if edit_form.documents is defined -%} {{ form_row(edit_form.documents) }} +
    {% endif %} -
    {% set person_id = null %} {% if entity.person %} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig index a0668119c..755e2e151 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/new.html.twig @@ -87,6 +87,7 @@ {%- if form.documents is defined -%} {{ form_row(form.documents) }} +
    {% endif %} {%- if form.attendee is defined -%} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig index 505d8c6cb..e491a34d5 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig @@ -17,18 +17,16 @@ {{ parent() }} {{ encore_entry_script_tags('mod_async_upload') }} {{ encore_entry_script_tags('vue_activity') }} + {{ encore_entry_script_tags('mod_docgen_picktemplate') }} {% endblock %} {% block css %} {{ parent() }} {{ encore_entry_link_tags('mod_async_upload') }} {{ encore_entry_link_tags('vue_activity') }} + {{ encore_entry_link_tags('mod_docgen_picktemplate') }} {% endblock %} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/newPerson.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/newPerson.html.twig index 962aee806..712b996bd 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/newPerson.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/newPerson.html.twig @@ -23,9 +23,11 @@ window.activity = {{ activity_json|json_encode|raw }}; {{ encore_entry_script_tags('vue_activity') }} + {{ encore_entry_script_tags('mod_docgen_picktemplate') }} {% endblock %} {% block css %} {{ encore_entry_link_tags('mod_async_upload') }} {{ encore_entry_link_tags('vue_activity') }} + {{ encore_entry_link_tags('mod_docgen_picktemplate') }} {% endblock %} diff --git a/src/Bundle/ChillDocGeneratorBundle/Resources/public/lib/document-generator.js b/src/Bundle/ChillDocGeneratorBundle/Resources/public/lib/document-generator.js new file mode 100644 index 000000000..beea190a3 --- /dev/null +++ b/src/Bundle/ChillDocGeneratorBundle/Resources/public/lib/document-generator.js @@ -0,0 +1,13 @@ + +const buildLink = function(templateId, entityId, entityClass) { + const + entityIdEncoded = encodeURI(entityId), + returnPath = encodeURIComponent(window.location.pathname + window.location.search + window.location.hash), + entityClassEncoded = encodeURI(entityClass), + url = `/fr/doc/gen/generate/from/${templateId}/for/${entityClassEncoded}/${entityIdEncoded}?returnPath=${returnPath}` + ; + console.log('computed Url'); + return url; +}; + +export {buildLink}; diff --git a/src/Bundle/ChillDocGeneratorBundle/Resources/public/vuejs/_components/PickTemplate.vue b/src/Bundle/ChillDocGeneratorBundle/Resources/public/vuejs/_components/PickTemplate.vue index 04d563782..cd5121fc9 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Resources/public/vuejs/_components/PickTemplate.vue +++ b/src/Bundle/ChillDocGeneratorBundle/Resources/public/vuejs/_components/PickTemplate.vue @@ -20,8 +20,8 @@ - - + +
    @@ -39,24 +39,27 @@ {{ encore_entry_script_tags('vue_activity') }} - {{ encore_entry_script_tags('mod_docgen_picktemplate') }} {% endblock %} {% block css %} {{ parent() }} {{ encore_entry_link_tags('mod_async_upload') }} {{ encore_entry_link_tags('vue_activity') }} - {{ encore_entry_link_tags('mod_docgen_picktemplate') }} {% endblock %} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/editPerson.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/editPerson.html.twig index 72c74c68e..82c7403c6 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/editPerson.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/editPerson.html.twig @@ -39,11 +39,9 @@ window.activity = {{ activity_json|json_encode|raw }}; {{ encore_entry_script_tags('vue_activity') }} - {{ encore_entry_script_tags('mod_docgen_picktemplate') }} {% endblock %} {% block css %} {{ encore_entry_link_tags('mod_async_upload') }} {{ encore_entry_link_tags('vue_activity') }} - {{ encore_entry_link_tags('mod_docgen_picktemplate') }} {% endblock %} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig index e491a34d5..47a61bd86 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig @@ -21,12 +21,10 @@ {% if default_location is not null %}window.default_location_id = {{ default_location.id }}{% endif %}; {{ encore_entry_script_tags('vue_activity') }} - {{ encore_entry_script_tags('mod_docgen_picktemplate') }} {% endblock %} {% block css %} {{ parent() }} {{ encore_entry_link_tags('mod_async_upload') }} {{ encore_entry_link_tags('vue_activity') }} - {{ encore_entry_link_tags('mod_docgen_picktemplate') }} {% endblock %} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/newPerson.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/newPerson.html.twig index 712b996bd..962aee806 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/newPerson.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/newPerson.html.twig @@ -23,11 +23,9 @@ window.activity = {{ activity_json|json_encode|raw }}; {{ encore_entry_script_tags('vue_activity') }} - {{ encore_entry_script_tags('mod_docgen_picktemplate') }} {% endblock %} {% block css %} {{ encore_entry_link_tags('mod_async_upload') }} {{ encore_entry_link_tags('vue_activity') }} - {{ encore_entry_link_tags('mod_docgen_picktemplate') }} {% endblock %} diff --git a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php index 9a8e6b3b8..5c4f7f501 100644 --- a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php +++ b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php @@ -210,11 +210,8 @@ class ActivityContext implements */ public function storeGenerated(DocGeneratorTemplate $template, StoredObject $storedObject, object $entity, array $contextGenerationData): void { - $doc = new StoredObject(); - // TODO push document to remote + $entity->addDocument($storedObject); - $this->em->persist($doc); - - $entity->addDocument($doc); + $this->em->persist($storedObject); } } diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php index 9a80fde3d..6cf029ed1 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php @@ -45,6 +45,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues /** * @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class) * @Serializer\Groups({"read","read:accompanyingPeriodWork:light"}) + * @Serializer\Context(normalizationContext={"groups"={"read"}}, groups={"read:accompanyingPeriodWork:light"}) */ private ?AccompanyingPeriod $accompanyingPeriod = null; From fcff4bf863d2c6e872d5ed4bcccc19d35373c6de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 1 Feb 2022 18:01:34 +0100 Subject: [PATCH 23/23] fix phpcs --- .../Service/DocGenerator/ActivityContext.php | 1 - .../Entity/AccompanyingPeriod/AccompanyingPeriodWork.php | 6 +++--- .../AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php index 5c4f7f501..7ee09690a 100644 --- a/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php +++ b/src/Bundle/ChillActivityBundle/Service/DocGenerator/ActivityContext.php @@ -17,7 +17,6 @@ use Chill\DocGeneratorBundle\Context\DocGeneratorContextWithPublicFormInterface; use Chill\DocGeneratorBundle\Context\Exception\UnexpectedTypeException; use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate; use Chill\DocGeneratorBundle\Service\Context\BaseContextData; -use Chill\DocStoreBundle\Entity\Document; use Chill\DocStoreBundle\Entity\StoredObject; use Chill\DocStoreBundle\Repository\DocumentCategoryRepository; use Chill\MainBundle\Templating\TranslatableStringHelperInterface; diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php index 6cf029ed1..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; @@ -154,7 +154,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues * @ORM\ManyToOne(targetEntity=SocialAction::class) * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) * @Serializer\Groups({"accompanying_period_work:create"}) - * @Serializer\Context(normalizationContext={"groups"={"read"}}, groups={"read:accompanyingPeriodWork:light"}) + * @Serializer\Context(normalizationContext={"groups": {"read"}}, groups={"read:accompanyingPeriodWork:light"}) */ private ?SocialAction $socialAction = null; diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php index 483495ebd..68f508b95 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php @@ -40,7 +40,7 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU * inversedBy="accompanyingPeriodWorkEvaluations" * ) * @Serializer\Groups({"read:evaluation:include-work"}) - * @Serializer\Context(normalizationContext={"groups"={"read:accompanyingPeriodWork:light"}}, groups={"read:evaluation:include-work"}) + * @Serializer\Context(normalizationContext={"groups": {"read:accompanyingPeriodWork:light"}}, groups={"read:evaluation:include-work"}) */ private ?AccompanyingPeriodWork $accompanyingPeriodWork = null;