From cf94b0b2bb94c97f9f219907a6e0797fde536987 Mon Sep 17 00:00:00 2001
From: llaffont <llaffont@afi-sa.fr>
Date: Fri, 30 Oct 2015 11:03:46 +0100
Subject: [PATCH] hotline #31237 : fix language display in record header

---
 VERSIONS_HOTLINE/31237                        |  1 +
 library/Class/Notice.php                      |  1 +
 .../controllers/NoticeAjaxControllerTest.php  | 22 +++++++++++++++----
 3 files changed, 20 insertions(+), 4 deletions(-)
 create mode 100644 VERSIONS_HOTLINE/31237

diff --git a/VERSIONS_HOTLINE/31237 b/VERSIONS_HOTLINE/31237
new file mode 100644
index 00000000000..200ba773a8a
--- /dev/null
+++ b/VERSIONS_HOTLINE/31237
@@ -0,0 +1 @@
+ - ticket #31237 : Correction de l'affichage de la langue dans un détail notice
\ No newline at end of file
diff --git a/library/Class/Notice.php b/library/Class/Notice.php
index bd76d4bc435..6b2449a6635 100644
--- a/library/Class/Notice.php
+++ b/library/Class/Notice.php
@@ -686,6 +686,7 @@ class Class_Notice extends Storm_Model_Abstract {
       case Class_Codification::CODE_URL: return  $this->getUrls();
       case Class_Codification::CODE_ANNEE: return  $this->getAnnee();
       case Class_Codification::CODE_PRIX: return  $this->getPrix();
+      case Class_CodifLangue::CODE_FACETTE: return  $this->getLangues();
       case Class_Codification::CODE_IDENTIFIANT: return  (new Class_Isbn($this->getIsbnOrEan()))->getAll()['isbn10'];
       case Class_Codification::CODE_NOUVEAUTE: return $this->isNouveaute() ? $this->_('Oui'): $this->_('Non');
     }
diff --git a/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php b/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php
index 71713966f8d..4ddcb1d302c 100644
--- a/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php
+++ b/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php
@@ -60,7 +60,8 @@ class NoticeAjaxControllerNonRegressionTest extends AbstractControllerTestCase {
 
 
 
-class NoticeAjaxControllerNoticeWithGamUrlTestCase extends AbstractControllerTestCase {
+
+class NoticeAjaxControllerDetailNoticeWithGamUrlTestCase extends AbstractControllerTestCase {
   protected $_wesley;
 
 
@@ -91,21 +92,34 @@ class NoticeAjaxControllerNoticeWithGamUrlTestCase extends AbstractControllerTes
 
     $this->fixture('Class_CosmoVar', ['id' => 'types_docs',
                                       'liste' => "1:cd\r\n200:non identifié\r\n201:livres\r\n202:bd"]);
+    $this->dispatch('/opac/noticeajax/detail/id_notice/1', true);
   }
 
 
   /** @test */
   public function withNoticeFoundResponseShouldContainsLienInternet() {
-    $this->dispatch('/opac/noticeajax/detail/id_notice/1', true);
     $this->assertXPathContentContains('//a', 'http://www.gamannecy.com//upload/albums/201202/0602527840871_thumb.jpg', $this->_response->getBody());
   }
-}
 
 
+  /** @test */
+  public function ddForYearShouldContains() {
+    $this->assertXPathContentContains('//dd[preceding-sibling::dt[contains(text(),"Ann")]]',
+                                      '2000');
+  }
 
-class NoticeAjaxControllerNoticeWithCustomLinks extends AbstractControllerTestCase {
+
+  /** @test */
+  public function ddForLanguageShouldContainsAnglais() {
+    $this->assertXPathContentContains('//dd[preceding-sibling::dt[contains(text(),"Langue(s)")]]',
+                                      'anglais');
+  }
+}
 
 
+
+
+class NoticeAjaxControllerNoticeWithCustomLinks extends AbstractControllerTestCase {
   public function setUp() {
     parent::setUp();
 
-- 
GitLab