From e82c7cdc6c174c6873775a43d20446668af3eb43 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 12 Jul 2023 13:24:23 +0200 Subject: [PATCH 1/6] Fixed: [homepage widget] repair my unread notification list with actions and evaluations documents --- .../public/vuejs/HomepageWidget/MyNotifications.vue | 8 ++++++++ .../Resources/public/vuejs/HomepageWidget/js/i18n.js | 1 + 2 files changed, 9 insertions(+) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyNotifications.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyNotifications.vue index 06683f8fc..bfde741ac 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyNotifications.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyNotifications.vue @@ -66,6 +66,10 @@ export default { return appMessages.fr.the_activity; case 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod': return appMessages.fr.the_course; + case 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWork': + return appMessages.fr.the_action; + case 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluationDocument': + return appMessages.fr.the_evaluation_document; case 'Chill\\MainBundle\\Entity\\Workflow\\EntityWorkflow': return appMessages.fr.the_workflow; default: @@ -78,6 +82,10 @@ export default { return `/fr/activity/${n.relatedEntityId}/show` case 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod': return `/fr/parcours/${n.relatedEntityId}` + case 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWork': + return `/fr/person/accompanying-period/work/${n.relatedEntityId}/show` + case 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluationDocument': + return `/fr/notification/${n.id}/show` // to the notification case 'Chill\\MainBundle\\Entity\\Workflow\\EntityWorkflow': return `/fr/main/workflow/${n.relatedEntityId}/show` default: diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/i18n.js b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/i18n.js index 697074671..587f06fa9 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/i18n.js +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/i18n.js @@ -46,6 +46,7 @@ const appMessages = { the_course: "le parcours", the_action: "l'action", the_evaluation: "l'évaluation", + the_evaluation_document: "le document de l'évaluation", the_task: "la tâche", the_workflow: "le workflow", StartDate: "Date d'ouverture", From 51e382760d22b530f5512d7679076208f26c5292 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 13 Jul 2023 10:05:57 +0200 Subject: [PATCH 2/6] add changie --- .changes/unreleased/Fixed-20230713-100525.yaml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changes/unreleased/Fixed-20230713-100525.yaml diff --git a/.changes/unreleased/Fixed-20230713-100525.yaml b/.changes/unreleased/Fixed-20230713-100525.yaml new file mode 100644 index 000000000..e67373d59 --- /dev/null +++ b/.changes/unreleased/Fixed-20230713-100525.yaml @@ -0,0 +1,5 @@ +kind: Fixed +body: Repair my unread notification list with actions and evaluations documents +time: 2023-07-13T10:05:25.724155083+02:00 +custom: + Issue: "117" From 22ded77bde1636ced7128d60d239980d9e8ba883 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 13 Jul 2023 12:49:01 +0200 Subject: [PATCH 3/6] Create new route to redirect from document to work that contains evaluation that contains document --- .../vuejs/HomepageWidget/MyNotifications.vue | 2 +- .../public/vuejs/HomepageWidget/js/i18n.js | 2 +- ...CourseWorkEvaluationDocumentController.php | 55 +++++++++++++++++++ 3 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkEvaluationDocumentController.php diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyNotifications.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyNotifications.vue index bfde741ac..1a95c8743 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyNotifications.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyNotifications.vue @@ -85,7 +85,7 @@ export default { case 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWork': return `/fr/person/accompanying-period/work/${n.relatedEntityId}/show` case 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluationDocument': - return `/fr/notification/${n.id}/show` // to the notification + return `/fr/person/accompanying-period/work/evaluation/document/${n.relatedEntityId}/show` // to the notification case 'Chill\\MainBundle\\Entity\\Workflow\\EntityWorkflow': return `/fr/main/workflow/${n.relatedEntityId}/show` default: diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/i18n.js b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/i18n.js index 587f06fa9..c4c97e5c6 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/i18n.js +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/i18n.js @@ -46,7 +46,7 @@ const appMessages = { the_course: "le parcours", the_action: "l'action", the_evaluation: "l'évaluation", - the_evaluation_document: "le document de l'évaluation", + the_evaluation_document: "le document", the_task: "la tâche", the_workflow: "le workflow", StartDate: "Date d'ouverture", diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkEvaluationDocumentController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkEvaluationDocumentController.php new file mode 100644 index 000000000..9d5dd1fbc --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkEvaluationDocumentController.php @@ -0,0 +1,55 @@ +security = $security; + } + + /** + * @Route( + * "{_locale}/person/accompanying-period/work/evaluation/document/{id}/show", + * name="chill_person_accompanying_period_work_evaluation_document_show", + * methods={"GET"} + * ) + */ + public function showAccompanyingCourseWork(AccompanyingPeriodWorkEvaluationDocument $document): Response + { + $em = $this->getDoctrine()->getManager(); + + /** @var AccompanyingPeriodWorkEvaluation $evaluation */ + $evaluation = $em->getRepository(AccompanyingPeriodWorkEvaluation::class)->find($document->getAccompanyingPeriodWorkEvaluation()); + + /** @var AccompanyingPeriodWork $work */ + $work = $em->getRepository(AccompanyingPeriodWork::class)->find($evaluation->getAccompanyingPeriodWork()); + + return $this->redirectToRoute( + $this->security->isGranted(AccompanyingPeriodWorkVoter::UPDATE)? + 'chill_person_accompanying_period_work_edit' : 'chill_person_accompanying_period_work_show', [ + 'id' => $work->getId() + ]); + } +} \ No newline at end of file From 1d9b8729ab38461d0dfd7da15d5d6d0885362997 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 13 Jul 2023 12:50:15 +0200 Subject: [PATCH 4/6] oups --- .../Resources/public/vuejs/HomepageWidget/MyNotifications.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyNotifications.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyNotifications.vue index 1a95c8743..b7cf2bcf0 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyNotifications.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyNotifications.vue @@ -85,7 +85,7 @@ export default { case 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWork': return `/fr/person/accompanying-period/work/${n.relatedEntityId}/show` case 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluationDocument': - return `/fr/person/accompanying-period/work/evaluation/document/${n.relatedEntityId}/show` // to the notification + return `/fr/person/accompanying-period/work/evaluation/document/${n.relatedEntityId}/show` case 'Chill\\MainBundle\\Entity\\Workflow\\EntityWorkflow': return `/fr/main/workflow/${n.relatedEntityId}/show` default: From 59da93fd7504d12cb50077e46dd7464e9261d5bc Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 13 Jul 2023 14:07:01 +0200 Subject: [PATCH 5/6] corrections --- ...CourseWorkEvaluationDocumentController.php | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkEvaluationDocumentController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkEvaluationDocumentController.php index 9d5dd1fbc..88bc4e6b8 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkEvaluationDocumentController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkEvaluationDocumentController.php @@ -11,8 +11,6 @@ declare(strict_types=1); namespace Chill\PersonBundle\Controller; -use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork; -use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluation; use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluationDocument; use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodWorkVoter; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -22,12 +20,7 @@ use Symfony\Component\Security\Core\Security; class AccompanyingCourseWorkEvaluationDocumentController extends AbstractController { - private Security $security; - - public function __construct(Security $security) - { - $this->security = $security; - } + public function __construct(Private Security $security) {} /** * @Route( @@ -38,16 +31,10 @@ class AccompanyingCourseWorkEvaluationDocumentController extends AbstractControl */ public function showAccompanyingCourseWork(AccompanyingPeriodWorkEvaluationDocument $document): Response { - $em = $this->getDoctrine()->getManager(); - - /** @var AccompanyingPeriodWorkEvaluation $evaluation */ - $evaluation = $em->getRepository(AccompanyingPeriodWorkEvaluation::class)->find($document->getAccompanyingPeriodWorkEvaluation()); - - /** @var AccompanyingPeriodWork $work */ - $work = $em->getRepository(AccompanyingPeriodWork::class)->find($evaluation->getAccompanyingPeriodWork()); + $work = $document->getAccompanyingPeriodWorkEvaluation()->getAccompanyingPeriodWork(); return $this->redirectToRoute( - $this->security->isGranted(AccompanyingPeriodWorkVoter::UPDATE)? + $this->security->isGranted(AccompanyingPeriodWorkVoter::UPDATE, $work) ? 'chill_person_accompanying_period_work_edit' : 'chill_person_accompanying_period_work_show', [ 'id' => $work->getId() ]); From 1cc61cee364eb16f098526942cdc175b7117ed2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 14 Jul 2023 09:44:05 +0200 Subject: [PATCH 6/6] Fixed: fix CS + fix "my workflow" api when course or work has been delete --- .../AccompanyingCourseDocumentWorkflowHandler.php | 3 +-- ...nyingCourseWorkEvaluationDocumentController.php | 14 +++++++++----- .../AccompanyingPeriodWorkWorkflowHandler.php | 3 +-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php b/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php index c3285507e..546234a31 100644 --- a/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php +++ b/src/Bundle/ChillDocStoreBundle/Workflow/AccompanyingCourseDocumentWorkflowHandler.php @@ -46,8 +46,7 @@ class AccompanyingCourseDocumentWorkflowHandler implements EntityWorkflowHandler public function getEntityData(EntityWorkflow $entityWorkflow, array $options = []): array { - $course = $this->getRelatedEntity($entityWorkflow) - ->getCourse(); + $course = $this->getRelatedEntity($entityWorkflow)?->getCourse(); $persons = []; if (null !== $course) { diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkEvaluationDocumentController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkEvaluationDocumentController.php index 88bc4e6b8..b9daf5a09 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkEvaluationDocumentController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseWorkEvaluationDocumentController.php @@ -20,7 +20,9 @@ use Symfony\Component\Security\Core\Security; class AccompanyingCourseWorkEvaluationDocumentController extends AbstractController { - public function __construct(Private Security $security) {} + public function __construct(private Security $security) + { + } /** * @Route( @@ -35,8 +37,10 @@ class AccompanyingCourseWorkEvaluationDocumentController extends AbstractControl return $this->redirectToRoute( $this->security->isGranted(AccompanyingPeriodWorkVoter::UPDATE, $work) ? - 'chill_person_accompanying_period_work_edit' : 'chill_person_accompanying_period_work_show', [ - 'id' => $work->getId() - ]); + 'chill_person_accompanying_period_work_edit' : 'chill_person_accompanying_period_work_show', + [ + 'id' => $work->getId() + ] + ); } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkWorkflowHandler.php b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkWorkflowHandler.php index 3cdf23f88..528c2b7aa 100644 --- a/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkWorkflowHandler.php +++ b/src/Bundle/ChillPersonBundle/Workflow/AccompanyingPeriodWorkWorkflowHandler.php @@ -47,8 +47,7 @@ class AccompanyingPeriodWorkWorkflowHandler implements EntityWorkflowHandlerInte public function getEntityData(EntityWorkflow $entityWorkflow, array $options = []): array { return [ - 'persons' => $this->getRelatedEntity($entityWorkflow) - ->getPersons(), + 'persons' => $this->getRelatedEntity($entityWorkflow)?->getPersons() ?? [], ]; }