From 94a7b690a1b632c4eb95d2e2524d2302ea4aa247 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?ANDRE=20s=C3=A9bastien?= <sandre@afi-sa.fr>
Date: Tue, 21 Sep 2021 09:05:35 +0200
Subject: [PATCH] hotline: #138355 : link to notice in rss was broken

---
 VERSIONS_HOTLINE/138355                                   | 1 +
 application/modules/opac/controllers/RssController.php    | 2 +-
 .../modules/opac/controllers/RssControllerTest.php        | 8 +++++---
 tests/scenarios/Templates/TemplatesRssTest.php            | 8 ++++++++
 4 files changed, 15 insertions(+), 4 deletions(-)
 create mode 100644 VERSIONS_HOTLINE/138355

diff --git a/VERSIONS_HOTLINE/138355 b/VERSIONS_HOTLINE/138355
new file mode 100644
index 00000000000..b39b776f53f
--- /dev/null
+++ b/VERSIONS_HOTLINE/138355
@@ -0,0 +1 @@
+ - ticket #138355 : Flux Rss : Correction des liens vers les notices dans les flux RSS générés par les carrousels.
\ No newline at end of file
diff --git a/application/modules/opac/controllers/RssController.php b/application/modules/opac/controllers/RssController.php
index 9023a76f726..a3773a0e6f5 100644
--- a/application/modules/opac/controllers/RssController.php
+++ b/application/modules/opac/controllers/RssController.php
@@ -314,7 +314,7 @@ class RssController extends ZendAfi_Controller_Action {
       $items [] = ['titre' => '<![CDATA[' . str_replace(BR, ' ', $record->getTitrePrincipal()) . ', ' . $record->getAuteurPrincipal() . ']]>' ,
                   'lien' => $this->view->absoluteUrl([
                                                       'controller' => 'recherche',
-                                                      'action' => 'viewrecord',
+                                                      'action' => 'viewnotice',
                                                       'id' => $record->getId(),
                                                       ], null, true),
                   'desc' => '<![CDATA[' . $this->_noticeRssDescription($record) . ']]>',
diff --git a/tests/application/modules/opac/controllers/RssControllerTest.php b/tests/application/modules/opac/controllers/RssControllerTest.php
index b41e837def4..fb9b7c1f5ee 100644
--- a/tests/application/modules/opac/controllers/RssControllerTest.php
+++ b/tests/application/modules/opac/controllers/RssControllerTest.php
@@ -296,8 +296,10 @@ class RssControllerKiosqueTest extends AbstractControllerTestCase {
 
 
   /** @test */
-  public function rssLinkShouldContainBaseUrl() {
-    $this->assertXPathContentContains('//link', BASE_URL);
+  public function rssLinkShouldContainBaseUrl_recherche_viewnotice_id_1() {
+    /* hotline: #138355 */
+    $this->assertXPathContentContains('//link',
+                                      BASE_URL . '/recherche/viewnotice/id/1');
   }
 
 
@@ -447,4 +449,4 @@ class RssControllerCritiquesTest extends AbstractControllerTestCase {
   public function rssItemFirstImageShouldBeRawThumbnail() {
     $this->assertContains('recherche/raw-thumbnail/id/1"/><media:content', $this->_response->getBody());
   }
-}
\ No newline at end of file
+}
diff --git a/tests/scenarios/Templates/TemplatesRssTest.php b/tests/scenarios/Templates/TemplatesRssTest.php
index e571fd67080..9561c70cc12 100644
--- a/tests/scenarios/Templates/TemplatesRssTest.php
+++ b/tests/scenarios/Templates/TemplatesRssTest.php
@@ -123,6 +123,14 @@ class TemplatesRssForVolatileKiosqueTest extends AbstractControllerTestCase {
   public function ninNinDansLUniversShouldBePresent() {
     $this->assertXPathContentContains('//item/title', '<![CDATA[NinNin dans l\'Univers, ]]>');
   }
+
+
+  /* hotline: #138355 */
+  /** @test */
+  public function linkToRecordShouldBeBokeh_recherche_viewnotice_id_1() {
+    $this->assertXPathContentContains('//item/link',
+                                      '/recherche/viewnotice/id/1');
+  }
 }
 
 
-- 
GitLab