diff --git a/src/Bundle/ChillPersonBundle/Audit/Displayer/AccompanyingPeriodWorkEvaluationDocumentSubjectDisplayer.php b/src/Bundle/ChillPersonBundle/Audit/Displayer/AccompanyingPeriodWorkEvaluationDocumentSubjectDisplayer.php
new file mode 100644
index 000000000..fe243af74
--- /dev/null
+++ b/src/Bundle/ChillPersonBundle/Audit/Displayer/AccompanyingPeriodWorkEvaluationDocumentSubjectDisplayer.php
@@ -0,0 +1,48 @@
+type;
+ }
+
+ public function display(Subject $subject, string $format = 'html', array $options = []): string
+ {
+ $id = $subject->identifiers['id'];
+ $msg = $this->translator->trans('audit.accompanying_period_work_evaluation_document.display', ['{id}' => $id]);
+
+ if ('html' === $format) {
+ $document = $this->repository->find($id);
+
+ if (null !== $document && null !== $title = $document->getTitle()) {
+ $msg .= ': '.htmlspecialchars($title);
+ }
+
+ return ''.$msg.'';
+ }
+
+ return $msg;
+ }
+}
diff --git a/src/Bundle/ChillPersonBundle/Audit/SubjectConverter/AccompanyingPeriodWorkEvaluationDocumentSubjectConverter.php b/src/Bundle/ChillPersonBundle/Audit/SubjectConverter/AccompanyingPeriodWorkEvaluationDocumentSubjectConverter.php
new file mode 100644
index 000000000..cdf36f23d
--- /dev/null
+++ b/src/Bundle/ChillPersonBundle/Audit/SubjectConverter/AccompanyingPeriodWorkEvaluationDocumentSubjectConverter.php
@@ -0,0 +1,48 @@
+
+ */
+class AccompanyingPeriodWorkEvaluationDocumentSubjectConverter implements SubjectConverterInterface, SubjectConverterManagerAwareInterface
+{
+ use SubjectConverterManagerAwareTrait;
+
+ public function convert(mixed $subject, bool $includeAssociated = false): SubjectBag
+ {
+ $data = new SubjectBag(new Subject('accompanying_period_work_evaluation_document', ['id' => $subject->getId()]));
+
+ if (null !== $accompanyingPeriodWork = $subject->getAccompanyingPeriodWorkEvaluation()?->getAccompanyingPeriodWork()) {
+ $data->append($this->subjectConverterManager->getSubjectsForEntity($accompanyingPeriodWork, $includeAssociated));
+ }
+
+ return $data;
+ }
+
+ public function supportsConvert(mixed $subject): bool
+ {
+ return $subject instanceof AccompanyingPeriodWorkEvaluationDocument;
+ }
+
+ public static function getDefaultPriority(): int
+ {
+ return 10;
+ }
+}
diff --git a/src/Bundle/ChillPersonBundle/Audit/SubjectConverter/AccompanyingPeriodWorkSubjectConverter.php b/src/Bundle/ChillPersonBundle/Audit/SubjectConverter/AccompanyingPeriodWorkSubjectConverter.php
index 51815be49..56fdcfae1 100644
--- a/src/Bundle/ChillPersonBundle/Audit/SubjectConverter/AccompanyingPeriodWorkSubjectConverter.php
+++ b/src/Bundle/ChillPersonBundle/Audit/SubjectConverter/AccompanyingPeriodWorkSubjectConverter.php
@@ -29,6 +29,8 @@ class AccompanyingPeriodWorkSubjectConverter implements SubjectConverterInterfac
{
$data = new SubjectBag(new Subject('accompanying_period_work', ['id' => $subject->getId()]));
+ $data->append($this->subjectConverterManager->getSubjectsForEntity($subject->getAccompanyingPeriod()));
+
foreach ($subject->getPersons() as $person) {
$data->append($this->subjectConverterManager->getSubjectsForEntity($person));
}
diff --git a/src/Bundle/ChillPersonBundle/Tests/Audit/Displayer/AccompanyingPeriodWorkEvaluationDocumentSubjectDisplayerTest.php b/src/Bundle/ChillPersonBundle/Tests/Audit/Displayer/AccompanyingPeriodWorkEvaluationDocumentSubjectDisplayerTest.php
new file mode 100644
index 000000000..137d938e2
--- /dev/null
+++ b/src/Bundle/ChillPersonBundle/Tests/Audit/Displayer/AccompanyingPeriodWorkEvaluationDocumentSubjectDisplayerTest.php
@@ -0,0 +1,115 @@
+repository = $this->prophesize(AccompanyingPeriodWorkEvaluationDocumentRepository::class);
+ $this->translator = $this->prophesize(TranslatorInterface::class);
+ $this->displayer = new AccompanyingPeriodWorkEvaluationDocumentSubjectDisplayer(
+ $this->repository->reveal(),
+ $this->translator->reveal()
+ );
+ }
+
+ public function testSupportsDisplay(): void
+ {
+ $subject = new Subject('accompanying_period_work_evaluation_document', ['id' => 123]);
+ $this->assertTrue($this->displayer->supportsDisplay($subject));
+
+ $otherSubject = new Subject('other', ['id' => 123]);
+ $this->assertFalse($this->displayer->supportsDisplay($otherSubject));
+ }
+
+ public function testDisplayStringFormat(): void
+ {
+ $id = 123;
+ $subject = new Subject('accompanying_period_work_evaluation_document', ['id' => $id]);
+
+ $this->translator->trans('audit.accompanying_period_work_evaluation_document.display', ['{id}' => $id])
+ ->willReturn('Translated document 123');
+
+ $result = $this->displayer->display($subject, 'string');
+
+ $this->assertSame('Translated document 123', $result);
+ }
+
+ public function testDisplayHtmlFormatWithoutDocument(): void
+ {
+ $id = 123;
+ $subject = new Subject('accompanying_period_work_evaluation_document', ['id' => $id]);
+
+ $this->repository->find($id)->willReturn(null);
+ $this->translator->trans('audit.accompanying_period_work_evaluation_document.display', ['{id}' => $id])
+ ->willReturn('Translated document 123');
+
+ $result = $this->displayer->display($subject, 'html');
+
+ $this->assertSame('Translated document 123', $result);
+ }
+
+ public function testDisplayHtmlFormatWithDocumentAndTitle(): void
+ {
+ $id = 123;
+ $subject = new Subject('accompanying_period_work_evaluation_document', ['id' => $id]);
+
+ $document = $this->prophesize(AccompanyingPeriodWorkEvaluationDocument::class);
+ $document->getTitle()->willReturn('My Document Title');
+
+ $this->repository->find($id)->willReturn($document->reveal());
+ $this->translator->trans('audit.accompanying_period_work_evaluation_document.display', ['{id}' => $id])
+ ->willReturn('Translated document 123');
+
+ $result = $this->displayer->display($subject, 'html');
+
+ $this->assertSame('Translated document 123: My Document Title', $result);
+ }
+
+ public function testDisplayHtmlFormatWithXssInTitle(): void
+ {
+ $id = 123;
+ $subject = new Subject('accompanying_period_work_evaluation_document', ['id' => $id]);
+
+ $document = $this->prophesize(AccompanyingPeriodWorkEvaluationDocument::class);
+ $document->getTitle()->willReturn('Title ');
+
+ $this->repository->find($id)->willReturn($document->reveal());
+ $this->translator->trans('audit.accompanying_period_work_evaluation_document.display', ['{id}' => $id])
+ ->willReturn('Translated document 123');
+
+ $result = $this->displayer->display($subject, 'html');
+
+ $expectedTitle = htmlspecialchars('Title ');
+ $this->assertSame('Translated document 123: '.$expectedTitle.'', $result);
+ }
+}
diff --git a/src/Bundle/ChillPersonBundle/Tests/Audit/SubjectConverter/AccompanyingPeriodWorkEvaluationDocumentSubjectConverterTest.php b/src/Bundle/ChillPersonBundle/Tests/Audit/SubjectConverter/AccompanyingPeriodWorkEvaluationDocumentSubjectConverterTest.php
new file mode 100644
index 000000000..0b840238e
--- /dev/null
+++ b/src/Bundle/ChillPersonBundle/Tests/Audit/SubjectConverter/AccompanyingPeriodWorkEvaluationDocumentSubjectConverterTest.php
@@ -0,0 +1,91 @@
+converter = new AccompanyingPeriodWorkEvaluationDocumentSubjectConverter();
+ }
+
+ public function testSupportsConvert(): void
+ {
+ $this->assertTrue($this->converter->supportsConvert($this->prophesize(AccompanyingPeriodWorkEvaluationDocument::class)->reveal()));
+ $this->assertFalse($this->converter->supportsConvert(new \stdClass()));
+ }
+
+ public function testConvert(): void
+ {
+ $document = $this->prophesize(AccompanyingPeriodWorkEvaluationDocument::class);
+ $document->getId()->willReturn(123);
+
+ $evaluation = $this->prophesize(AccompanyingPeriodWorkEvaluation::class);
+ $work = $this->prophesize(AccompanyingPeriodWork::class);
+
+ $document->getAccompanyingPeriodWorkEvaluation()->willReturn($evaluation->reveal());
+ $evaluation->getAccompanyingPeriodWork()->willReturn($work->reveal());
+
+ $subjectConverterManager = $this->prophesize(SubjectConverterManagerInterface::class);
+
+ $workSubject = new Subject('accompanying_period_work', ['id' => 456]);
+ $workBag = new SubjectBag($workSubject);
+
+ $subjectConverterManager->getSubjectsForEntity($work->reveal(), false)->willReturn($workBag);
+
+ $this->converter->setSubjectConverterManager($subjectConverterManager->reveal());
+
+ $result = $this->converter->convert($document->reveal());
+
+ $this->assertSame('accompanying_period_work_evaluation_document', $result->subject->type);
+ $this->assertSame(['id' => 123], $result->subject->identifiers);
+
+ $this->assertCount(1, $result->associatedSubjects);
+ $this->assertSame($workSubject, $result->associatedSubjects[0]);
+ }
+
+ public function testConvertWithoutEvaluation(): void
+ {
+ $document = $this->prophesize(AccompanyingPeriodWorkEvaluationDocument::class);
+ $document->getId()->willReturn(123);
+ $document->getAccompanyingPeriodWorkEvaluation()->willReturn(null);
+
+ $result = $this->converter->convert($document->reveal());
+
+ $this->assertSame('accompanying_period_work_evaluation_document', $result->subject->type);
+ $this->assertEmpty($result->associatedSubjects);
+ }
+
+ public function testGetDefaultPriority(): void
+ {
+ $this->assertSame(10, AccompanyingPeriodWorkEvaluationDocumentSubjectConverter::getDefaultPriority());
+ }
+}
diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml
index b83b9ccbb..9b31d9953 100644
--- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml
+++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml
@@ -1598,6 +1598,8 @@ audit:
accompanying_period_work:
accompanying_period_work_number: "Action d'accompagnement n°{id}"
list: Liste des actions d'accompagnement d'un parcours
+ accompanying_period_work_evaluation_document:
+ display: "Document d'évaluation n°{id}"
person_resource:
list: Liste des personnes ressources
person_resource_number: "Personne ressource n°{id}: {name}"