From 55adc436799cd4d37c5a9129c60e1382d1a9601e Mon Sep 17 00:00:00 2001
From: llaffont <llaffont@afi-sa.fr>
Date: Fri, 9 Sep 2016 15:58:48 +0200
Subject: [PATCH] hotline #28732 fix LastFM get photos

---
 .../modules/opac/controllers/NoticeajaxController.php     | 8 +++-----
 library/Class/Notice.php                                  | 5 +++++
 public/opac/js/recherche.js                               | 2 +-
 .../modules/opac/controllers/NoticeAjaxControllerTest.php | 7 ++++++-
 4 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/application/modules/opac/controllers/NoticeajaxController.php b/application/modules/opac/controllers/NoticeajaxController.php
index 5e1e39ef6c9..2abc2252f6c 100644
--- a/application/modules/opac/controllers/NoticeajaxController.php
+++ b/application/modules/opac/controllers/NoticeajaxController.php
@@ -244,13 +244,11 @@ class NoticeAjaxController extends Zend_Controller_Action {
 
   public function photosAction() {
     session_write_close();
-    $notice = $this->notice->getNotice("JA");
-
-    $photos = ($notice["type_doc"]==3)
-      ? Class_WebService_Lastfm::getInstance()->getPhotos($notice["A"])
+    $photos = ($this->notice->isDisc())
+      ? Class_WebService_Lastfm::getInstance()->getPhotos($this->notice->getAuteurPrincipal())
       : [];
 
-    $html = $this->notice_html->getPhotos($photos);
+    $html = (new Class_NoticeHtml($this->notice))->getPhotos($photos);
     $this->_sendResponseWithScripts($html);
   }
 
diff --git a/library/Class/Notice.php b/library/Class/Notice.php
index 3668044a455..0ea59a1e612 100644
--- a/library/Class/Notice.php
+++ b/library/Class/Notice.php
@@ -459,6 +459,11 @@ class Class_Notice extends Storm_Model_Abstract {
   }
 
 
+  public function isDisc() {
+    return $this->getTypeDoc() == Class_TypeDoc::DISQUE;
+  }
+
+
   public function isArteVOD() {
     return ($this->getTypeDoc() == Class_TypeDoc::ARTEVOD);
   }
diff --git a/public/opac/js/recherche.js b/public/opac/js/recherche.js
index 9c3b54f4560..72ba8f08e6f 100644
--- a/public/opac/js/recherche.js
+++ b/public/opac/js/recherche.js
@@ -225,7 +225,7 @@ function afficher_image(sUrl)
     oBoite.setAttribute("id","img_boite");
     oBoite.setAttribute("class","notice_img");
     oBoite.setAttribute("className","notice_img");
-    oBoite.setAttribute("style","display:block;position:absolute");
+    oBoite.setAttribute("style","display:block;position:absolute;z-index:10000");
     document.body.appendChild(oBoite);
   }
   // Patience
diff --git a/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php b/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php
index 24bdd3045a5..8708173c710 100644
--- a/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php
+++ b/tests/application/modules/opac/controllers/NoticeAjaxControllerTest.php
@@ -525,7 +525,12 @@ abstract class NoticeAjaxControllerLastFmTestCase extends AbstractControllerTest
 class NoticeAjaxControllerPhotosTest extends NoticeAjaxControllerLastFmTestCase {
   public function setUp() {
     parent::setUp();
-    $this->lastfm->whenCalled('getPhotos')->with('Frodo')->answers(['1.jpg']);
+    $this->lastfm->whenCalled('getPhotos')
+                 ->with('Frodo')
+                 ->answers([
+                            ['thumb' => '1.jpg',
+                             'full' => '1.jpg']
+                            ]);
     $this->dispatch('noticeajax/photos/id_notice/777', true);
   }
 }
-- 
GitLab