From 4937cb23aa7c80e8c22436c681410fd3efebf2a7 Mon Sep 17 00:00:00 2001
From: Laurent <llaffont@afi-sa.fr>
Date: Tue, 17 Jan 2017 14:59:32 +0100
Subject: [PATCH] Merge branch
 'hotline#52240_permaliens_des_albums_ressources_numeriques' into 'stable'

Hotline#52240 permaliens des albums ressources numeriques

See merge request !1993
---
 VERSIONS_HOTLINE/52240                                 |  1 +
 library/Class/Album.php                                | 10 ++--------
 .../modules/admin/controllers/AlbumControllerTest.php  | 10 ++++++----
 .../opac/controllers/BibNumeriqueControllerTest.php    | 10 +++++-----
 tests/library/Class/AlbumTest.php                      |  5 ++---
 5 files changed, 16 insertions(+), 20 deletions(-)
 create mode 100644 VERSIONS_HOTLINE/52240

diff --git a/VERSIONS_HOTLINE/52240 b/VERSIONS_HOTLINE/52240
new file mode 100644
index 00000000000..02672069511
--- /dev/null
+++ b/VERSIONS_HOTLINE/52240
@@ -0,0 +1 @@
+ - ticket #52240 : Les permaliens des albums ressources numeriques utilisent maintenant l'id de l'album
\ No newline at end of file
diff --git a/library/Class/Album.php b/library/Class/Album.php
index 0af50ac1d16..d7689ba4414 100644
--- a/library/Class/Album.php
+++ b/library/Class/Album.php
@@ -270,16 +270,10 @@ class Class_Album extends Storm_Model_Abstract {
    * @return array
    */
   public function getPermalink() {
-
     $permalink = ['module' => 'opac',
                   'controller' => 'bib-numerique',
-                  'action' => 'notice'];
-
-    if ($this->hasIdOrigine())
-      $permalink['ido'] = $this->getIdOrigine();
-    else
-      $permalink['id'] = $this->getId();
-
+                  'action' => 'notice',
+                  'id' => $this->getId()];
     return $permalink;
   }
 
diff --git a/tests/application/modules/admin/controllers/AlbumControllerTest.php b/tests/application/modules/admin/controllers/AlbumControllerTest.php
index 87b9f9245bf..3a1daacfe24 100644
--- a/tests/application/modules/admin/controllers/AlbumControllerTest.php
+++ b/tests/application/modules/admin/controllers/AlbumControllerTest.php
@@ -1281,7 +1281,7 @@ class Admin_AlbumControllerEditAlbumMesBDPostFrbrModifyTest extends Admin_AlbumC
 
   /** @test */
   public function shouldHaveOnlyOneFrbrLink() {
-    $this->assertEquals(1, Class_FRBR_Link::countBy(['target' => ROOT_URL . BASE_URL .'/bib-numerique/notice/id/43/ido/DC023']));
+    $this->assertEquals(1, Class_FRBR_Link::countBy(['target' => ROOT_URL . BASE_URL .'/bib-numerique/notice/id/43']));
   }
 
 
@@ -1321,13 +1321,13 @@ class Admin_AlbumControllerEditAlbumMesBDTest extends Admin_AlbumControllerEditA
 
   /** @test */
   public function permalienShoulBeVisible() {
-    $this->assertXPath('//input[@value="http://localhost'.BASE_URL.'/bib-numerique/notice/ido/DC023"]');
+    $this->assertXPath('//input[@value="http://localhost'.BASE_URL.'/bib-numerique/notice/id/43"]');
   }
 
 
   /** @test */
   public function permalienVignetteShoulBeVisible() {
-    $this->assertXPath('//input[@value="http://localhost'.BASE_URL.'/bib-numerique/notice-thumbnail/ido/DC023"]');
+    $this->assertXPath('//input[@value="http://localhost'.BASE_URL.'/bib-numerique/notice-thumbnail/id/43"]');
   }
 
 
@@ -2191,11 +2191,13 @@ class Admin_AlbumControllerAlbumHarlockEditRessourceTwoActionTest extends Admin_
 
   /** @test */
   public function permalienShoulBeVisible() {
-    $this->assertXPath('//input[@value="http://localhost'.BASE_URL.'/bib-numerique/notice/ido/HL22/folio/4R"]');
+    $this->assertXPath('//input[@value="http://localhost'.BASE_URL.'/bib-numerique/notice/id/999/folio/4R"]');
   }
 }
 
 
