From c56cf624864aa364caea21de63033da9fe9ff0d3 Mon Sep 17 00:00:00 2001
From: gloas <gloas@afi-sa.fr>
Date: Mon, 6 Jun 2022 11:47:41 +0200
Subject: [PATCH] hotline #143674 fix description_html setting  usage for
 records widgets

---
 VERSIONS_HOTLINE/143674                       |  2 ++
 .../Library/View/Wrapper/Record.php           |  4 +--
 .../Templates/TemplatesRecordsTest.php        | 33 +++++++++++++++++--
 3 files changed, 34 insertions(+), 5 deletions(-)
 create mode 100644 VERSIONS_HOTLINE/143674

diff --git a/VERSIONS_HOTLINE/143674 b/VERSIONS_HOTLINE/143674
new file mode 100644
index 00000000000..82344192077
--- /dev/null
+++ b/VERSIONS_HOTLINE/143674
@@ -0,0 +1,2 @@
+ - correctif #143674 : Magasin de thèmes : Le paramètre "Autoriser les balises HTML"
+   	     	       des boites notices est maintenant bien pris en compte.
\ No newline at end of file
diff --git a/library/templates/Intonation/Library/View/Wrapper/Record.php b/library/templates/Intonation/Library/View/Wrapper/Record.php
index ec3731f720b..25233f6516b 100644
--- a/library/templates/Intonation/Library/View/Wrapper/Record.php
+++ b/library/templates/Intonation/Library/View/Wrapper/Record.php
@@ -102,9 +102,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra
 
     $description = $xsl->isEnabled() && $this->getAllowXSL()
       ? $this->_view->Notice_Xsl($xsl)
-      : $this->_view->truncate($this->_model->getResume(),
-                               ['class' => 'model_description_' . get_class($this->_model)],
-                               $description_length);
+      : $this->_truncate($this->_model->getResume());
 
     return ($this->_description = $this->getBadges() . $description);
   }
diff --git a/tests/scenarios/Templates/TemplatesRecordsTest.php b/tests/scenarios/Templates/TemplatesRecordsTest.php
index dc13810f8e9..7ae3a3f0ea4 100644
--- a/tests/scenarios/Templates/TemplatesRecordsTest.php
+++ b/tests/scenarios/Templates/TemplatesRecordsTest.php
@@ -83,7 +83,6 @@ class TemplatesRecordsWidgetTest extends Admin_AbstractControllerTestCase {
 
 
 abstract class TemplateRecordsWithDescriptionAndUnimarcTest extends AbstractControllerTestCase {
-  protected $_storm_default_to_volatile = true;
 
 
   public function setUp() {
@@ -96,7 +95,7 @@ abstract class TemplateRecordsWithDescriptionAndUnimarcTest extends AbstractCont
                    ['id' => 'fre', 'libelle' => 'Français']);
 
     $notice_unimarc = (new Class_NoticeUnimarc_Fluent)
-      ->zoneWithChildren('330', ['a' => 'La description s\'arrête ici et pas plus loin.'])
+      ->zoneWithChildren('330', ['a' => 'La description s\'arrête ici et pas plus loin. <a href="/mon-super-lien">mon super lien</a>'])
       ->zoneWithChildren('210', ['c' => 'Auzou'])
       ->zoneWithChildren('225', ['a' => 'Pocket'])
       ->zoneWithChildren('101', ['a' => 'fre']);
@@ -1411,4 +1410,34 @@ class TemplatesRecordWithMultipleMoreDescriptionDataTest extends AbstractControl
     $this->assertXPathContentContains('//dl/dt[text()="Public"]/following-sibling::dd//ul//li//span[@class="more_description_data_title font-italic"]',
                                       'Jeunesse');
   }
+}
+
+
+
+
+class TemplatesRecordsWithAnchorInDescriptionTest extends TemplateRecordsWithDescriptionAndUnimarcTest {
+  public function setUp() {
+    parent::setUp();
+
+    $profile_patcher = (new Class_Template_ProfilePatcher(null))
+      ->setProfile(Class_Profil::find(34));
+
+    $profile_patcher
+      ->addWidget(Intonation_Library_Widget_Carousel_Record_Definition::CODE,
+                  Class_Profil::DIV_MAIN,
+                  ['rendering' => 'card-description',
+                   'layout' => 'list',
+                   'size' => '1',
+                   'description_html' => '1',
+                   'description_length' => 1000]);
+
+    $this->dispatch('/opac/widget/render/widget_id/1/profile_id/34');
+  }
+
+
+  /** @test */
+  public function anchorBlablaShouldBeDisplay() {
+    $this->assertXPathContentContains('//div[contains(@class, "kiosque widget")]//p[@class= "model_description_Class_Notice"]//a',
+                                      'mon super lien');
+  }
 }
\ No newline at end of file
-- 
GitLab