From 8e0a750bead77c77a7a5179ee5f7eac87718e398 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?ANDRE=20s=C3=A9bastien?= <sandre@afi-sa.fr>
Date: Wed, 19 Jan 2022 14:01:27 +0100
Subject: [PATCH] hotline : #149168 : MT, view record allways display same
 media video

---
 VERSIONS_HOTLINE/149168                                  | 1 +
 .../Library/View/Wrapper/Record/RichContent/Media.php    | 5 ++++-
 tests/scenarios/Templates/TemplatesRecordsTest.php       | 9 +++++++++
 3 files changed, 14 insertions(+), 1 deletion(-)
 create mode 100644 VERSIONS_HOTLINE/149168

diff --git a/VERSIONS_HOTLINE/149168 b/VERSIONS_HOTLINE/149168
new file mode 100644
index 00000000000..6826a10243e
--- /dev/null
+++ b/VERSIONS_HOTLINE/149168
@@ -0,0 +1 @@
+ - correctif #149168 : Magasin de thème : vue notice, correction l'onglet média qui affichait toujours la même vidéo par défaut
\ No newline at end of file
diff --git a/library/templates/Intonation/Library/View/Wrapper/Record/RichContent/Media.php b/library/templates/Intonation/Library/View/Wrapper/Record/RichContent/Media.php
index 9afefe5506d..edcb0c4db19 100644
--- a/library/templates/Intonation/Library/View/Wrapper/Record/RichContent/Media.php
+++ b/library/templates/Intonation/Library/View/Wrapper/Record/RichContent/Media.php
@@ -34,7 +34,10 @@ class Intonation_Library_View_Wrapper_Record_RichContent_Media extends Intonatio
     if ($this->_content)
       return $this->_content;
 
-    $html = [$this->_view->renderAjax('noticeajax', 'media', [], $this->_getJsCallback())];
+    $html = [$this->_view->renderAjax('noticeajax',
+                                      'media',
+                                      ['id' => $this->_model->getId()],
+                                      $this->_getJsCallback())];
 
     return $this->_content = $this->_view->grid(implode($html));
   }
diff --git a/tests/scenarios/Templates/TemplatesRecordsTest.php b/tests/scenarios/Templates/TemplatesRecordsTest.php
index d47d0bc4eb4..c4dbb755a29 100644
--- a/tests/scenarios/Templates/TemplatesRecordsTest.php
+++ b/tests/scenarios/Templates/TemplatesRecordsTest.php
@@ -200,6 +200,15 @@ class TemplatesRecords_Notice_NoThumbnailVignetteTest
   public function withoutUnimarcAndNoUrlVignettehtmlShouldContainsNothumbnail() {
     $this->assertXPath('//div[@class =  "record_no_thumbnail card card-img-overlay"]//i[@class="fas fa-book ico_xl doc_type_1 doc_types"]');
   }
+
+
+  /**
+  * @see hotline : https://forge.afi-sa.net/issues/149168
+  * @test
+  **/
+  public function JSloadMediaShouldHaveRecordId() {
+    $this->assertXPathContentContains('//script', '.load("/noticeajax/media/id/1"');
+  }
 }
 
 
-- 
GitLab