+
+
 class Admin_AlbumControllerAlbumHarlockEditOtherRessourcesActionTest extends Admin_AlbumControllerAlbumHarlockTestCase {
   /** @test */
   function ressourceTwoInputLinkToShouldBeEmpty() {
diff --git a/tests/application/modules/opac/controllers/BibNumeriqueControllerTest.php b/tests/application/modules/opac/controllers/BibNumeriqueControllerTest.php
index 1655059bdb9..6a643ea559f 100644
--- a/tests/application/modules/opac/controllers/BibNumeriqueControllerTest.php
+++ b/tests/application/modules/opac/controllers/BibNumeriqueControllerTest.php
@@ -770,7 +770,7 @@ class BibNumeriqueControllerAlbumMultiMediasRSSTest extends BibNumeriqueControll
   /** @test */
   public function itunesImageShouldBeNoticeThumbnail() {
     $this->_xpath->assertXPath($this->_response->getBody(),
-                               '//channel/itunes:image[@href="http://localhost'.BASE_URL.'/bib-numerique/notice-thumbnail/ido/A888"]');
+                               '//channel/itunes:image[@href="http://localhost'.BASE_URL.'/bib-numerique/notice-thumbnail/id/999"]');
   }
 
 
@@ -791,10 +791,10 @@ class BibNumeriqueControllerAlbumMultiMediasRSSTest extends BibNumeriqueControll
 
 
   /** @test */
-  public function linkShouldBeBibNumeriqueNoticeIdoA888() {
+  public function linkShouldBeBibNumeriqueNoticeId999() {
     $this->_xpath->assertXPathContentContains($this->_response->getBody(),
                                               '//channel/link',
-                                              'http://localhost'.BASE_URL.'/bib-numerique/notice/ido/A888');
+                                              'http://localhost'.BASE_URL.'/bib-numerique/notice/id/999');
   }
 
 
@@ -914,7 +914,7 @@ class BibNumeriqueControllerPlayRessourceTest extends BibNumeriqueControllerAlbu
    */
   public function forRessourceFiveAnalyticsTrackerShouldHaveReceivedPlayEvent($client) {
     $this->assertEquals(['bib-numerique',
-                         'lecture', '"titre: Hunger Games","album: Plein de medias","auteur: Suzanne Collins","editeur: Gallimard","publication: 2001","piste: 3","droits: CC-BY-SA","source: http://localhost'.BASE_URL.'/bib-numerique/notice/id/5.mp3/ido/A888/folio/5"',
+                         'lecture', '"titre: Hunger Games","album: Plein de medias","auteur: Suzanne Collins","editeur: Gallimard","publication: 2001","piste: 3","droits: CC-BY-SA","source: http://localhost'.BASE_URL.'/bib-numerique/notice/id/999/folio/5"',
                          5],
                         $client->getAttributesForLastCallOn('trackEvent'));
   }
@@ -934,7 +934,7 @@ class BibNumeriqueControllerPlayRessourceTest extends BibNumeriqueControllerAlbu
     $this->dispatch('/opac/bib-numerique/play-ressource/id/8.mp3', true);
     $this->assertEquals(['bib-numerique',
                          'lecture',
-                         '"titre: Iron Maiden: \"Moonchild\" live","album: Plein de medias","auteur: Suzanne Collins","editeur: Gallimard","publication: 2001","piste: 6","droits: CC-BY-SA","source: http://localhost'.BASE_URL.'/bib-numerique/notice/id/8.mp3/ido/A888/folio/moonchild"',
+                         '"titre: Iron Maiden: \"Moonchild\" live","album: Plein de medias","auteur: Suzanne Collins","editeur: Gallimard","publication: 2001","piste: 6","droits: CC-BY-SA","source: http://localhost'.BASE_URL.'/bib-numerique/notice/id/999/folio/moonchild"',
                          8],
                         $this->_web_analytics_client->getAttributesForLastCallOn('trackEvent'));
   }
diff --git a/tests/library/Class/AlbumTest.php b/tests/library/Class/AlbumTest.php
index 3458e178d19..2e51b111cbe 100644
--- a/tests/library/Class/AlbumTest.php
+++ b/tests/library/Class/AlbumTest.php
@@ -107,12 +107,11 @@ class AlbumHarlockBasicTest extends AlbumHarlockTestCase {
 
 
   /** @test */
-  public function withIdOrigine_05DC03_PermalinkShouldBeBibNumNoticeIDO_05DC03() {
-    $this->_album->setIdOrigine('05DC03');
+  public function permalinkShouldBeBibNumNoticeID999() {
     $this->assertEquals(array('module' => 'opac',
                               'controller' => 'bib-numerique',
                               'action' => 'notice',
-                              'ido' => '05DC03'),
+                              'id' => 999),
                         $this->_album->getPermalink());
   }
 
-- 
GitLab