From 3bd29717838330e52f8560e6041f8a1b217ed44b Mon Sep 17 00:00:00 2001
From: Laurent Laffont <llaffont@afi-sa.fr>
Date: Tue, 14 Mar 2017 16:54:01 +0100
Subject: [PATCH] hotline #55110 when uploading a thumbnail on cache server,
 give cache server doc type instead of Bokeh doc type

---
 VERSIONS_HOTLINE/55110                                    | 1 +
 library/Class/Notice.php                                  | 8 --------
 library/Class/TypeDoc.php                                 | 7 -------
 library/Class/WebService/AllServices.php                  | 2 +-
 .../modules/admin/controllers/RecordsControllerTest.php   | 7 ++++++-
 5 files changed, 8 insertions(+), 17 deletions(-)
 create mode 100644 VERSIONS_HOTLINE/55110

diff --git a/VERSIONS_HOTLINE/55110 b/VERSIONS_HOTLINE/55110
new file mode 100644
index 00000000000..18dcf6844bc
--- /dev/null
+++ b/VERSIONS_HOTLINE/55110
@@ -0,0 +1 @@
+ - ticket #55110 : les vignettes des notices modifiées manuellement pour des ressources numériques sont sauvegardées correctement sur le serveur de cache mutualisé.
\ No newline at end of file
diff --git a/library/Class/Notice.php b/library/Class/Notice.php
index 028ba8b7baf..27ec38fbf22 100644
--- a/library/Class/Notice.php
+++ b/library/Class/Notice.php
@@ -1632,14 +1632,6 @@ class Class_Notice extends Storm_Model_Abstract {
   }
 
 
-  /**
-   * return int identifiant type doc codifié Pergame
-   */
-  public function getTypeDocPergame() {
-    return Class_TypeDoc::find($this->getTypeDoc())->toPergame();
-  }
-
-
   /**
    * @param $noticeUnimarc Class_NoticeUnimarc
    * @category testing
diff --git a/library/Class/TypeDoc.php b/library/Class/TypeDoc.php
index df315bedae2..09678a2dfd4 100644
--- a/library/Class/TypeDoc.php
+++ b/library/Class/TypeDoc.php
@@ -311,13 +311,6 @@ class Class_TypeDoc extends Storm_Model_Abstract {
   }
 
 
-  /**
-   * return int identifiant type doc codifié Pergame
-   */
-  public function toPergame() {
-    return $this->getId();
-  }
-
   public function isRessourceNumerique() {
     return (($this->getId() >= Class_TypeDoc::LIVRE_NUM)
             && (!in_array($this->getId(),[static::ARTICLE, static::RSS, static::SITE])))
diff --git a/library/Class/WebService/AllServices.php b/library/Class/WebService/AllServices.php
index 5da7a8c1236..92e62e910d3 100644
--- a/library/Class/WebService/AllServices.php
+++ b/library/Class/WebService/AllServices.php
@@ -111,7 +111,7 @@ class Class_WebService_AllServices {
     $notice = Class_Notice::find($id);
     $result = static::runServiceAfiUploadVignette(array_filter(['isbn' => $notice->getIsbn(),
                                                                 'ean' => $notice->getEan(),
-                                                                'type_doc' => $notice->getTypeDocPergame(),
+                                                                'type_doc' => $notice->getFamilleId(),
                                                                 'titre' => $notice->getTitrePrincipal(),
                                                                 'auteur' => $notice->getAuteurPrincipal(),
                                                                 'image' => $url,
diff --git a/tests/application/modules/admin/controllers/RecordsControllerTest.php b/tests/application/modules/admin/controllers/RecordsControllerTest.php
index 2d62fafe9a8..21bdfe10a41 100644
--- a/tests/application/modules/admin/controllers/RecordsControllerTest.php
+++ b/tests/application/modules/admin/controllers/RecordsControllerTest.php
@@ -29,8 +29,13 @@ abstract class RecordsControllerTestCase extends Admin_AbstractControllerTestCas
   public function setUp() {
     parent::setUp();
 
+    Class_TypeDoc::find(Class_TypeDoc::EPUB)
+      ->getCodifTypeDoc()
+      ->setFamilleId(Class_CodifTypeDoc::LIVRE)
+      ->save();
+
     $this->_notice = Class_Notice::newInstanceWithId(12345, ['isbn' => '0123456789',
-                                                             'type_doc' => Class_TypeDoc::LIVRE,
+                                                             'type_doc' => Class_TypeDoc::EPUB,
                                                              'url_vignette' => '',
                                                              'url_image' => '',
                                                              'titre_principal' => 'Harry Potter',
-- 
GitLab