diff --git a/VERSIONS_HOTLINE/96803 b/VERSIONS_HOTLINE/96803 new file mode 100644 index 0000000000000000000000000000000000000000..20fd72fc66f281ba0e68e1a2e4f5ef7d2c3e8f28 --- /dev/null +++ b/VERSIONS_HOTLINE/96803 @@ -0,0 +1 @@ + - ticket #96803 : Gestion des simple quotes erronées \ No newline at end of file diff --git a/library/Class/Indexation/PseudoNotice.php b/library/Class/Indexation/PseudoNotice.php index ddb1be1653f1e153675c7450f11560b162481646..01d9f4b5f614ed0c1e95b4950fb56e022e3fb38e 100644 --- a/library/Class/Indexation/PseudoNotice.php +++ b/library/Class/Indexation/PseudoNotice.php @@ -599,14 +599,18 @@ class Class_Indexation_PseudoNotice_Cms extends Class_Indexation_PseudoNotice{ protected function _prepareDatas() { parent::_prepareDatas(); - $this->_datas['resume'] = strip_tags($this->_datas['description']); - $this->_datas['description'] = strip_tags($this->_datas['contenu']); + $this->_datas['resume'] = $this->_sanitizeString($this->_datas['description']); + $this->_datas['description'] = $this->_sanitizeString($this->_datas['contenu']); $this->_datas['auteur'] = $this->_model->hasAuteur() ? $this->_model->getAuteur()->getNomComplet() : ''; $this->_datas['annee'] = date('Y', strtotime($this->_model->getDateCreation())); } + + protected function _sanitizeString($string) { + return strip_tags(html_entity_decode($string, ENT_QUOTES)); + } } @@ -648,4 +652,4 @@ class Class_Indexation_PseudoNotice_Null extends Class_Indexation_PseudoNotice{ public function isValid() { return false; } -} \ No newline at end of file +} diff --git a/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php b/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php index 7b77a6cccd9e86594844f4ad9821a9d7b38d5a59..0069e1fe108e7e1ef06c9486de988662f4d43aa8 100644 --- a/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php +++ b/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php @@ -617,14 +617,14 @@ class NoticeAjaxControllerResumeAlbumTest extends AbstractControllerTestCase { Class_Album::getLoader() ->newInstanceWithId(2) - ->setDescription('Lucky Luke est un grand cow-boy'); + ->setDescription('<p>Lucky Luke est un grand cow-boy de l'Ouest</p>'); } /** @test */ public function contenuShouldContainsResume() { $this->dispatch('noticeajax/resume?id_notice=123'); - $this->assertXPathContentContains('//div', 'Lucky Luke est un grand cow-boy'); + $this->assertXPathContentContains('//div', 'Lucky Luke est un grand cow-boy de l\'Ouest', $this->_response->getBody()); } diff --git a/tests/library/Class/AlbumTest.php b/tests/library/Class/AlbumTest.php index d4d45974fc5f860571ae069ca5dbf65ca275fb63..29b02598b5185d8ed916c82a1d53d82457628aee 100644 --- a/tests/library/Class/AlbumTest.php +++ b/tests/library/Class/AlbumTest.php @@ -762,4 +762,4 @@ class AlbumIsbnMarcTest extends ModelTestCase { public function isbnFromAlbumShouldBe9782081377523() { $this->assertEquals('9782081377523', $this->_album->getIsbn()); } -} \ No newline at end of file +} diff --git a/tests/library/Class/Indexation/PseudoNoticeTest.php b/tests/library/Class/Indexation/PseudoNoticeTest.php index 90112ae9396128f5adbf9a61e9b7ec9f7e215c73..acacd8d89a4a40c62cabe45acb02684d768cff9c 100644 --- a/tests/library/Class/Indexation/PseudoNoticeTest.php +++ b/tests/library/Class/Indexation/PseudoNoticeTest.php @@ -375,7 +375,7 @@ class Class_Indexation_PseudoNoticeArticleTest ['id' => 1, 'titre' => 'My Article', 'contenu' => 'article is about...', - 'description' => 'This is a test', + 'description' => 'C'est un mégatest.', 'date_creation' => '2018-02-17 10:22:34', 'auteur' => $author, 'domaine_ids' => '17']); @@ -403,8 +403,8 @@ class Class_Indexation_PseudoNoticeArticleTest /** @test */ - public function firstRecordSummaryShouldBeThisIsATest() { - $this->assertEquals('This is a test', Class_Notice::find(1)->getResume()); + public function firstRecordSummaryShouldBeCestUnMegaTest() { + $this->assertEquals('C\'est un mégatest.', Class_Notice::find(1)->getResume()); } @@ -846,4 +846,4 @@ class Class_Indexation_PseudoNoticeSacramentariumTest extends Class_Indexation_P $item = $this->_notice->getExemplaires()[0]; $this->assertEquals(7, $item->getGenre()); } -} \ No newline at end of file +}