From bf2181c2f1ebeed3ff079fe966c87b5b8bb88cfa Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 13 Aug 2025 17:01:24 +0200 Subject: [PATCH] allow changing evaluation for a document - Remove restriction on changing evaluation in entity logic --- ...odWorkEvaluationDocumentMoveController.php | 1 - ...companyingPeriodWorkEvaluationDocument.php | 16 ++++++------- .../components/DocumentsList.vue | 23 +++++++++++-------- .../translations/messages.fr.yml | 1 + 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationDocumentMoveController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationDocumentMoveController.php index 124ad0463..cc02b20ca 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationDocumentMoveController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationDocumentMoveController.php @@ -46,7 +46,6 @@ readonly class AccompanyingPeriodWorkEvaluationDocumentMoveController throw new AccessDeniedHttpException('not allowed to edit this accompanying period work'); } - // Simply set the new evaluation - Doctrine will handle the collection updates $document->setAccompanyingPeriodWorkEvaluation($evaluation); $this->entityManager->persist($document); diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocument.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocument.php index 01c3ed69d..63221ec32 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocument.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluationDocument.php @@ -100,14 +100,14 @@ class AccompanyingPeriodWorkEvaluationDocument implements \Chill\MainBundle\Doct { // if an evaluation is already associated, we cannot change the association (removing the association, // by setting a null value, is allowed. - if ( - $this->accompanyingPeriodWorkEvaluation instanceof AccompanyingPeriodWorkEvaluation - && $accompanyingPeriodWorkEvaluation instanceof AccompanyingPeriodWorkEvaluation - ) { - if ($this->accompanyingPeriodWorkEvaluation !== $accompanyingPeriodWorkEvaluation) { - throw new \RuntimeException('It is not allowed to change the evaluation for a document'); - } - } +// if ( +// $this->accompanyingPeriodWorkEvaluation instanceof AccompanyingPeriodWorkEvaluation +// && $accompanyingPeriodWorkEvaluation instanceof AccompanyingPeriodWorkEvaluation +// ) { +// if ($this->accompanyingPeriodWorkEvaluation !== $accompanyingPeriodWorkEvaluation) { +// throw new \RuntimeException('It is not allowed to change the evaluation for a document'); +// } +// } $this->accompanyingPeriodWorkEvaluation = $accompanyingPeriodWorkEvaluation; return $this; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/DocumentsList.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/DocumentsList.vue index 581f5e0b6..c82e6fb57 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/DocumentsList.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/components/DocumentsList.vue @@ -140,8 +140,10 @@
  • - EVALUATION_DOCUMENT_MOVE{{ trans(EVALUATION_DOCUMENT_MOVE) }}
  • @@ -186,14 +188,15 @@ import ListWorkflowModal from "ChillMainAssets/vuejs/_components/EntityWorkflow/ import DocumentActionButtonsGroup from "ChillDocStoreAssets/vuejs/DocumentActionButtonsGroup.vue"; import DropFileModal from "ChillDocStoreAssets/vuejs/DropFileWidget/DropFileModal.vue"; import { - EVALUATION_NOTIFICATION_NOTIFY_REFERRER, - EVALUATION_NOTIFICATION_NOTIFY_ANY, - EVALUATION_NOTIFICATION_SEND, - EVALUATION_DOCUMENTS, - EVALUATION_DOCUMENT_DUPLICATE, - EVALUATION_DOCUMENT_DUPLICATE_HERE, - EVALUATION_DOCUMENT_DUPLICATE_TO_OTHER_EVALUATION, - trans, + EVALUATION_NOTIFICATION_NOTIFY_REFERRER, + EVALUATION_NOTIFICATION_NOTIFY_ANY, + EVALUATION_NOTIFICATION_SEND, + EVALUATION_DOCUMENTS, + EVALUATION_DOCUMENT_MOVE, + EVALUATION_DOCUMENT_DUPLICATE, + EVALUATION_DOCUMENT_DUPLICATE_HERE, + EVALUATION_DOCUMENT_DUPLICATE_TO_OTHER_EVALUATION, + trans, } from "translator"; import { ref, watch } from "vue"; import AccompanyingPeriodWorkSelectorModal from "ChillPersonAssets/vuejs/_components/AccompanyingPeriodWorkSelector/AccompanyingPeriodWorkSelectorModal.vue"; diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 38d5caa60..093a903fd 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -777,6 +777,7 @@ evaluation: notification_notify_any: Notifier d'autres utilisateurs notification_send: Envoyer une notification document: + move: Déplacer duplicate: Dupliquer duplicate_here: Dupliquer ici duplicate_to_other_evaluation: Dupliquer vers une autre évaluation