diff --git a/apps/maarch_entreprise/Views/signature-book.component.html b/apps/maarch_entreprise/Views/signature-book.component.html
index ac5dc94189e8a9cdb3088567061cf57c6e31d476..50bf8dbd5bc2f049f986cd0d50ff6c1d8e62c83a 100755
--- a/apps/maarch_entreprise/Views/signature-book.component.html
+++ b/apps/maarch_entreprise/Views/signature-book.component.html
@@ -76,7 +76,7 @@
             <div *ngIf="headerTab == 1" class="contentShow">
                 <div *ngIf="showTopLeftPanel" class="pjDoc">
                     <div style="height:100%;">
-                        <img title="{{document.title}}" id="thumnails_img" *ngFor="let document of signatureBook.documents; let i = index" (click)="changeLeftViewer(i)" [src]="document.thumbnailLink"
+                        <img title="{{document.title}}" id="thumnails_img" *ngFor="let document of signatureBook.documents; let i = index" (click)="changeLeftViewer(i)" [src]="coreUrl + document.thumbnailLink"
                                  class="leftPanelThumbnails" [ngClass]="{'panelSelectedThumbnail': i == leftSelectedThumbnail}"/>
                     </div>
                 </div>
diff --git a/apps/maarch_entreprise/class/class_lists_Abstract.php b/apps/maarch_entreprise/class/class_lists_Abstract.php
index 7d5948d5c6d46756b901093d903a43b659fcb08d..88a31edf400c7f6d2382eb8ebd623ecb762ed632 100755
--- a/apps/maarch_entreprise/class/class_lists_Abstract.php
+++ b/apps/maarch_entreprise/class/class_lists_Abstract.php
@@ -1190,7 +1190,7 @@ abstract class lists_Abstract extends Database
         }
 
         $href = $this->_buildMyLink($this->params['viewDocumentLink'], $resultTheLine, $listKey);
-        if ($core->is_module_loaded('thumbnails') === true && !$isAttachment) {
+        if (!$isAttachment) {
             $return .= '<div align="center" class="iconDoc" onmouseover="displayThumbnail(\''.$res_id.'\')"><a href="'.$href.'" target="_blank" title="'
                     ._VIEW_DOC.'"><i class="tooltip fa fa-download fa-2x" title="'._VISUALIZE.'"></i><span id="thumb_'.$res_id.'" name="thumb_'.$res_id.'"></span></a></div>';
         } else {
diff --git a/apps/maarch_entreprise/css/styles.css b/apps/maarch_entreprise/css/styles.css
index 87e093da58f65072f13e38e93dc0d7bf933993ad..d482657ec571bc1a17de7f5425b8d715dbe0185f 100755
--- a/apps/maarch_entreprise/css/styles.css
+++ b/apps/maarch_entreprise/css/styles.css
@@ -3733,3 +3733,25 @@ width:auto;
 .typeahead__list {
     min-width: 150px !important;
 }
+.iconDoc span {
+    display: none;
+}
+.iconDoc:hover span {
+    display: block;
+    position:fixed;
+    left:10px;
+    top:10px;
+    -moz-box-shadow: 0px 0px 5px 0px #656565;
+    -webkit-box-shadow: 0px 0px 5px 0px #656565;
+    -o-box-shadow: 0px 0px 5px 0px #656565;
+    box-shadow: 0px 0px 5px 0px #656565;
+    filter:progid:DXImageTransform.Microsoft.Shadow(color=#656565, Direction=NaN, Strength=5);
+    z-index:100;
+    height:auto;
+    width:auto;
+}
+
+.iconDoc:hover span img {
+    height:auto;
+    width:auto;
+}
diff --git a/apps/maarch_entreprise/img/noThumbnail.png b/apps/maarch_entreprise/img/noThumbnail.png
new file mode 100644
index 0000000000000000000000000000000000000000..2e865dcf63e0afb0acc95a766b08b88eb8e8f7f8
Binary files /dev/null and b/apps/maarch_entreprise/img/noThumbnail.png differ
diff --git a/apps/maarch_entreprise/smartphone/details.php b/apps/maarch_entreprise/smartphone/details.php
index ad341f18ca841c170e7ce7e76b5b74381989afc7..1204347afed0b882bdca40cc617df86821e70e82 100755
--- a/apps/maarch_entreprise/smartphone/details.php
+++ b/apps/maarch_entreprise/smartphone/details.php
@@ -146,44 +146,18 @@ foreach (array_keys($data) as $key) {
     }
 }
 
-require_once 'modules'.DIRECTORY_SEPARATOR.'thumbnails'.DIRECTORY_SEPARATOR
-            .'class'.DIRECTORY_SEPARATOR
-            .'class_modules_tools.php';
-
 $getAttach = '';
 
-$tnl = new thumbnails();
-
 $db = new Database();
-if (isset($_REQUEST['res_id_master'])) {
-    //$ac->getCorrespondingPdf($att_id);
-    require_once 'modules/attachments/class/attachments_controler.php';
-    $ac = new attachments_controler();
-    $infos_attach = $ac->getAttachmentInfos($att_id);
-    $pdf_id = $ac->getCorrespondingPdf($att_id);
-    //echo "pdf : ".$pdf_id;
-
-    $path = $tnl->getPathTnl($s_id, $coll_id);
-    if (!is_file($path)) {
-        $path = $tnl->generateTnl($s_id, $coll_id);
-    }
-
-    $path = $tnl->getPathTnl($pdf_id, $coll_id, 'res_attachments');
-    $getAttach = '&res_id_attach='.$pdf_id;
-
-    if (!is_file($path)) {
-        $path = $tnl->generateTnl($pdf_id, $coll_id, 'res_attachments');
-    }
-} else {
-    $path = $tnl->getPathTnl($s_id, $coll_id);
-    if (!is_file($path)) {
-        $path = $tnl->generateTnl($s_id, $coll_id);
-    }
-}
+$tnlAdr = \Resource\models\AdrModel::getTypedDocumentAdrByResId([
+    'select'    => [1],
+    'resId'     => $s_id,
+    'type'      => 'TNL'
+]);
 ?>
 <div id="details" title="Détails" class="panel">
     <?php
-        if (!is_file($path)) {
+        if (empty($tnlAdr)) {
             echo 'pdf : '.$pdf_id; ?>
     <div align="center">
         <input type="button" class="whiteButton" value="<?php 
@@ -193,11 +167,8 @@ if (isset($_REQUEST['res_id_master'])) {
 
         } else {
             ?>
-    <!--<img style="width:90%;" src="<?php echo $_SESSION['config']['businessappurl'].'index.php?page=doc_thumb&module=thumbnails&res_id='.$s_id.'&coll_id=letterbox_coll&display=true'; ?>" onclick="window.open('
-    <?php echo $fileUrl; ?>', '_blank');"/>-->
-
     <div id="frameThumb">
-        <iframe id="ifrm" frameborder="0" scrolling="no" width="0" height="0" src="<?php echo $_SESSION['config']['businessappurl'].'index.php?page=doc_thumb_frame&body_loaded&module=thumbnails&res_id='.$s_id.'&coll_id=letterbox_coll'.$getAttach; ?>"></iframe>
+        <iframe id="ifrm" frameborder="0" scrolling="no" width="0" height="0" src="<?php echo '../../../rest/res/'.$s_id.'/thumbnail' ?>"></iframe>
     </div>
 
     <?php
@@ -242,10 +213,6 @@ if (isset($_REQUEST['res_id_master'])) {
                     <i class="fa fa-hand-point-up fa-2x mCdarkGrey" aria-hidden="true"></i>
                 </span>
             </a>
-
-            <span class="bubble" style="cursor: pointer;margin-right: 5px;" onclick="switchFrame('<?php functions::xecho($_SESSION['config']['businessappurl'].'index.php?page=doc_thumb_frame&body_loaded&module=thumbnails'); ?>',<?php functions::xecho($s_id); ?>,<?php functions::xecho($pdf_id); ?>);">
-                <i class="fa fa-retweet fa-2x mCdarkGrey"></i>
-            </span>
             <input type="hidden" id="type_doc_show" value="attach" />
             <?php
 
diff --git a/apps/maarch_entreprise/xml/IVS/requests_definitions.xml b/apps/maarch_entreprise/xml/IVS/requests_definitions.xml
index 4a168743a85d59fb846572a0e5a3369ac5f11471..7bb867b8b38e3b07cb88ce3305ae1cd88ce6cf10 100755
--- a/apps/maarch_entreprise/xml/IVS/requests_definitions.xml
+++ b/apps/maarch_entreprise/xml/IVS/requests_definitions.xml
@@ -591,7 +591,6 @@
     <xi:include href="../../../../modules/sendmail/xml/IVS/requests_definitions.xml"/>
     <xi:include href="../../../../modules/tags/xml/IVS/requests_definitions.xml"/>
     <xi:include href="../../../../modules/templates/xml/IVS/requests_definitions.xml"/>
-    <xi:include href="../../../../modules/thumbnails/xml/IVS/requests_definitions.xml"/>
     <xi:include href="../../../../modules/visa/xml/IVS/requests_definitions.xml"/>
     <xi:include href="../../../../modules/avis/xml/IVS/requests_definitions.xml"/>
     <xi:include href="../../../../modules/thesaurus/xml/IVS/requests_definitions.xml"/>
@@ -623,7 +622,6 @@
     <xi:include href="../../../../modules/sendmail/xml/IVS/validation_rules.xml"/>
     <xi:include href="../../../../modules/tags/xml/IVS/validation_rules.xml"/>
     <xi:include href="../../../../modules/templates/xml/IVS/validation_rules.xml"/>
-    <xi:include href="../../../../modules/thumbnails/xml/IVS/validation_rules.xml"/>
     <xi:include href="../../../../modules/visa/xml/IVS/validation_rules.xml"/>
     <xi:include href="../../../../modules/avis/xml/IVS/validation_rules.xml"/>
     <xi:include href="../../../../modules/thesaurus/xml/IVS/validation_rules.xml"/>
@@ -655,7 +653,6 @@
     <xi:include href="../../../../modules/sendmail/xml/IVS/data_types.xml"/>
     <xi:include href="../../../../modules/tags/xml/IVS/data_types.xml"/>
     <xi:include href="../../../../modules/templates/xml/IVS/data_types.xml"/>
-    <xi:include href="../../../../modules/thumbnails/xml/IVS/data_types.xml"/>
     <xi:include href="../../../../modules/visa/xml/IVS/data_types.xml"/>
     <xi:include href="../../../../modules/avis/xml/IVS/data_types.xml"/>
     <xi:include href="../../../../modules/thesaurus/xml/IVS/data_types.xml"/>
diff --git a/apps/maarch_entreprise/xml/config.xml.default b/apps/maarch_entreprise/xml/config.xml.default
index cab1d4cb99ab1ec7bd61202465a634f08e2392e1..821a48a829ce06b9b8f988d89f60a11c31337e89 100755
--- a/apps/maarch_entreprise/xml/config.xml.default
+++ b/apps/maarch_entreprise/xml/config.xml.default
@@ -291,10 +291,6 @@
     <MODULES>
         <moduleid>sendmail</moduleid>
         <comment>_SENDMAIL_COMMENT</comment>
-    </MODULES>
-    <MODULES>
-        <moduleid>thumbnails</moduleid>
-        <comment>_THUMBNAILS_COMMENT</comment>
     </MODULES>
 	<MODULES>
         <moduleid>visa</moduleid>
diff --git a/core/class/LinkController.php b/core/class/LinkController.php
index b7295264fb2558e46d4933a18edb30d79ae9d4f6..828c85a84825629ac6b22e1c2aefc0bd4611d176 100755
--- a/core/class/LinkController.php
+++ b/core/class/LinkController.php
@@ -118,19 +118,7 @@ class LinkController
                     $delChild = $key;
                 }
                 $return .= '<td align="right">';
-                if ($core->is_module_loaded('thumbnails') === true) {
-                    require_once 'modules'.DIRECTORY_SEPARATOR.'thumbnails'.DIRECTORY_SEPARATOR
-                                .'class'.DIRECTORY_SEPARATOR
-                                .'class_modules_tools.php';
-
-                    $tnl = new thumbnails();
-                    $path = $tnl->getPathTnl($key, 'letterbox_coll');
-                    if (is_file($path)) {
-                        $return .= '<div align="center" class="iconDoc"><a href="index.php?display=true&dir=indexing_searching&page=view_resource_controler&id='.$key.'" target="_blank" title="'._VIEW_DOC.'"><i class="fa fa-download fa-2x" title="'._VIEW_DOC.'"></i><span><img src="index.php?page=doc_thumb&module=thumbnails&res_id='.$key.'&coll_id=letterbox_coll&display=true"></span></a></div>';
-                    } else {
-                        $return .= '<div align="center" class="iconDoc"><a href="index.php?display=true&dir=indexing_searching&page=view_resource_controler&id='.$key.'" target="_blank" title="'._VIEW_DOC.'"><i class="fa fa-download fa-2x" title="'._VIEW_DOC.'"></i><span id="no_doc"></span></a></div>';
-                    }
-                }
+                $return .= '<div align="center" class="iconDoc"><a href="index.php?display=true&dir=indexing_searching&page=view_resource_controler&id='.$key.'" target="_blank" title="'._VIEW_DOC.'"><i class="fa fa-download fa-2x" title="'._VIEW_DOC.'"></i><span><img src="../../rest/res/'.$key.'/thumbnail"></span></a></div>';
                 $return .= '</td>';
                 $return .= '<td align="right">';
                 $return .= '<span onclick="';
diff --git a/install/class/Class_Install.php b/install/class/Class_Install.php
index aff28df4ac67c93c5f5b69bcca78dea841219084..0575a35bc8e05fdcfa3cbfd0476ed6680e0ddd3f 100755
--- a/install/class/Class_Install.php
+++ b/install/class/Class_Install.php
@@ -125,9 +125,9 @@ class Install extends functions
         if (!$this->isPhpRequirements('gd')) {
             return false;
         }
-        /*if (!$this->isPhpRequirements('imagick')) {
+        if (!$this->isPhpRequirements('imagick')) {
             return false;
-        }*/
+        }
         /*if (!$this->isPhpRequirements('ghostscript')) {
             return false;
         }*/
@@ -323,16 +323,6 @@ class Install extends functions
                 $cheminCustomMaarchCourrierModules = realpath('.')."/custom/cs_$databasename/modules";
                 mkdir($cheminCustomMaarchCourrierModules, 0755);
 
-                /** Création répertoire thumbnails dans le custom **/
-                $cheminCustomMaarchCourrierModulesThumbnails = realpath('.')."/custom/cs_$databasename/modules/thumbnails";
-                mkdir($cheminCustomMaarchCourrierModulesThumbnails, 0755);
-
-                $cheminCustomMaarchCourrierModulesThumbnailsXml = realpath('.')."/custom/cs_$databasename/modules/thumbnails/xml";
-                mkdir($cheminCustomMaarchCourrierModulesThumbnailsXml, 0755);
-
-                $cheminCustomMaarchCourrierModulesThumbnailsScripts = realpath('.')."/custom/cs_$databasename/modules/thumbnails/scripts";
-                mkdir($cheminCustomMaarchCourrierModulesThumbnailsScripts, 0755);
-
                 /** Création répertoire notification dans le custom **/
                 $cheminCustomMaarchCourrierModulesNotifications = realpath('.')."/custom/cs_$databasename/modules/notifications";
                 mkdir($cheminCustomMaarchCourrierModulesNotifications, 0755);
@@ -381,22 +371,8 @@ class Install extends functions
             }
 
             if (is_dir(realpath('.')."/custom/cs_$databasename/modules/")) {
-                /* Création répertoire thumbnails dans le custom **/
-
-                if (!is_dir(realpath('.')."/custom/cs_$databasename/modules/thumbnails/")) {
-                    $cheminCustomMaarchCourrierModulesThumbnails = realpath('.')."/custom/cs_$databasename/modules/thumbnails";
-                    mkdir($cheminCustomMaarchCourrierModulesThumbnails, 0755);
-                }
-                if (!is_dir(realpath('.')."/custom/cs_$databasename/modules/thumbnails/xml/")) {
-                    $cheminCustomMaarchCourrierModulesThumbnailsXml = realpath('.')."/custom/cs_$databasename/modules/thumbnails/xml";
-                    mkdir($cheminCustomMaarchCourrierModulesThumbnailsXml, 0755);
-                }
-                if (!is_dir(realpath('.')."/custom/cs_$databasename/modules/thumbnails/scripts/")) {
-                    $cheminCustomMaarchCourrierModulesThumbnailsScripts = realpath('.')."/custom/cs_$databasename/modules/thumbnails/scripts";
-                    mkdir($cheminCustomMaarchCourrierModulesThumbnailsScripts, 0755);
-                }
 
-                /* Création répertoire thumbnails dans le custom **/
+                /* Création répertoire notif dans le custom **/
                 if (!is_dir(realpath('.')."/custom/cs_$databasename/modules/notifications/")) {
                     $cheminCustomMaarchCourrierModulesNotifications = realpath('.')."/custom/cs_$databasename/modules/notifications/";
                     mkdir($cheminCustomMaarchCourrierModulesNotifications, 0755);
@@ -414,7 +390,7 @@ class Install extends functions
                     mkdir($cheminCustomMaarchCourrierModulesNotificationsScripts, 0755);
                 }
 
-                /* Création répertoire thumbnails dans le custom **/
+                /* Création répertoire sendmail dans le custom **/
                 if (!is_dir(realpath('.')."/custom/cs_$databasename/modules/sendmail/")) {
                     $cheminCustomMaarchCourrierModulesSendmail = realpath('.')."/custom/cs_$databasename/modules/sendmail";
                     mkdir($cheminCustomMaarchCourrierModulesSendmail, 0755);
@@ -568,16 +544,6 @@ class Install extends functions
             $cheminCustomMaarchCourrierModules = realpath('.')."/custom/cs_$databasename/modules";
             mkdir($cheminCustomMaarchCourrierModules, 0755);
 
-            /** Création répertoire thumbnails dans le custom **/
-            $cheminCustomMaarchCourrierModulesThumbnails = realpath('.')."/custom/cs_$databasename/modules/thumbnails";
-            mkdir($cheminCustomMaarchCourrierModulesThumbnails, 0755);
-
-            $cheminCustomMaarchCourrierModulesThumbnailsXml = realpath('.')."/custom/cs_$databasename/modules/thumbnails/xml";
-            mkdir($cheminCustomMaarchCourrierModulesThumbnailsXml, 0755);
-
-            $cheminCustomMaarchCourrierModulesThumbnailsScripts = realpath('.')."/custom/cs_$databasename/modules/thumbnails/scripts";
-            mkdir($cheminCustomMaarchCourrierModulesThumbnailsScripts, 0755);
-
             /** Création répertoire notification dans le custom **/
             $cheminCustomMaarchCourrierModulesNotifications = realpath('.')."/custom/cs_$databasename/modules/notifications";
             mkdir($cheminCustomMaarchCourrierModulesNotifications, 0755);
@@ -782,18 +748,6 @@ class Install extends functions
         $connect .= 'password='.$_SESSION['config']['databasepassword'].' ';
         $connect .= 'dbname=postgres';
 
-        if (!$this->setConfigXmlThumbnails()) {
-            return false;
-            exit;
-        }
-        if (!$this->setConfig_batch_XmlThumbnails()) {
-            return false;
-            exit;
-        }
-        if (!$this->setConfigScriptLaunchThumbnails()) {
-            return false;
-            exit;
-        }
         if (!$this->setConfig_sendmail()) {
             return false;
             exit;
@@ -911,18 +865,6 @@ class Install extends functions
             exit;
         }
 
-        if (!$this->setConfigXmlThumbnails()) {
-            return false;
-            exit;
-        }
-        if (!$this->setConfig_batch_XmlThumbnails()) {
-            return false;
-            exit;
-        }
-        if (!$this->setConfigScriptLaunchThumbnails()) {
-            return false;
-            exit;
-        }
         if (!$this->setConfig_sendmail()) {
             return false;
             exit;
@@ -1033,10 +975,6 @@ class Install extends functions
 ####################################################################################
 
 
-######################THUMBNAILS####################################################
-*/5 5-21 * * 1-5       '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/thumbnails/scripts/launch_batch_thumbnails.sh
-15 12 * * 0        rm -Rf '.realpath('.').'/modules/thumbnails/log/*.log
-
 ######################notification#################################################
 
 15 10 * * *     '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/notifications/batch/scripts/nct-ncc-and-anc.sh
@@ -1148,95 +1086,6 @@ class Install extends functions
     //     return true;
     // }
 
-    private function setConfigXmlThumbnails()
-    {
-        //var_dump("setConfigXmlThumbnails");
-        $xmlconfig = simplexml_load_file('modules/thumbnails/xml/config.xml.default');
-        //$xmlconfig = 'apps/maarch_entreprise/xml/config.xml.default';
-        $CONFIG = $xmlconfig->CONFIG;
-
-        $CONFIG->docserver_id = 'TNL';
-        $chemin_no_file = realpath('.').'/modules/thumbnails/no_thumb.png';
-        $CONFIG->no_file = $chemin_no_file;
-        $res = $xmlconfig->asXML();
-        $fp = @fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/thumbnails/xml/config.xml', 'w+');
-        if (!$fp) {
-            return false;
-            exit;
-        }
-        $write = fwrite($fp, $res);
-        if (!$write) {
-            return false;
-            exit;
-        }
-
-        return true;
-    }
-
-    private function setConfig_batch_XmlThumbnails()
-    {
-        $xmlconfig = simplexml_load_file('modules/thumbnails/xml/config_batch_letterbox.xml.default');
-
-        $CONFIG = $xmlconfig->CONFIG;
-
-        $chemin_core = realpath('.').'/core/';
-
-        $CONFIG->MaarchDirectory = realpath('.').'/';
-
-        $CONFIG_BASE = $xmlconfig->CONFIG_BASE;
-        $CONFIG_BASE->databaseserver = $_SESSION['config']['databaseserver'];
-        $CONFIG_BASE->databaseserverport = $_SESSION['config']['databaseserverport'];
-        $CONFIG_BASE->databasename = $_SESSION['config']['databasename'];
-        $CONFIG_BASE->databaseuser = $_SESSION['config']['databaseuser'];
-        $CONFIG_BASE->databasepassword = $_SESSION['config']['databasepassword'];
-
-        $LOG4PHP = $xmlconfig->LOG4PHP;
-        $LOG4PHP->Log4PhpConfigPath = realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/apps/maarch_entreprise/xml/log4php.xml';
-
-        $res = $xmlconfig->asXML();
-        $fp = @fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/thumbnails/xml/config_batch_letterbox.xml', 'w+');
-        if (!$fp) {
-            return false;
-            exit;
-        }
-
-        $write = fwrite($fp, $res);
-        if (!$write) {
-            return false;
-            exit;
-        }
-        $xmlconfig = simplexml_load_file('modules/thumbnails/xml/config_batch_attachments.xml.default');
-
-        $CONFIG = $xmlconfig->CONFIG;
-
-        $chemin_core = realpath('.').'/core/';
-
-        $CONFIG->MaarchDirectory = realpath('.').'/';
-
-        $CONFIG_BASE = $xmlconfig->CONFIG_BASE;
-        $CONFIG_BASE->databaseserver = $_SESSION['config']['databaseserver'];
-        $CONFIG_BASE->databaseserverport = $_SESSION['config']['databaseserverport'];
-        $CONFIG_BASE->databasename = $_SESSION['config']['databasename'];
-        $CONFIG_BASE->databaseuser = $_SESSION['config']['databaseuser'];
-        $CONFIG_BASE->databasepassword = $_SESSION['config']['databasepassword'];
-
-        $LOG4PHP = $xmlconfig->LOG4PHP;
-        $LOG4PHP->Log4PhpConfigPath = realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/apps/maarch_entreprise/xml/log4php.xml';
-
-        $res = $xmlconfig->asXML();
-        $fp = @fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/thumbnails/xml/config_batch_attachments.xml', 'w+');
-        if (!$fp) {
-            return false;
-            exit;
-        }
-        $write = fwrite($fp, $res);
-        if (!$write) {
-            return false;
-            exit;
-        }
-
-        return true;
-    }
 
     private function setConfig_batch_XmlNotifications()
     {
@@ -1666,52 +1515,6 @@ class Install extends functions
         return true;
     }
 
-    private function setConfigScriptLaunchThumbnails()
-    {
-        if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
-            $res = 'cd '.realpath('.')."\modules\\thumbnails\\";
-            $res .= "\n";
-            $res .= '"'.realpath('.').'\..\..\php\php.exe" '.realpath('.').'\modules\\thumbnails\create_tnl.php  '.realpath('.')."\custom\cs_".$_SESSION['config']['databasename'].'\modules\\thumbnails\xml\config_batch_letterbox.xml';
-            $res .= "\n";
-            $res .= '"'.realpath('.').'\..\..\php\php.exe" '.realpath('.').'\modules\\thumbnails\create_tnl.php  '.realpath('.')."\custom\cs_".$_SESSION['config']['databasename'].'\modules\\thumbnails\xml\config_batch_attachments.xml';
-            $res .= "\n";
-
-            $fp = @fopen(realpath('.')."\custom\cs_".$_SESSION['config']['databasename']."\modules\\thumbnails\scripts\launch_batch_thumbnails.bat", 'w+');
-            if (!$fp) {
-                return false;
-                exit;
-            }
-            $write = fwrite($fp, $res);
-            if (!$write) {
-                return false;
-                exit;
-            }
-
-            return true;
-        } elseif (strtoupper(substr(PHP_OS, 0, 3)) === 'LIN') {
-            $res = '#!/bin/bash';
-            $res .= "\n\n";
-            $res .= 'cd '.realpath('.').'/modules/thumbnails/';
-            $res .= "\n\n";
-            $res .= 'php '.realpath('.').'/modules/thumbnails/create_tnl.php '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/thumbnails/xml/config_batch_letterbox.xml';
-            $res .= "\n\n";
-            $res .= 'php '.realpath('.').'/modules/thumbnails/create_tnl.php '.realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/thumbnails/xml/config_batch_attachments.xml';
-
-            $fp = @fopen(realpath('.').'/custom/cs_'.$_SESSION['config']['databasename'].'/modules/thumbnails/scripts/launch_batch_thumbnails.sh', 'w+');
-            if (!$fp) {
-                return false;
-                exit;
-            }
-            $write = fwrite($fp, $res);
-            if (!$write) {
-                return false;
-                exit;
-            }
-
-            return true;
-        }
-    }
-
     private function setScriptNotificationNctNccAndAncSh()
     {
         if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
diff --git a/modules/attachments/attachments_content.php b/modules/attachments/attachments_content.php
index 060cc51c58dc503c909fa95194ae6465e5b639de..3594038c90a0a858a8972a459cdf1299b396a682 100755
--- a/modules/attachments/attachments_content.php
+++ b/modules/attachments/attachments_content.php
@@ -318,28 +318,6 @@ if (isset($_POST['add']) && $_POST['add']) {
                                     $_SESSION['data'],
                                     $_SESSION['config']['databasetype']
                                 );
-                                if ($attachment_types == 'outgoing_mail') {
-                                    $extDocument = \Resource\models\ResModel::getExtById(['select' => ['category_id'], 'resId' => $_SESSION['doc_id']]);
-
-                                    if ($extDocument['category_id'] == 'outgoing') {
-                                        $attachment = \Attachment\models\AttachmentModel::getOnView([
-                                            'select'    => ['res_id'],
-                                            'where'     => ['res_id_master = ?', 'attachment_type = ?', 'status not in (?)'],
-                                            'data'      => [$_SESSION['doc_id'], 'outgoing_mail', ['DEL', 'OBS']],
-                                            'limit'     => 1
-                                        ]);
-                                        if (!empty($attachment[0]) && $attachment[0]['res_id'] == $id) {
-                                            \Resource\models\AdrModel::deleteDocumentAdr(['where' => ['res_id = ?', 'type = ?'], 'data' => [$_SESSION['doc_id'], 'TNL']]);
-                                            \Resource\controllers\ConvertThumbnailController::convert([
-                                                'collId'            => 'letterbox_coll',
-                                                'resId'             => $_SESSION['doc_id'],
-                                                'outgoingId'        => $id,
-                                                'isOutgoingVersion' => false
-                                            ]);
-                                        }
-                                    }
-
-                                }
 
                                 //copie de la version PDF de la pièce si mode de conversion sur le client
                                 if ($_SESSION['upfile'][$numAttach]['fileNamePdfOnTmp'] != '' && empty($templateOffice)) {
@@ -814,27 +792,6 @@ if (isset($_POST['add']) && $_POST['add']) {
             } else {
                 $stmt = $db->query("UPDATE res_version_attachments SET status = 'OBS' WHERE res_id = ?", array($previous_attachment->res_id_version));
             }
-            if ($previous_attachment->attachment_type == 'outgoing_mail') {
-                $extDocument = \Resource\models\ResModel::getExtById(['select' => ['category_id'], 'resId' => $_SESSION['doc_id']]);
-
-                if ($extDocument['category_id'] == 'outgoing') {
-                    $attachment = \Attachment\models\AttachmentModel::getOnView([
-                        'select'    => ['res_id', 'res_id_version'],
-                        'where'     => ['res_id_master = ?', 'attachment_type = ?', 'status not in (?)'],
-                        'data'      => [$_SESSION['doc_id'], 'outgoing_mail', ['DEL', 'OBS']],
-                        'limit'     => 1
-                    ]);
-                    if (!empty($attachment[0]) && ($attachment[0]['res_id'] == $previous_attachment->res_id || $attachment[0]['res_id_version'] == $previous_attachment->res_id_version)) {
-                        \Resource\models\AdrModel::deleteDocumentAdr(['where' => ['res_id = ?', 'type = ?'], 'data' => [$_SESSION['doc_id'], 'TNL']]);
-                        \Resource\controllers\ConvertThumbnailController::convert([
-                            'collId'            => 'letterbox_coll',
-                            'resId'             => $_SESSION['doc_id'],
-                            'outgoingId'        => $id,
-                            'isOutgoingVersion' => true
-                        ]);
-                    }
-                }
-            }
         }
     } else {
         $is_new_version = false;
@@ -942,27 +899,6 @@ if (isset($_POST['add']) && $_POST['add']) {
         } else {
             $stmt = $db->query('UPDATE res_version_attachments SET '.$set_update.' WHERE res_id = :res_id', $arrayPDO);
         }
-        if ($_SESSION['upfile'][0]['upAttachment'] != false) {
-            $attachment = \Attachment\models\AttachmentModel::getOnView([
-                'select'    => ['res_id', 'res_id_version', 'attachment_type'],
-                'where'     => ['res_id_master = ?', 'attachment_type = ?', 'status not in (?)'],
-                'data'      => [$_SESSION['doc_id'], 'outgoing_mail', ['DEL', 'OBS']],
-                'limit'     => 1
-            ]);
-            if (!empty($attachment[0]) && in_array($_REQUEST['res_id'], [$attachment[0]['res_id'], $attachment[0]['res_id_version']])) {
-                $extDocument = \Resource\models\ResModel::getExtById(['select' => ['category_id'], 'resId' => $_SESSION['doc_id']]);
-
-                if ($extDocument['category_id'] == 'outgoing') {
-                    \Resource\models\AdrModel::deleteDocumentAdr(['where' => ['res_id = ?', 'type = ?'], 'data' => [$_SESSION['doc_id'], 'TNL']]);
-                    \Resource\controllers\ConvertThumbnailController::convert([
-                        'collId'            => 'letterbox_coll',
-                        'resId'             => $_SESSION['doc_id'],
-                        'outgoingId'        => $id,
-                        'isOutgoingVersion' => ($_REQUEST['relation'] != 1)
-                    ]);
-                }
-            }
-        }
     }
     //copie de la version PDF de la pièce si mode de conversion sur le client
     if ($_SESSION['modules_loaded']['attachments']['convertPdf'] == true && $_SESSION['upfile'][0]['fileNamePdfOnTmp'] != '' && empty($error) && $_SESSION['upfile'][0]['upAttachment'] != false) {
diff --git a/modules/thumbnails/LICENSE.txt b/modules/thumbnails/LICENSE.txt
deleted file mode 100755
index 10926e87f113fb026c366866d6fa466061562870..0000000000000000000000000000000000000000
--- a/modules/thumbnails/LICENSE.txt
+++ /dev/null
@@ -1,675 +0,0 @@
-                    GNU GENERAL PUBLIC LICENSE
-                       Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-                            Preamble
-
-  The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
-  The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works.  By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users.  We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors.  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
-  To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights.  Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received.  You must make sure that they, too, receive
-or can get the source code.  And you must show them these terms so they
-know their rights.
-
-  Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
-  For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software.  For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
-  Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so.  This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software.  The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable.  Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products.  If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
-  Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary.  To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-                       TERMS AND CONDITIONS
-
-  0. Definitions.
-
-  "This License" refers to version 3 of the GNU General Public License.
-
-  "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
-  "The Program" refers to any copyrightable work licensed under this
-License.  Each licensee is addressed as "you".  "Licensees" and
-"recipients" may be individuals or organizations.
-
-  To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy.  The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
-  A "covered work" means either the unmodified Program or a work based
-on the Program.
-
-  To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy.  Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
-  To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies.  Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
-  An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License.  If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
-  1. Source Code.
-
-  The "source code" for a work means the preferred form of the work
-for making modifications to it.  "Object code" means any non-source
-form of a work.
-
-  A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
-  The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form.  A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
-  The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities.  However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work.  For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
-  The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
-  The Corresponding Source for a work in source code form is that
-same work.
-
-  2. Basic Permissions.
-
-  All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met.  This License explicitly affirms your unlimited
-permission to run the unmodified Program.  The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work.  This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
-  You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force.  You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright.  Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
-  Conveying under any other circumstances is permitted solely under
-the conditions stated below.  Sublicensing is not allowed; section 10
-makes it unnecessary.
-
-  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
-  No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
-  When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
-  4. Conveying Verbatim Copies.
-
-  You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
-  You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
-  5. Conveying Modified Source Versions.
-
-  You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
-    a) The work must carry prominent notices stating that you modified
-    it, and giving a relevant date.
-
-    b) The work must carry prominent notices stating that it is
-    released under this License and any conditions added under section
-    7.  This requirement modifies the requirement in section 4 to
-    "keep intact all notices".
-
-    c) You must license the entire work, as a whole, under this
-    License to anyone who comes into possession of a copy.  This
-    License will therefore apply, along with any applicable section 7
-    additional terms, to the whole of the work, and all its parts,
-    regardless of how they are packaged.  This License gives no
-    permission to license the work in any other way, but it does not
-    invalidate such permission if you have separately received it.
-
-    d) If the work has interactive user interfaces, each must display
-    Appropriate Legal Notices; however, if the Program has interactive
-    interfaces that do not display Appropriate Legal Notices, your
-    work need not make them do so.
-
-  A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit.  Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
-  6. Conveying Non-Source Forms.
-
-  You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
-    a) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by the
-    Corresponding Source fixed on a durable physical medium
-    customarily used for software interchange.
-
-    b) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by a
-    written offer, valid for at least three years and valid for as
-    long as you offer spare parts or customer support for that product
-    model, to give anyone who possesses the object code either (1) a
-    copy of the Corresponding Source for all the software in the
-    product that is covered by this License, on a durable physical
-    medium customarily used for software interchange, for a price no
-    more than your reasonable cost of physically performing this
-    conveying of source, or (2) access to copy the
-    Corresponding Source from a network server at no charge.
-
-    c) Convey individual copies of the object code with a copy of the
-    written offer to provide the Corresponding Source.  This
-    alternative is allowed only occasionally and noncommercially, and
-    only if you received the object code with such an offer, in accord
-    with subsection 6b.
-
-    d) Convey the object code by offering access from a designated
-    place (gratis or for a charge), and offer equivalent access to the
-    Corresponding Source in the same way through the same place at no
-    further charge.  You need not require recipients to copy the
-    Corresponding Source along with the object code.  If the place to
-    copy the object code is a network server, the Corresponding Source
-    may be on a different server (operated by you or a third party)
-    that supports equivalent copying facilities, provided you maintain
-    clear directions next to the object code saying where to find the
-    Corresponding Source.  Regardless of what server hosts the
-    Corresponding Source, you remain obligated to ensure that it is
-    available for as long as needed to satisfy these requirements.
-
-    e) Convey the object code using peer-to-peer transmission, provided
-    you inform other peers where the object code and Corresponding
-    Source of the work are being offered to the general public at no
-    charge under subsection 6d.
-
-  A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
-  A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling.  In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage.  For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product.  A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
-  "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source.  The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
-  If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information.  But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
-  The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed.  Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
-  Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
-  7. Additional Terms.
-
-  "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law.  If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
-  When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it.  (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.)  You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
-  Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
-    a) Disclaiming warranty or limiting liability differently from the
-    terms of sections 15 and 16 of this License; or
-
-    b) Requiring preservation of specified reasonable legal notices or
-    author attributions in that material or in the Appropriate Legal
-    Notices displayed by works containing it; or
-
-    c) Prohibiting misrepresentation of the origin of that material, or
-    requiring that modified versions of such material be marked in
-    reasonable ways as different from the original version; or
-
-    d) Limiting the use for publicity purposes of names of licensors or
-    authors of the material; or
-
-    e) Declining to grant rights under trademark law for use of some
-    trade names, trademarks, or service marks; or
-
-    f) Requiring indemnification of licensors and authors of that
-    material by anyone who conveys the material (or modified versions of
-    it) with contractual assumptions of liability to the recipient, for
-    any liability that these contractual assumptions directly impose on
-    those licensors and authors.
-
-  All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10.  If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term.  If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
-  If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
-  Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
-  8. Termination.
-
-  You may not propagate or modify a covered work except as expressly
-provided under this License.  Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
-  However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
-  Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
-  Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License.  If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
-  9. Acceptance Not Required for Having Copies.
-
-  You are not required to accept this License in order to receive or
-run a copy of the Program.  Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance.  However,
-nothing other than this License grants you permission to propagate or
-modify any covered work.  These actions infringe copyright if you do
-not accept this License.  Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
-  10. Automatic Licensing of Downstream Recipients.
-
-  Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License.  You are not responsible
-for enforcing compliance by third parties with this License.
-
-  An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations.  If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
-  You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License.  For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
-  11. Patents.
-
-  A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based.  The
-work thus licensed is called the contributor's "contributor version".
-
-  A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version.  For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
-  Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
-  In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement).  To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
-  If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients.  "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
-  If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
-  A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License.  You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
-  Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
-  12. No Surrender of Others' Freedom.
-
-  If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all.  For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
-  13. Use with the GNU Affero General Public License.
-
-  Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work.  The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
-  14. Revised Versions of this License.
-
-  The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-  Each version is given a distinguishing version number.  If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation.  If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
-  If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
-  Later license versions may give you additional or different
-permissions.  However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
-  15. Disclaimer of Warranty.
-
-  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-  16. Limitation of Liability.
-
-  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
-  17. Interpretation of Sections 15 and 16.
-
-  If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
-                     END OF TERMS AND CONDITIONS
-
-            How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This program is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-Also add information on how to contact you by electronic and paper mail.
-
-  If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
-    <program>  Copyright (C) <year>  <name of author>
-    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
-  You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-<http://www.gnu.org/licenses/>.
-
-  The GNU General Public License does not permit incorporating your program
-into proprietary programs.  If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library.  If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.  But first, please read
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
-
diff --git a/modules/thumbnails/LoggerLog4php.php b/modules/thumbnails/LoggerLog4php.php
deleted file mode 100755
index 900b13489c94f5e461aa96db89b1a0808cfffa6a..0000000000000000000000000000000000000000
--- a/modules/thumbnails/LoggerLog4php.php
+++ /dev/null
@@ -1,314 +0,0 @@
-<?php
-
-/** Logger class
- *
- * @author Laurent Giovannoni <dev@maarch.org>
- **/
-
-class Logger4Php
-{
-
-    /**
-     * Array of errors levels
-     *
-     * @protected
-     **/
-    protected $error_levels = array('DEBUG' => 0, 'INFO' => 1, 'NOTICE' => 2, 'WARNING' => 3, 'ERROR' => 4);
-
-    /**
-     * Maps each handler with its log threshold.
-     *
-     * @protected
-     **/
-    protected $mapping;
-
-    /**
-     * Minimum log level
-     *
-     * @protected
-     **/
-    protected $threshold_level;
-
-    /**
-     * Path to log4Php library
-     *
-     * @protected
-     **/
-    protected $log4PhpLibrary;
-
-	/**
-     * Name of the logger
-     *
-     * @protected
-     **/
-    protected $log4PhpLogger;
-
-    /**
-     * Name of the business code
-     *
-     * @protected
-     **/
-    protected $log4PhpBusinessCode;
-
-    /**
-     * Path of the param of log4php
-     *
-     * @protected
-     **/
-    protected $log4PhpConfigPath;
-
-    /**
-     * Name of the batch
-     *
-     * @protected
-     **/
-    protected $log4PhpBatchName;
-
-    /** Class constructor
-     *
-     * Inits the threshold level
-     *
-     * @param $threshold_level (string) Threshold level (set to 'INFO' by default)
-     **/
-    function __construct($threshold_level = 'WARNING')
-    {
-        $this->threshold_level = $threshold_level;
-        $this->mapping = array_fill(0, count($this->error_levels), array());
-    }
-
-    /** Writes error message in current handlers
-     *
-     * writes only if the error level is greater or equal the threshold level
-     *
-     * @param $msg (string) Error message
-     * @param $error_level (string) Error level (set to 'INFO' by default)
-     * @param $error_code (integer) Error code (set to 0 by default)
-     **/
-    public function write($msg, $error_level = 'INFO', $error_code = 0, $other_params = array())
-    {
-		if (!array_key_exists($error_level, $this->error_levels)) {
-			$error_level = 'INFO';
-		}
-		$foundLogger = false;
-		if ($this->error_levels[$error_level] >= $this->error_levels[$this->threshold_level]) {
-			for ($i=$this->error_levels[$error_level];$i>=0;$i--) {
-				foreach ($this->mapping[$i] as $handler) {
-					$handler->write($msg, $error_level, $error_code, $other_params);
-					if (
-						get_class($handler) == 'FileHandler'
-						&& (isset($this->log4PhpLibrary)
-						&& !empty($this->log4PhpLibrary))
-					) {
-						if ($error_code == 0) {
-							$result = 'OK';
-						} else {
-							$result = 'KO';
-							$msg = '%error_code:' . $error_code . '% ' . $msg;
-						}
-						require_once($this->log4PhpLibrary);
-						$remote_ip = '127.0.0.1';
-						Logger::configure($this->log4PhpConfigPath);
-						$logger = Logger::getLogger($this->log4PhpLogger);
-						$searchPatterns = array('%ACCESS_METHOD%',
-							'%RESULT%',
-							'%BUSINESS_CODE%',
-							'%HOW%',
-							'%WHAT%',
-							'%REMOTE_IP%',
-							'%BATCH_NAME%'
-						);
-						$replacePatterns = array('Script',
-							$result,
-							$this->log4PhpBusinessCode,
-							'UP',
-							$msg,
-							$remote_ip,
-							$this->log4PhpBatchName
-						);
-						$logLine = str_replace($searchPatterns,
-							$replacePatterns,
-							'[%ACCESS_METHOD%][%RESULT%]'
-							. '[%BUSINESS_CODE%][%HOW%][%WHAT%][%BATCH_NAME%]'
-						);
-						$this->writeLog4php($logger, $logLine, $error_level);
-					}
-				}
-			}
-		}
-    }
-
-	/**
-	 *
-	 * write a log entry with a specific log level
-	 * @param object $logger Log4php logger
-	 * @param string $logLine Line we want to trace
-	 * @param enum $level Log level
-	 */
-	function writeLog4php($logger, $logLine, $level) {
-		switch ($level) {
-			case 'DEBUG':
-				$logger->debug($logLine);
-				break;
-			case 'INFO':
-				$logger->info($logLine);
-				break;
-			case 'WARNING':
-				$logger->warn($logLine);
-				break;
-			case 'ERROR':
-				$logger->error($logLine);
-				break;
-			case 'FATAL':
-				$logger->fatal($logLine);
-				break;
-		}
-	}
-
-    /** Adds a new handler in the current handlers array
-     *
-     * @param $handler (object) Handler object
-     **/
-    public function add_handler(&$handler, $error_level = NULL)
-    {
-        if(!isset($handler))
-            return false;
-
-        if(!isset($error_level) || !array_key_exists($error_level, $this->error_levels))
-        {
-            $error_level = $this->threshold_level;
-        }
-
-        $this->mapping[$this->error_levels[$error_level]][] = $handler;
-        return true;
-    }
-
-    /** Adds a new handler in the current handlers array
-     *
-     * @param $handler (object) Handler object
-     **/
-    public function change_handler_log_level(&$handler, $log_level )
-    {
-        if (!isset($handler) || !isset($log_level))
-            return false;
-
-        if (!array_key_exists($log_level, $this->error_levels)) {
-           return false;
-        }
-
-        for ($i=0; $i<count($this->mapping);$i++) {
-            for($j=0;$j<count($this->mapping[$i]);$j++) {
-                if($handler == $this->mapping[$i][$j]) {
-                    unset($this->mapping[$i][$j]);
-                }
-            }
-        }
-        $this->mapping = array_values($this->mapping);
-        $this->mapping[$this->error_levels[$log_level]][] = $handler;
-        return true;
-    }
-
-	/** Sets treshold level
-     *
-     * @param $treshold (string) treshold level
-     **/
-    public function set_threshold_level($treshold)
-    {
-        if (isset($treshold) && array_key_exists($treshold, $this->error_levels)) {
-            $this->threshold_level = $treshold;
-            return true;
-        }
-        $this->threshold_level = 'WARNING';
-        return false;
-    }
-
-	/** Sets log4Php library path
-     *
-     * @param $log4PhpLibrary (string) path
-     **/
-    public function set_log4PhpLibrary($log4PhpLibrary)
-    {
-        if (isset($log4PhpLibrary) && !empty($log4PhpLibrary)) {
-            if (file_exists($log4PhpLibrary)) {
-				$this->log4PhpLibrary = $log4PhpLibrary;
-				return true;
-			} else {
-				return false;
-			}
-        }
-        return false;
-    }
-
-    /** Sets log4php logger name
-     *
-     * @param $log4PhpLogger (string) logger name
-     **/
-    public function set_log4PhpLogger($log4PhpLogger)
-    {
-        if (isset($log4PhpLogger) && !empty($log4PhpLogger)) {
-            $this->log4PhpLogger = $log4PhpLogger;
-            return true;
-        }
-        $this->log4PhpLogger = 'loggerTechnique';
-        return false;
-    }
-
-	/** Sets log4php path to log4php xml config
-     *
-     * @param $log4PhpPath (string) path to log4php xml config
-     **/
-    public function set_log4PhpConfigPath($log4PhpConfigPath)
-    {
-        if (isset($log4PhpConfigPath) && !empty($log4PhpConfigPath)) {
-            if (file_exists($log4PhpConfigPath)) {
-				$this->log4PhpConfigPath = $log4PhpConfigPath;
-				return true;
-			} else {
-				return false;
-			}
-        }
-        return false;
-    }
-
-	/** Sets log4php business code
-     *
-     * @param $log4PhpBusinessCode (string) business code
-     **/
-    public function set_log4PhpBusinessCode($log4PhpBusinessCode)
-    {
-        if (isset($log4PhpBusinessCode) && !empty($log4PhpBusinessCode)) {
-			$this->log4PhpBusinessCode = $log4PhpBusinessCode;
-			return true;
-        }
-        $this->log4PhpBusinessCode = 'Maarch';
-        return false;
-    }
-
-    /** Sets log4php batch name
-     *
-     * @param $log4PhpBatchName (string) BatchName
-     **/
-    public function set_log4PhpBatchName($log4PhpBatchName)
-    {
-        if (isset($log4PhpBatchName) && !empty($log4PhpBatchName)) {
-			$this->log4PhpBatchName = $log4PhpBatchName;
-			return true;
-        }
-        $this->log4PhpBatchName = 'MaarchBatch';
-        return false;
-    }
-
-    /** Class destructor
-     *
-     * Calls handlers destructors
-     **/
-    function __destruct()
-    {
-        for($i=0; $i<count($this->mapping);$i++)
-        {
-            foreach($this->mapping[$i] as $handler)
-            {
-                unset($handler);
-            }
-        }
-    }
-}
diff --git a/modules/thumbnails/README.txt b/modules/thumbnails/README.txt
deleted file mode 100755
index 98a7a24520b31adbaf08016352e4e4ac2e9f6ecb..0000000000000000000000000000000000000000
--- a/modules/thumbnails/README.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-Pour Linux :
-- Paramétrer un robot qui lance le script launch_batch_thumbnails.sh placé dans modules/thumbnails/scripts
-
-- Le fichier de paramètres est config_batch_letterbox.xml (dans le dossier xml)
-
-- Ce script lance le fichier php create_tnl qui permet de créer les miniatures des documents ayant les champs "tnl_path" et "tnl_filename" vides. Ces champs sont à rajouter dans la table res_letterbox (et autres tables liées comme les versions, documents liés, etc.. ?) 
-
-- Les miniatures sont enregistrées dans un docserveur différent  (l'id est à définir dans le fichier de paramètres) du docserveur principal
-
-- La commande de conversion est la suivante 
-
-convert -thumbnail x300 -background white -alpha remove <path_input>[0] <path_output>
-
-imagemagick et ghostscript sont nécessaires
\ No newline at end of file
diff --git a/modules/thumbnails/ajaxShowThumb.php b/modules/thumbnails/ajaxShowThumb.php
deleted file mode 100755
index 3e9761f1646a30ab243bc1cdda217717d8310b01..0000000000000000000000000000000000000000
--- a/modules/thumbnails/ajaxShowThumb.php
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-/*
-*   Copyright 2014-2017 Maarch
-*
-*   This file is part of Maarch Framework.
-*
-*   Maarch Framework is free software: you can redistribute it and/or modify
-*   it under the terms of the GNU General Public License as published by
-*   the Free Software Foundation, either version 3 of the License, or
-*   (at your option) any later version.
-*
-*   Maarch Framework is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*   GNU General Public License for more details.
-*
-*   You should have received a copy of the GNU General Public License
-*   along with Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*
-*   @brief Displays thumbnails if exists
-*
-*   @file
-*   @author <dev@maarch.org>
-*   @date $date$
-*   @version $Revision$
-*/
-
-require_once 'modules/thumbnails/class/class_modules_tools.php';
-
-$error = false;
-
-if (isset($_REQUEST['resId'])) {
-    $resId = $_REQUEST['resId'];
-} else {
-    $error = 'RES_ID' . _EMPTY;
-}
-
-if (isset($_REQUEST['collId'])) {
-    $collId = $_REQUEST['collId'];
-} else {
-    $error = 'COLL_ID' . _EMPTY;
-}
-
-if (!$error) {
-    $tnl = new thumbnails();
-    $path = $tnl->getPathTnl($resId, 'letterbox_coll');
-    
-    if (is_file($path)) {
-        $return .= '<img src="index.php?page=doc_thumb&module=thumbnails&res_id=' . $resId . '&coll_id=letterbox_coll&display=true">';
-    $status = 0;
-    } else {
-        $return .= '<span id="no_doc"><i class="fa fa-ban" style="font-size: 460px;color: grey;opacity: 0.2;margin-top: 30px;"></i></span>';
-        $status = 1;
-    }
-} else {
-    $return .= '<span id="no_doc"><i class="fa fa-ban" style="font-size: 460px;color: grey;opacity: 0.2;margin-top: 30px;"></i></span>';
-    $status = 1;
-}
-
-echo "{status : " . $status . ", toShow : '" . addslashes($return) . "'}";
-exit ();
diff --git a/modules/thumbnails/batch_tools.php b/modules/thumbnails/batch_tools.php
deleted file mode 100755
index b19885273e919d38275db564627b8d5f31882cc6..0000000000000000000000000000000000000000
--- a/modules/thumbnails/batch_tools.php
+++ /dev/null
@@ -1,155 +0,0 @@
-<?php
-
-/*
- *   Copyright 2008-2015 Maarch
- *
- *   This file is part of Maarch Framework.
- *
- *   Maarch Framework is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation, either version 3 of the License, or
- *   (at your option) any later version.
- *
- *   Maarch Framework is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * @brief API to manage batchs 
- *
- * @file
- * @author Laurent Giovannoni
- * @date $date$
- * @version $Revision$
- * @ingroup core
- */
-
-/**
- * Execute a sql query
- * 
- * @param object $dbConn connection object to the database
- * @param string $queryTxt path of the file to include
- * @param boolean $transaction for rollback if error
- * @return true if ok, exit if ko and rollback if necessary
- */
-function Bt_doQuery($dbConn, $queryTxt, $param=array(), $transaction=false)
-{
-    if (count($param) > 0) {
-        $stmt = $dbConn->query($queryTxt, $param);
-    } else {
-        $stmt = $dbConn->query($queryTxt);
-    }
-
-    if (!$stmt) {
-        if ($transaction) {
-            $GLOBALS['logger']->write('ROLLBACK', 'INFO');
-            $dbConn->query('ROLLBACK');
-        }
-        Bt_exitBatch(
-            104, 'SQL Query error:' . $queryTxt
-        );
-    }
-    $GLOBALS['logger']->write('SQL query:' . $queryTxt, 'DEBUG');
-    return $stmt;
-}
-
-/**
- * Exit the batch with a return code, message in the log and 
- * in the database if necessary
- * 
- * @param int $returnCode code to exit (if > O error)
- * @param string $message message to the log and the DB
- * @return nothing exit the program
- */
-function Bt_exitBatch($returnCode, $message='')
-{
-    if (file_exists($GLOBALS['lckFile'])) {
-        unlink($GLOBALS['lckFile']);
-    }
-    if ($returnCode > 0) {
-        $GLOBALS['totalProcessedResources']--;
-        if ($GLOBALS['totalProcessedResources'] == -1) {
-            $GLOBALS['totalProcessedResources'] = 0;
-        }
-        if($returnCode < 100) {
-            if (file_exists($GLOBALS['errorLckFile'])) {
-                unlink($GLOBALS['errorLckFile']);
-            }
-            $semaphore = fopen($GLOBALS['errorLckFile'], "a");
-            fwrite($semaphore, '1');
-            fclose($semaphore);
-        }
-        $GLOBALS['logger']->write($message, 'ERROR', $returnCode);
-        Bt_logInDataBase($GLOBALS['totalProcessedResources'], 1, $message.' (return code: '. $returnCode.')');
-    } elseif ($message <> '') {
-        $GLOBALS['logger']->write($message, 'INFO', $returnCode);
-        Bt_logInDataBase($GLOBALS['totalProcessedResources'], 0, $message.' (return code: '. $returnCode.')');
-    }
-    Bt_updateWorkBatch();
-    exit($returnCode);
-}
-
-/**
-* Insert in the database the report of the batch
-* @param long $totalProcessed total of resources processed in the batch
-* @param long $totalErrors total of errors in the batch
-* @param string $info message in db
-*/
-function Bt_logInDataBase($totalProcessed=0, $totalErrors=0, $info='')
-{
-    $query = "INSERT INTO history_batch (module_name, batch_id, event_date, "
-           . "total_processed, total_errors, info) values(?, ?, CURRENT_TIMESTAMP, ?, ?, ?)";
-    $arrayPDO = array($GLOBALS['batchName'], $GLOBALS['wb'], $totalProcessed, $totalErrors, substr(str_replace('\\', '\\\\', str_replace("'", "`", $info)), 0, 999));
-    $GLOBALS['db']->query($query, $arrayPDO);
-}
-
-/**
- * Get the batch if of the batch
- * 
- * @return nothing
- */
-function Bt_getWorkBatch() 
-{
-    $req = "SELECT param_value_int FROM parameters WHERE id = ? ";
-    $stmt = $GLOBALS['db']->query($req, array($GLOBALS['batchName']."_id"));
-    
-    while ($reqResult = $stmt->fetchObject()) {
-        $GLOBALS['wb'] = $reqResult->param_value_int + 1;
-    }
-    if ($GLOBALS['wb'] == '') {
-        $req = "INSERT INTO parameters(id, param_value_int) VALUES (?, 1)";
-        $GLOBALS['db']->query($req, array($GLOBALS['batchName']."_id"));
-        $GLOBALS['wb'] = 1;
-    }
-}
-
-/**
- * Update the database with the new batch id of the batch
- * 
- * @return nothing
- */
-function Bt_updateWorkBatch()
-{
-    $req = "UPDATE parameters SET param_value_int = ? WHERE id = ?";
-    $GLOBALS['db']->query($req, array($GLOBALS['wb'], $GLOBALS['batchName']."_id"));
-}
-
-/**
- * Include the file requested if exists
- * 
- * @param string $file path of the file to include
- * @return nothing
- */
-function Bt_myInclude($file) 
-{
-    if (file_exists($file)) {
-        include_once ($file);
-    } else {
-        throw new IncludeFileError($file);
-    }
-}
diff --git a/modules/thumbnails/class/class_modules_tools.php b/modules/thumbnails/class/class_modules_tools.php
deleted file mode 100755
index 49a77110a7cf9bbeb5fcf3f18d6debeaefe7863f..0000000000000000000000000000000000000000
--- a/modules/thumbnails/class/class_modules_tools.php
+++ /dev/null
@@ -1,250 +0,0 @@
-<?php
-
-class thumbnails
-{
-	/*function __construct()
-	{
-		parent::__construct();
-	}*/
-
-	public function build_modules_tables()
-	{
-		if (file_exists(
-            $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR
-            . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . "modules"
-            . DIRECTORY_SEPARATOR . "thumbnails" . DIRECTORY_SEPARATOR . "xml"
-            . DIRECTORY_SEPARATOR . "config.xml"
-        )
-        ) {
-            $configPath = $_SESSION['config']['corepath'] . 'custom'
-                        . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id']
-                        . DIRECTORY_SEPARATOR . "modules" . DIRECTORY_SEPARATOR
-                        . "thumbnails" . DIRECTORY_SEPARATOR . "xml"
-                        . DIRECTORY_SEPARATOR . "config.xml";
-        } else {
-            $configPath = "modules" . DIRECTORY_SEPARATOR . "thumbnails"
-                        . DIRECTORY_SEPARATOR . "xml" . DIRECTORY_SEPARATOR
-                        . "config.xml";
-        }
-		
-		$xmlconfig = simplexml_load_file($configPath);
-		$conf = $xmlconfig->CONFIG;
-		
-	}
-
-	private function r_mkdir_tnl($path, $mode = 0777, $recursive = true) {
-	if(empty($path))
-		return false;
-	 
-	if($recursive) {
-		$toDo = substr($path, 0, strrpos($path, DIRECTORY_SEPARATOR));
-		if($toDo !== '.' && $toDo !== '..')
-			$this->r_mkdir_tnl($toDo, $mode);
-	}
-	 
-	if(!is_dir($path))
-		mkdir($path, $mode);
-	 
-		return true;
-}
-	public function generateTnl($res_id, $coll_id, $table_name = false){
-		$db = new Database();
-		$query = "select docserver_id from docservers where is_readonly = 'N' and "
-	   . " coll_id = ? and docserver_type_id = 'TNL'";
-		$stmt1 = $db->query($query, array($coll_id));
-
-		if($res = $stmt1->fetchObject()){
-			$docserverId = $res->docserver_id;
-		}else{
-			$docserverId='';
-		}
-
-		$docServers = "select docserver_id, path_template, device_label from docservers";
-		
-		$stmt1 = $db->query($docServers,array());
-		while ($queryResult = $stmt1->fetchObject()) {
-		  $pathToDocServer[$queryResult->docserver_id] = $queryResult->path_template;
-		}
-		$pathOutput = $pathToDocServer[(string)$docserverId];
-		if (!$table_name) $table_name = 'res_letterbox';
-		$queryMakeThumbnails = "select docserver_id, path, filename, format from ". $table_name . " where res_id = ? ";
-		$stmt1 = $db->query($queryMakeThumbnails, array($res_id));
-
-		while ($queryResult=$stmt1->fetchObject()) {
-			$fileFormat = $queryResult->format;
-			$path= $queryResult->path;
-			$filename= $queryResult->filename;
-
-			$pathToFile = $pathToDocServer[$queryResult->docserver_id] 
-			. str_replace("#", DIRECTORY_SEPARATOR, $path)
-        	. $queryResult->filename;
-			$outputPathFile  = $pathOutput . str_replace("#", DIRECTORY_SEPARATOR, $path) 
-			. str_replace(pathinfo($pathToFile, PATHINFO_EXTENSION), "png",$filename);
-		}
-
-		if (
-       		strtoupper($fileFormat) <> 'PDF' 
-       		&& strtoupper($fileFormat) <> 'HTML'
-       		&& strtoupper($fileFormat) <> 'MAARCH'
-       	) {
-			$stmt2 = $db->query("UPDATE ".$table_name." SET tnl_path = 'ERR', tnl_filename = 'ERR' WHERE res_id = ?", array($res_id));
-
-       	} else {
-			$racineOut = $pathOutput . str_replace("#", DIRECTORY_SEPARATOR, $path);
-			if (!is_dir($racineOut)){
-				$this->r_mkdir_tnl($racineOut,0777);
-			}
-			
-			$command = '';
-
-			if (strtoupper($fileFormat) == 'PDF') {
-				$command = "convert -density 100x100 -quality 65 -alpha remove " . escapeshellarg($pathToFile) . " ". escapeshellarg($outputPathFile);
-			} else {
-				$posPoint = strpos($pathToFile, '.');
-				$extension = substr($pathToFile, $posPoint);
-				$chemin = substr($pathToFile, 0, $posPoint);
-				if($extension == '.maarch'){
-					if (!copy($pathToFile, $chemin.'.html')) {
-					    echo "La copie $pathToFile du fichier a échoué...\n";
-					}else{
-						$cheminComplet = $chemin.".html";
-						$command = "wkhtmltoimage --width 400 --height 600 --quality 100 --zoom 0.2 " . escapeshellarg($cheminComplet) . " "
-						. escapeshellarg($outputPathFile);
-
-					}
-				}else{
-					$command = "wkhtmltoimage --width 400 --height 600 --quality 100 --zoom 0.2 " . escapeshellarg($pathToFile) . " "
-					. escapeshellarg($outputPathFile);
-				}
-			}
-			echo $command;
-			exec($command.' 2>&1', $output, $result);
-			if($result > 0)
-			{
-			   echo 'document not converted ! ('.$output[0].')';
-			}else{
-				if (is_file($outputPathFile)){
-					$stmt2 = $db->query("UPDATE ".$table_name." SET tnl_path = ?, tnl_filename = ? WHERE res_id = ?", array($path, str_replace(pathinfo($pathToFile, PATHINFO_EXTENSION), "png",$filename), $res_id));	
-				}
-				else if (is_file(pathinfo($outputPathFile,PATHINFO_DIRNAME) . DIRECTORY_SEPARATOR . pathinfo($outputPathFile,PATHINFO_FILENAME).'-0.png')){
-					$newFilename =  pathinfo($outputPathFile,PATHINFO_FILENAME).'-0.png';
-					$stmt2 = $db->query("UPDATE ".$table_name." SET tnl_path = ?, tnl_filename = ? WHERE res_id = ?", array($path, $newFilename, $res_id));
-				}
-				return $this->getPathTnl($res_id, $coll_id, $table_name);
-			}
-		}
-	}
-	
-	public function getPathTnl($res_id, $coll_id, $table_name = false)
-    {
-		if (empty($res_id)) {
-		    return '';
-        }
-
-        $tnlAdr = \Resource\models\AdrModel::getTypedDocumentAdrByResId([
-            'select'    => ['docserver_id', 'path', 'filename'],
-            'resId'     => $res_id,
-            'type'      => 'TNL'
-        ]);
-        if (empty($tnlAdr)) {
-            return '';
-        }
-        $docserver = \Docserver\models\DocserverModel::getByDocserverId([
-            'select'        => ['path_template'],
-            'docserverId'   => $tnlAdr['docserver_id']
-        ]);
-        $tnlPath = str_replace("#", DIRECTORY_SEPARATOR , $tnlAdr['path']);
-        $path = $docserver['path_template'] . DIRECTORY_SEPARATOR . $tnlPath . $tnlAdr['filename'];
-        $path = str_replace("//", "/", $path);
-
-		return $path;
-	}
-
-        public function testMultiPage($path_tnl){
-		if (strpos(pathinfo($path_tnl,PATHINFO_FILENAME),"-0") === false){
-			return array($path_tnl);
-		}
-		else{
-			$rep = pathinfo($path_tnl,PATHINFO_DIRNAME);
-			$basefile = explode("-",pathinfo($path_tnl,PATHINFO_FILENAME));
-			$basefile = $basefile[0];
-			$directory  = opendir($rep);
-			while (false !== ($filename = readdir($directory))) {
-				if (strpos($filename,$basefile) !== false)
-					$tmpfiles[] = $rep.DIRECTORY_SEPARATOR.$filename;
-			}
-
-			$files = array();
-			foreach($tmpfiles as $tmp){
-				$tmp_basefile = explode("-",pathinfo($tmp,PATHINFO_FILENAME));
-				$cpt = $tmp_basefile[1];
-				$files[$cpt] = $tmp;
-			}
-			return $files;
-		}
-	}
-
-	/**
-	 * Retrieve the path of source file to process
-	 * @param array $aArgs
-	 * @return string
-	 */
-	public function getTnlPathWithColl(array $aArgs = []) {
-		if (empty($aArgs['resId'])) {
-			throw new \Exception('resId empty');
-		}
-		if (empty($aArgs['collId'])) {
-			throw new \Exception('collId empty');
-		}
-
-		$resId = $aArgs['resId'];
-		$collId = $aArgs['collId'];
-
-		for ($i=0;$i < count($_SESSION['collections']);$i++) {
-			if ($_SESSION['collections'][$i]['id'] == $collId) {
-				$resTable = $_SESSION['collections'][$i]['table'];
-			}
-		}
-		if (empty($resTable)) {
-			return false;
-		}
-
-		$oRowSet = \SrcCore\models\DatabaseModel::select([
-			'select'    => ['path_template'],
-			'table'     => ['docservers'],
-			'where'     => ['docserver_type_id = ?'],
-			'data'      => ['TNL']
-		]);
-
-		if (empty($oRowSet[0]['path_template'])) {
-			throw new \Exception('TNL docserver path empty');
-		}
-
-		$docserverPath = $oRowSet[0]['path_template'];
-
-		$oRowSet = \SrcCore\models\DatabaseModel::select([
-			'select'    => ['tnl_path', 'tnl_filename'],
-			'table'     => [$resTable],
-			'where'     => ['res_id = ?'],
-			'data'      => [$resId]
-		]);
-
-		if (empty($oRowSet)) {
-			return false;
-		}
-
-		$path          = '';
-		$filename      = '';
-		if (!empty($oRowSet[0]['tnl_path'])) {
-			$path = $oRowSet[0]['tnl_path'];
-		}
-		if (!empty($oRowSet[0]['tnl_filename'])) {
-			$filename = $oRowSet[0]['tnl_filename'];
-		}
-		$sourceFilePath = $docserverPath . $path . $filename;
-		$sourceFilePath = str_replace('#', DIRECTORY_SEPARATOR, $sourceFilePath);
-
-		return $sourceFilePath;
-	}
-
-}
diff --git a/modules/thumbnails/create_tnl.php b/modules/thumbnails/create_tnl.php
deleted file mode 100755
index e6f3ab8cecf720286493215202c4f8423a6cd403..0000000000000000000000000000000000000000
--- a/modules/thumbnails/create_tnl.php
+++ /dev/null
@@ -1,314 +0,0 @@
-<?php
-/**
-* Copyright Maarch since 2008 under licence GPLv3.
-* See LICENCE.txt file at the root folder for more details.
-* This file is part of Maarch software.
-
-* @brief   create_tnl
-* @author  dev <dev@maarch.org>
-* @ingroup thumbnails
-*/
-
-try {
-    include 'Maarch_CLITools/ArgsParser.php';
-    include 'LoggerLog4php.php';
-    include 'Maarch_CLITools/FileHandler.php';
-    include 'Maarch_CLITools/ConsoleHandler.php';
-} catch (IncludeFileError $e) {
-    echo 'Maarch_CLITools required ! \n (pear.maarch.org)\n';
-    exit(106);
-}
-// Load tools
-require 'batch_tools.php';
-
-$GLOBALS['batchName'] = 'thumbnails';
-$GLOBALS['wb'] = '';
-$GLOBALS['lckFile'] = '';
-$totalProcessedResources = 0;
-
-// Open Logger
-$GLOBALS['logger'] = new Logger4Php();
-$GLOBALS['logger']->set_threshold_level('DEBUG');
-
-$logFile = 'log/' . date('Y-m-d_H-i-s') . '.log';
-
-$file = new FileHandler($logFile);
-$GLOBALS['logger']->add_handler($file);
-
-//error mode and function
-error_reporting(E_ERROR);
-set_error_handler(errorHandler);
-// global vars of the program
-/**
-* Name of the config (usefull for multi instance)
-*/
-$GLOBALS['config_name'] = "";
-/**
-* Path to the log file
-*/
-$GLOBALS['log'] = "";
-/**
-* User exit of the program, contains 1 if any problem appears
-*/
-$GLOBALS['ErrorLevel'] = 0;
-/**
-* Connection object to database 1
-*/
-$GLOBALS['db'] = "";
-
-// Class to manage files includes errors
-class IncludeFileError extends Exception
-{
-    public function __construct($file)
-    {
-        $this->file = $file;
-        parent::__construct("Include File \"$file\" is missing!", 1);
-    }
-}
-
-function MyInclude($file)
-{
-    if (file_exists($file)) {
-        include_once $file;
-    } else {
-        throw new IncludeFileError($file);
-    }
-}
-
-function r_mkdir($path, $mode = 0777, $recursive = true)
-{
-    if(empty($path))
-        return false;
-     
-    if ($recursive) {
-        $toDo = substr($path, 0, strrpos($path, DIRECTORY_SEPARATOR));
-        if($toDo !== '.' && $toDo !== '..')
-            r_mkdir($toDo, $mode);
-    }
-     
-    if(!is_dir($path))
-        mkdir($path, $mode);
-     
-        return true;
-}
-
-/**
-* Managing of errors
-* @param  $errno integer number of the error
-* @param  $errstr string text of the error
-* @param  $errfile string file concerned with the error
-* @param  $errline integer line of the error
-* @param  $errcontext string context of the error
-*/
-function errorHandler($errno, $errstr, $errfile, $errline, $errcontext)
-{
-    $GLOBALS['logger']->write('from  line ' . $errline . ' : ' . $errstr, 'WARNING', 1);
-    $GLOBALS['errorLevel'] = 1;
-}
-
-// Begin
-date_default_timezone_set('Europe/Paris');
-if ($argc != 2) {
-    echo "You must specify the configuration file." . $argc;
-    exit;
-}
-$conf = $argv[1];
-;
-if (!file_exists($conf)) {
-    $GLOBALS['logger']->write("Can't load xml config file ! (".$conf.")", "ERROR");
-    exit();
-} else {
-    $xmlconfig = simplexml_load_file($conf);
-}
-foreach ($xmlconfig->CONFIG as $CONFIG) {
-    $GLOBALS['config_name'] = $CONFIG->CONFIG_NAME;
-   
-    $GLOBALS['tablename'] = $CONFIG->TABLE_NAME;
-    $GLOBALS['collection'] = $CONFIG->COLLECTION;
-    
-    $GLOBALS['max_batch_size'] = $CONFIG->MAX_BATCH_SIZE;
-    $maarchDirectory = (string) $CONFIG->MaarchDirectory;
-    $GLOBALS['core_path'] = $maarchDirectory . 'core' . DIRECTORY_SEPARATOR;
-}
-$GLOBALS['databasetype'] = $xmlconfig->CONFIG_BASE->databasetype;
-
-$log4phpParams = $xmlconfig->LOG4PHP;
-if ((string) $log4phpParams->enabled == 'true') {
-    $GLOBALS['logger']->set_log4PhpLibrary(
-        $maarchDirectory . 'apps/maarch_entreprise/tools/log4php/Logger.php'
-    );
-    $GLOBALS['logger']->set_log4PhpLogger((string) $log4phpParams->Log4PhpLogger);
-    $GLOBALS['logger']->set_log4PhpBusinessCode((string) $log4phpParams->Log4PhpBusinessCode);
-    $GLOBALS['logger']->set_log4PhpConfigPath((string) $log4phpParams->Log4PhpConfigPath);
-    $GLOBALS['logger']->set_log4PhpBatchName('thumbnails');
-}
-
-$GLOBALS['logger']->write("Launch of process of thumbnails conversion");
-$GLOBALS['logger']->write("Loading the xml config file");
-$GLOBALS['logger']->write("Config name : " . $GLOBALS['config_name']);
-$GLOBALS['logger']->write("Conversion launched for table : " . $GLOBALS['tablename']);
-
-require $GLOBALS['core_path']."class/class_functions.php";
-require $GLOBALS['core_path']."class/class_db_pdo.php";
-    
-$GLOBALS['db'] = new Database($conf);
-
-
-Bt_getWorkBatch();
-
-$query = "select docserver_id from docservers where is_readonly = 'N' and "
-       . " coll_id = ? and docserver_type_id = 'TNL'";
-       
-$stmt1 = $GLOBALS['db']->query($query, array($GLOBALS['collection']));
-if ($res = $stmt1->fetchObject()) {
-    $docserverId = $res->docserver_id;
-} else {
-    $docserverId='';
-}
-
-if ($docserverId <> '') {
-    $GLOBALS['logger']->write("TNL docserver found !");
-} else {
-    $GLOBALS['logger']->write("TNL docserver not found ! (query : ".$query, "ERROR");
-    exit();
-}
-
-$docserversList = array();
-$docServers = "select docserver_id, path_template, device_label from docservers";
-$stmt1 = $GLOBALS['db']->query($docServers);
-while ($queryResult = $stmt1->fetchObject()) {
-    $pathToDocServer[$queryResult->docserver_id] = $queryResult->path_template;
-    $docserversList[] = $queryResult->docserver_id;
-}
-$docserversList = implode(', ', $docserversList);
-//$GLOBALS['logger']->write("List of docServers : " . $docserversList);
-
-if (is_dir($pathToDocServer[(string)$docserverId])) {
-    $pathOutput = $pathToDocServer[(string)$docserverId];
-    $GLOBALS['logger']->write("TNL path: ".$pathOutput);
-
-} else {
-    $pathOutput = $pathToDocServer[(string)$docserverId];
-    $GLOBALS['logger']->write("Wrong TNL path ! (".$pathOutput.")", "ERROR");
-    exit();
-}
-$cpt_batch_size=0;
-
-$queryCount = "select count(1) as count from "
-    . $GLOBALS['tablename'] . " where (tnl_filename = '' or tnl_filename is null) "
-    . " and (filename <> '' or filename is not null)";
-$stmt1 = $GLOBALS['db']->query($queryCount);
-
-$nbResToProcess = $stmt1->fetchObject()->count;
-
-$queryMakeThumbnails = "select res_id, docserver_id, path, filename, format from "
-    . $GLOBALS['tablename'] . " where (tnl_filename = '' or tnl_filename is null) "
-    . " and (filename <> '' or filename is not null)";
-
-$stmt1 = $GLOBALS['db']->query($queryMakeThumbnails);
-
-if ($nbResToProcess === 0) {
-    Bt_exitBatch(0, 'No document to process');
-} else {
-    $GLOBALS['logger']->write($nbResToProcess." document(s) to process...");
-}
-
-$i = 1;
-$err = 0;
-$errInfo = '';
-while ($queryResult=$stmt1->fetchObject()) {
-    if ($GLOBALS['max_batch_size'] >= $cpt_batch_size) {
-        $fileFormat = $queryResult->format;
-        $pathToFile = $pathToDocServer[$queryResult->docserver_id] 
-            . str_replace("#", DIRECTORY_SEPARATOR, $queryResult->path)
-            . $queryResult->filename;
-        $outputPathFile  = $pathOutput . str_replace("#", DIRECTORY_SEPARATOR, $queryResult->path) 
-            . str_replace(pathinfo($pathToFile, PATHINFO_EXTENSION), "png",$queryResult->filename);
-        
-        $GLOBALS['logger']->write('Process n°'.$i.'/'.$nbResToProcess.' (RES_ID => '.$queryResult->res_id.', FORMAT => '.$fileFormat.', PATH => '.$pathToFile.')');
-        
-        
-        if (strtoupper($fileFormat) <> 'PDF' 
-            && strtoupper($fileFormat) <> 'HTML'
-            && strtoupper($fileFormat) <> 'MAARCH'
-        ) {
-            $errTxt = "file format not allowed : " . $fileFormat;
-            $errInfo = ' (Last Error : '.$errTxt.')';
-
-            $stmt2 = $GLOBALS['db']->query("UPDATE ".$GLOBALS['tablename']." SET tnl_path = 'ERR', tnl_filename = 'ERR' WHERE res_id = ?", array($queryResult->res_id));
-               $GLOBALS['logger']->write('document not converted ! ('.$errTxt.')',"ERROR");
-            $err++;
-        } else {
-            $racineOut = $pathOutput . str_replace("#", DIRECTORY_SEPARATOR, $queryResult->path);
-            if (!is_dir($racineOut)) {
-                r_mkdir($racineOut, 0777);
-                $GLOBALS['logger']->write("Create $racineOut directory ");
-            }
-            
-            $command = '';
-            if (strtoupper($fileFormat) == 'PDF') {
-                /*$command = "convert -thumbnail 400x600 -background white -alpha remove " . escapeshellarg($pathToFile) . "[0] "
-                    . escapeshellarg($outputPathFile);*/
-                /* convert all pdf pages to img, without resize, low quality */
-                $command = "convert -density 100x100 -quality 65 -background white -alpha remove " . escapeshellarg($pathToFile) . " ". escapeshellarg($outputPathFile);
-            } else {
-                $posPoint = strpos($pathToFile, '.');
-                $extension = substr($pathToFile, $posPoint);
-                $chemin = substr($pathToFile, 0, $posPoint);
-                if ($extension == '.maarch') {
-                    if (!copy($pathToFile, $chemin.'.html')) {
-                        echo "La copie $pathToFile du fichier a échoué...\n";
-                    } else {
-                        echo "La copie $pathToFile du fichier a réussi...\n";
-                        $cheminComplet = $chemin.".html";
-                        $command = "wkhtmltoimage --width 400 --height 600 --quality 100 --zoom 0.2 " . escapeshellarg($cheminComplet) . " "
-                        . escapeshellarg($outputPathFile);
-
-                    }
-                } else {
-                    $command = "wkhtmltoimage --width 400 --height 600 --quality 100 --zoom 0.2 " . escapeshellarg($pathToFile) . " "
-                    . escapeshellarg($outputPathFile);
-                }
-            }
-            exec($command.' 2>&1', $output, $result);
-            if ($result > 0) {
-
-                $err++;
-                $errInfo = ' (Last Error : '.$output[0].')';
-                $stmt2 = $GLOBALS['db']->query("UPDATE ".$GLOBALS['tablename']." SET tnl_path = 'ERR', tnl_filename = 'ERR' WHERE res_id = ?", array($queryResult->res_id));
-                $GLOBALS['logger']->write('document not converted ! ('.$output[0].') => '.$command,"ERROR");
-            } else {
-                if (is_file($outputPathFile)) {
-                    $stmt2 = $GLOBALS['db']->query("UPDATE ".$GLOBALS['tablename']." SET tnl_path = ?, tnl_filename = ? WHERE res_id = ?", array($queryResult->path, str_replace(pathinfo($pathToFile, PATHINFO_EXTENSION), "png",$queryResult->filename), $queryResult->res_id));	
-                
-                } else if (is_file(pathinfo($outputPathFile,PATHINFO_DIRNAME) . DIRECTORY_SEPARATOR . pathinfo($outputPathFile,PATHINFO_FILENAME).'-0.png')) {
-                    $newFilename =  pathinfo($outputPathFile,PATHINFO_FILENAME).'-0.png';
-                    $stmt2 = $GLOBALS['db']->query("UPDATE ".$GLOBALS['tablename']." SET tnl_path = ?, tnl_filename = ? WHERE res_id = ?", array($queryResult->path, $newFilename, $queryResult->res_id));
-                }
-                $GLOBALS['logger']->write('document converted');
-            }
-        }
-    } else {
-        $converted_doc = $i - $err;
-        $GLOBALS['logger']->write($converted_doc.' document(s) converted, MAX BATCH SIZE EXCEDEED !'.$errInfo);
-        Bt_logInDataBase(
-            $i, $err, $i.' document(s) converted, MAX BATCH SIZE EXCEDEED !'.$errInfo
-        );
-        break;
-    }
-    $i++;
-    $cpt_batch_size++;
-}
-$i--;
-
-$converted_doc = $i - $err;
-$GLOBALS['logger']->write($converted_doc.' document(s) converted');
-
-Bt_logInDataBase(
-    $i, $err, $converted_doc.' document(s) converted'.$errInfo
-);
-
-Bt_updateWorkBatch();
-$GLOBALS['logger']->write("End of application !");
-
-exit();
diff --git a/modules/thumbnails/css/module.css b/modules/thumbnails/css/module.css
deleted file mode 100755
index 31b1a8c7bb4203b2a3e053a504723c972afd3769..0000000000000000000000000000000000000000
--- a/modules/thumbnails/css/module.css
+++ /dev/null
@@ -1,66 +0,0 @@
-.iconDoc span { 
-	display: none;
-}
-.iconDoc:hover span { 
-	display: block;
-	position:fixed;
-	/*position:absolute;*/
-	left:10px;
-	top:10px;
-	/*margin-left:-420px;*/
-	/*margin-top:-110px;*/
-	border: solid 1px rgb(0, 157, 197);
-	-moz-box-shadow: 0px 0px 5px 0px #656565;
-	-webkit-box-shadow: 0px 0px 5px 0px #656565;
-	-o-box-shadow: 0px 0px 5px 0px #656565;
-	box-shadow: 0px 0px 5px 0px #656565;
-	filter:progid:DXImageTransform.Microsoft.Shadow(color=#656565, Direction=NaN, Strength=5);
-	z-index:100;
-	height:600px;
-	width:auto;
-}
-
-.iconDoc:hover span img {
-	height:600px;
-	width:auto;
-}
-
-.iconDoc:hover #no_doc { 
-	display: inline;
-	position:fixed;
-	/*position:absolute;*/
-	left:10px;
-	top:10px;
-	/*margin-top:0px;*/
-	padding: 10px;
-	background: #ffffff;
-	color: #AD5453;
-	-moz-box-shadow: 0px 0px 5px 0px #656565;
-	-webkit-box-shadow: 0px 0px 5px 0px #656565;
-	-o-box-shadow: 0px 0px 5px 0px #656565;
-	box-shadow: 0px 0px 5px 0px #656565;
-	filter:progid:DXImageTransform.Microsoft.Shadow(color=#656565, Direction=NaN, Strength=5);
-	z-index:100;
-	height:550px;
-	width: 400px;
-}
-
-.iconDoc #no_doc:after { 
-    content: 'AUCUN APERÇU DISPONIBLE';
-	font-size:20px;
-	font-weight:bold;
-	position: absolute;
-	left:18%;
-	top: 50%;
-	color: rgb(0, 157, 197);
-	opacity:1;
-}
-.iconDoc span:after { 
-    content: 'APERÇU';
-	font-size:20px;
-	font-weight:bold;
-	position: absolute;
-	left:35%;
-	color: rgb(0, 157, 197);
-	opacity:0.2;
-}
diff --git a/modules/thumbnails/doc_thumb.php b/modules/thumbnails/doc_thumb.php
deleted file mode 100755
index 58056a3f8d6c630b14c68248dff35939a983ceab..0000000000000000000000000000000000000000
--- a/modules/thumbnails/doc_thumb.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-	require_once 'modules/thumbnails/class/class_modules_tools.php';
-			
-	$resId    = $_REQUEST['res_id'];
-	$collId   = $_REQUEST['coll_id'];
-	$advanced = $_REQUEST['advanced'];
-
-	$tnl = new thumbnails();
-	if (empty($advanced)) {
-		if (isset($_REQUEST['tablename'])) {
-		    $path = $tnl->getPathTnl($resId, $collId,$_REQUEST['tablename']);
-        }
-		else {
-		    $path = $tnl->getPathTnl($resId, $collId);
-		}
-	} else {
-		$path = $tnl->getTnlPathWithColl(['resId' => $resId, 'collId' => $collId]); // New Behaviour
-	}
-	if (!is_file($path) && !empty($advanced)){
-		$path = 'modules/thumbnails/no_thumb.png';
-	} elseif (!is_file($path)) {
-		exit();
-	}
-
-	$tab_tnl = $tnl->testMultiPage($path);
-	if (!isset($_REQUEST['num_page'])) $num_page = 0;
-	else $num_page = $_GET['num_page'];
-	$mime_type = 'image/png';	
-	$date = mktime(0,0,0,date("m" ) + 2  ,date("d" ) ,date("Y" )  );
-	$date = date("D, d M Y H:i:s", $date);
-	$time = 30*12*60*60;
-	header("Pragma: public");
-	header("Expires: ".$date." GMT");
-	header("Cache-Control: max-age=".$time.", must-revalidate");
-	header("Content-Description: File Transfer");
-	header("Content-Type: ".$mime_type);
-	header("Content-Disposition: inline; filename=filename;");
-	header("Content-Transfer-Encoding: binary");
-	readfile($tab_tnl[$num_page]);
-	exit();
diff --git a/modules/thumbnails/doc_thumb_frame.php b/modules/thumbnails/doc_thumb_frame.php
deleted file mode 100755
index 08f729df0cced60b7565b0e1b78c8e0e4b77f1c9..0000000000000000000000000000000000000000
--- a/modules/thumbnails/doc_thumb_frame.php
+++ /dev/null
@@ -1,118 +0,0 @@
-<?php
-	require_once 'modules/thumbnails/class/class_modules_tools.php';
-			
-	$res_id = $_REQUEST['res_id'];
-	$coll_id = $_REQUEST['coll_id'];
-	$advanced = $_REQUEST['advanced'];
-	$tnl = new thumbnails();
-
-	if (isset($_REQUEST['res_id_attach'])){
-		$path = $tnl->getPathTnl($_REQUEST['res_id_attach'], $coll_id, 'res_attachments');
-
-		if (!is_file($path) && !empty($advanced)){
-			$path = 'modules/thumbnails/no_thumb.png';
-		} elseif (!is_file($path)) {
-			exit();
-		}
-		$tab_tnl = $tnl->testMultiPage($path);
-	}
-	
-	else{
-		if (empty($advanced)) {
-			$path = $tnl->getPathTnl($res_id, $coll_id);
-		} else {
-			$path = $tnl->getTnlPathWithColl(['resId' => $res_id, 'collId' => $coll_id]); // New Behaviour
-		}
-		if (!is_file($path) && !empty($advanced)){
-			$path = 'modules/thumbnails/no_thumb.png';
-		} elseif (!is_file($path)) {
-			exit();
-		}
-		$tab_tnl = $tnl->testMultiPage($path);
-	}
-?>
-<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
-	<div class="pswp__bg"></div>
-	<div class="pswp__scroll-wrap">
-		<div class="pswp__container">
-			<div class="pswp__item"></div>
-			<div class="pswp__item"></div>
-			<div class="pswp__item"></div>
-		</div>
-		<?php 
-		if (count($tab_tnl) == 1) $style_bar = 'pswp__ui--idle';
-		else  $style_bar = '';
-		?>
-		<div class="pswp__ui pswp__ui--hidden <?php echo $style_bar; ?>">
-			<div class="pswp__top-bar">
-				<div class="pswp__counter " ></div>
-				<!--<button class="pswp__button pswp__button--close" title="Close (Esc)"></button>-->
-				<button class="pswp__button pswp__button--share" title="Share"></button>
-				<!--<button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>-->
-				<button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>
-				<div class="pswp__preloader">
-					<div class="pswp__preloader__icn">
-					  <div class="pswp__preloader__cut">
-						<div class="pswp__preloader__donut"></div>
-					  </div>
-					</div>
-				</div>
-			</div>
-			<div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
-				<div class="pswp__share-tooltip"></div> 
-			</div>
-			<button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
-			</button>
-			<button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
-			</button>
-			<div class="pswp__caption">
-				<div class="pswp__caption__center"></div>
-			</div>
-		  </div>
-		</div>
-</div>
-<script>
-	var pswpElement = document.querySelectorAll('.pswp')[0];
-	// build items array
-	var items = [
-		<?php
-		//ksort($tab_tnl);
-		//echo "<pre>".print_r($tab_tnl,true)."</pre>";
-		if (isset($_REQUEST['res_id_attach'])){
-			foreach ($tab_tnl as $num_page=>$path){
-				?>
-				{
-				
-					src: 'index.php?page=doc_thumb&module=thumbnails&res_id=<?php echo $_REQUEST['res_id_attach'];?>&coll_id=letterbox_coll&body_loaded&display=true&num_page=<?php echo $num_page;?>&tablename=res_attachments',
-					w: 827,
-					h: 1169
-				},
-				<?php
-			}
-		}
-		else{
-			foreach ($tab_tnl as $num_page=>$path){
-			?>
-			{
-			
-				src: 'index.php?page=doc_thumb&module=thumbnails&res_id=<?php echo $res_id;?>&coll_id=letterbox_coll&body_loaded&display=true&num_page=<?php echo $num_page;?>',
-				w: 827,
-				h: 1169
-			},
-			<?php
-			}
-		}		
-		?>
-	];
-
-	var options = {
-		index: 0,
-		closeOnVerticalDrag : false,
-		closeOnScroll : false,
-		history : false,
-		pinchToClose : false
-	};
-	var gallery = new PhotoSwipe( pswpElement, PhotoSwipeUI_Default, items, options);
-	gallery.init();
-
-</script>
\ No newline at end of file
diff --git a/modules/thumbnails/js/functions.js b/modules/thumbnails/js/functions.js
deleted file mode 100755
index 8dd87f3ae7350d675c560f337f03561d8a56ea95..0000000000000000000000000000000000000000
--- a/modules/thumbnails/js/functions.js
+++ /dev/null
@@ -1,32 +0,0 @@
-function showThumb(divName, resId, collId)
-{
-    var path_manage_script = 'index.php?module=thumbnails&page=ajaxShowThumb&display=true';
-    /*new Ajax.Request(path_manage_script,
-    {
-        method:'post',
-        parameters: { resId : resId, collId : collId},
-        onSuccess: function(answer) {
-            eval("response = "+answer.responseText);
-            $(divName+resId).innerHTML = response.toShow;
-        }
-    });*/
-    $j.ajax({
-        url: path_manage_script,
-        type: 'POST',
-        data: {
-            resId : resId,
-            collId : collId
-        },
-        success: function(answer)
-        {
-            eval("response = "+answer);
-            if(response.status==0){
-                $j('#'+divName+resId).html(response.toShow);
-            }
-        },
-        error: function(error)
-        {
-            alert(error);
-        }
-    });
-}
\ No newline at end of file
diff --git a/modules/thumbnails/lang/en.php b/modules/thumbnails/lang/en.php
deleted file mode 100755
index b9ec8ab30b488dc860ff3963aec3d4e3682e2534..0000000000000000000000000000000000000000
--- a/modules/thumbnails/lang/en.php
+++ /dev/null
@@ -1,3 +0,0 @@
-<?php
-if (!defined('_THUMBNAILS_COMMENT'))   
-	define('_THUMBNAILS_COMMENT', 'Unit of thumbnails');
diff --git a/modules/thumbnails/lang/fr.php b/modules/thumbnails/lang/fr.php
deleted file mode 100755
index 928cbff44aeca200c78e9fa6a6ae0907578257b5..0000000000000000000000000000000000000000
--- a/modules/thumbnails/lang/fr.php
+++ /dev/null
@@ -1,3 +0,0 @@
-<?php
-if (!defined('_THUMBNAILS_COMMENT'))   
-	define('_THUMBNAILS_COMMENT', 'Module des miniatures');
diff --git a/modules/thumbnails/log/test.txt b/modules/thumbnails/log/test.txt
deleted file mode 100755
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
diff --git a/modules/thumbnails/no_thumb.png b/modules/thumbnails/no_thumb.png
deleted file mode 100755
index f1a0596d15fbe6096872c313773f14851f684283..0000000000000000000000000000000000000000
Binary files a/modules/thumbnails/no_thumb.png and /dev/null differ
diff --git a/modules/thumbnails/scripts/launch_batch_thumbnails.sh b/modules/thumbnails/scripts/launch_batch_thumbnails.sh
deleted file mode 100755
index 0513ebfe00ce5785f2da07d6458267c113130c72..0000000000000000000000000000000000000000
--- a/modules/thumbnails/scripts/launch_batch_thumbnails.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-cd /var/www/html/maarch_courrier_trunk/modules/thumbnails/
-php /var/www/html/maarch_courrier_trunk/modules/thumbnails/create_tnl.php /var/www/html/maarch_courrier_trunk/modules/thumbnails/xml/config_batch_letterbox.xml
-php /var/www/html/maarch_courrier_trunk/modules/thumbnails/create_tnl.php /var/www/html/maarch_courrier_trunk/modules/thumbnails/xml/config_batch_attachments.xml
\ No newline at end of file
diff --git a/modules/thumbnails/xml/IVS/data_types.xml b/modules/thumbnails/xml/IVS/data_types.xml
deleted file mode 100755
index 710b3b566515c85e605bd4166463e16613cbb609..0000000000000000000000000000000000000000
--- a/modules/thumbnails/xml/IVS/data_types.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-<dataTypes>
-
-</dataTypes>
\ No newline at end of file
diff --git a/modules/thumbnails/xml/IVS/requests_definitions.xml b/modules/thumbnails/xml/IVS/requests_definitions.xml
deleted file mode 100755
index a8291960c1914a6046af34632077cd18381a7586..0000000000000000000000000000000000000000
--- a/modules/thumbnails/xml/IVS/requests_definitions.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<requestDefinitions>
-    <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="get_thumbnails" >
-      <parameter name="module" value="thumbnails"/>
-      <parameter name="page" value="doc_thumb"/>
-      <parameter name="res_id"/>
-      <parameter name="coll_id"/>
-      <parameter name="num_page"/>
-      <parameter name="tablename"/>
-      <parameter name="display" value="true"/>
-      <parameter name="advanced"/>
-    </requestDefinition>
-    <requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="get_thumbnails" >
-      <parameter name="module" value="thumbnails"/>
-      <parameter name="page" value="doc_thumb_frame"/>
-      <parameter name="res_id"/>
-      <parameter name="coll_id"/>
-      <parameter name="num_page"/>
-      <parameter name="tablename"/>
-      <parameter name="getAttach"/>
-      <parameter name="display" value="true"/>
-	  <parameter name="advanced"/>
-    </requestDefinition>
-</requestDefinitions>
\ No newline at end of file
diff --git a/modules/thumbnails/xml/IVS/validation_rules.xml b/modules/thumbnails/xml/IVS/validation_rules.xml
deleted file mode 100755
index 789bc4a1b7f334de6540396b8a3240b2f6be9104..0000000000000000000000000000000000000000
--- a/modules/thumbnails/xml/IVS/validation_rules.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<validationRules>
-    <validationRule name="get_thumbnails" extends="standardForm" mode="error">
-      <parameter name="coll_id" type="collection_list" />
-      <parameter name="res_id" type="integer" />
-      <parameter name="num_page" type="integer" />
-      <parameter name="tablename" type="string" />
-      <parameter name="module" type="identifier" />
-      <parameter name="advanced" type="string" />
-    </validationRule>
-</validationRules>
\ No newline at end of file
diff --git a/modules/thumbnails/xml/config.xml b/modules/thumbnails/xml/config.xml
deleted file mode 100755
index 967fa52e43272f7492ff9798fd35408365175bc8..0000000000000000000000000000000000000000
--- a/modules/thumbnails/xml/config.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<ROOT>
-	<CONFIG>
-        <name>thumbnails</name>
-        <comment>_THUMBNAILS_COMMENT</comment>
-        <loaded>true</loaded>
-    </CONFIG>
-</ROOT>
diff --git a/modules/thumbnails/xml/config.xml.default b/modules/thumbnails/xml/config.xml.default
deleted file mode 100755
index 967fa52e43272f7492ff9798fd35408365175bc8..0000000000000000000000000000000000000000
--- a/modules/thumbnails/xml/config.xml.default
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<ROOT>
-	<CONFIG>
-        <name>thumbnails</name>
-        <comment>_THUMBNAILS_COMMENT</comment>
-        <loaded>true</loaded>
-    </CONFIG>
-</ROOT>
diff --git a/modules/thumbnails/xml/config_batch_attachments.xml.default b/modules/thumbnails/xml/config_batch_attachments.xml.default
deleted file mode 100755
index 1c38ff0409e38274380f706d126fa5dd351e5087..0000000000000000000000000000000000000000
--- a/modules/thumbnails/xml/config_batch_attachments.xml.default
+++ /dev/null
@@ -1,23 +0,0 @@
-<ROOT>
-	<CONFIG>
-		<CONFIG_NAME>create_tnl_letterbox</CONFIG_NAME> 
-		<MaarchDirectory>/var/www/MaarchCourrier/</MaarchDirectory>
-		<TABLE_NAME>res_attachments</TABLE_NAME> <!-- Table a surveiller pour les documents à convertir -->
-		<COLLECTION>letterbox_coll</COLLECTION> 
-		<MAX_BATCH_SIZE>500</MAX_BATCH_SIZE> <!-- Nombre d'occurences max pour les conversions -->
-	</CONFIG>
-	<CONFIG_BASE>
-        <databaseserver>localhost</databaseserver>
-        <databaseserverport>5432</databaseserverport>
-        <databasetype>POSTGRESQL</databasetype>
-        <databasename>maarchcourrier</databasename>
-        <databaseuser>maarch</databaseuser>
-        <databasepassword>maarch</databasepassword>
-    </CONFIG_BASE>
-    <LOG4PHP>
-        <enabled>true</enabled>
-        <Log4PhpLogger>loggerTechnique</Log4PhpLogger>
-        <Log4PhpBusinessCode>thumbnails</Log4PhpBusinessCode>
-        <Log4PhpConfigPath>/var/www/MaarchCourrier/apps/maarch_entreprise/xml/log4php.xml</Log4PhpConfigPath>
-    </LOG4PHP>
-</ROOT>
\ No newline at end of file
diff --git a/modules/thumbnails/xml/config_batch_letterbox.xml.default b/modules/thumbnails/xml/config_batch_letterbox.xml.default
deleted file mode 100755
index 25d12867e0b0867cd22e7cb32bc17db4d1b6e8a3..0000000000000000000000000000000000000000
--- a/modules/thumbnails/xml/config_batch_letterbox.xml.default
+++ /dev/null
@@ -1,23 +0,0 @@
-<ROOT>
-	<CONFIG>
-		<CONFIG_NAME>create_tnl_letterbox</CONFIG_NAME> 
-		<MaarchDirectory>/var/www/MaarchCourrier/</MaarchDirectory>
-		<TABLE_NAME>res_letterbox</TABLE_NAME> <!-- Table a surveiller pour les documents à convertir -->
-		<COLLECTION>letterbox_coll</COLLECTION> 
-		<MAX_BATCH_SIZE>500</MAX_BATCH_SIZE> <!-- Nombre d'occurences max pour les conversions -->
-	</CONFIG>
-	<CONFIG_BASE>
-        <databaseserver>localhost</databaseserver>
-        <databaseserverport>5432</databaseserverport>
-        <databasetype>POSTGRESQL</databasetype>
-        <databasename>maarchcourrier</databasename>
-        <databaseuser>maarch</databaseuser>
-        <databasepassword>maarch</databasepassword>
-    </CONFIG_BASE>
-    <LOG4PHP>
-        <enabled>true</enabled>
-        <Log4PhpLogger>loggerTechnique</Log4PhpLogger>
-        <Log4PhpBusinessCode>thumbnails</Log4PhpBusinessCode>
-        <Log4PhpConfigPath>/var/www/MaarchCourrier/apps/maarch_entreprise/xml/log4php.xml</Log4PhpConfigPath>
-    </LOG4PHP>
-</ROOT>
\ No newline at end of file
diff --git a/modules/thumbnails/xml/services.xml b/modules/thumbnails/xml/services.xml
deleted file mode 100755
index 125decc2e671a238ebc1f0789f0546595a468ca0..0000000000000000000000000000000000000000
--- a/modules/thumbnails/xml/services.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
-</root>
diff --git a/sql/develop.sql b/sql/develop.sql
index 93f539828cedc72f141f8ebdf6a7963a5d864157..a583e9457770d22771f505829c7311561bd025ca 100644
--- a/sql/develop.sql
+++ b/sql/develop.sql
@@ -154,6 +154,7 @@ DO $$ BEGIN
     ALTER TABLE res_letterbox DROP COLUMN IF EXISTS tnl_filename;
   END IF;
 END$$;
+INSERT INTO parameters (id, description, param_value_string) VALUES ('thumbnailsSize', 'Taille des imagettes', '750x900');
 
 /* Refactoring */
 DROP VIEW IF EXISTS af_view_customer_target_view;
diff --git a/src/app/resource/controllers/ConvertThumbnailController.php b/src/app/resource/controllers/ConvertThumbnailController.php
index eb903e6410e2719df2c825552d20dc938ad57032..b4b167bd5e12a6ccc9c180439c7109bef6865c69 100644
--- a/src/app/resource/controllers/ConvertThumbnailController.php
+++ b/src/app/resource/controllers/ConvertThumbnailController.php
@@ -19,6 +19,7 @@ namespace Resource\controllers;
 use Attachment\models\AttachmentModel;
 use Docserver\controllers\DocserverController;
 use Docserver\models\DocserverModel;
+use Parameter\models\ParameterModel;
 use Resource\models\AdrModel;
 use Resource\models\ResModel;
 use SrcCore\models\CoreConfigModel;
@@ -64,7 +65,12 @@ class ConvertThumbnailController
             $command = "wkhtmltoimage --height 600 --width 400 --quality 100 --zoom 0.2 "
                 . escapeshellarg($pathToDocument) . ' ' . escapeshellarg("{$tmpPath}{$fileNameOnTmp}.png");
         } else {
-            $command = "convert -thumbnail 1000x1500 -background white -alpha remove "
+            $size = '750x900';
+            $parameter = ParameterModel::getById(['id' => 'thumbnailsSize', 'select' => ['param_value_string']]);
+            if (!empty($parameter) && preg_match('/[0-9]{3,4}[x][0-9]{3,4}/', $parameter['param_value_string'])) {
+                $size = $parameter['param_value_string'];
+            }
+            $command = "convert -thumbnail {$size} -background white -alpha remove "
                 . escapeshellarg($pathToDocument) . '[0] ' . escapeshellarg("{$tmpPath}{$fileNameOnTmp}.png");
         }
         exec($command, $output, $return);
diff --git a/src/app/resource/controllers/ResController.php b/src/app/resource/controllers/ResController.php
index 624f1f572f14a6a55f2191b899d0053a7f269851..10725b9c115f1ca09d1c887a7c492d3cd7d44b10 100755
--- a/src/app/resource/controllers/ResController.php
+++ b/src/app/resource/controllers/ResController.php
@@ -326,21 +326,47 @@ class ResController
             return $response->withStatus(403)->withJson(['errors' => 'Document out of perimeter']);
         }
 
+        $pathToThumbnail = 'apps/maarch_entreprise/img/noThumbnail.png';
         $tnlAdr = AdrModel::getTypedDocumentAdrByResId([
             'select'    => ['docserver_id', 'path', 'filename'],
             'resId'     => $aArgs['resId'],
             'type'      => 'TNL'
         ]);
         if (empty($tnlAdr)) {
-            return $response->withStatus(400)->withJson(['errors' => 'Thumbnail does not exist']);
+            $extDocument = ResModel::getExtById(['select' => ['category_id'], 'resId' => $aArgs['resId']]);
+            if ($extDocument['category_id'] == 'outgoing') {
+                $attachment = AttachmentModel::getOnView([
+                    'select'    => ['res_id', 'res_id_version'],
+                    'where'     => ['res_id_master = ?', 'attachment_type = ?', 'status not in (?)'],
+                    'data'      => [$aArgs['resId'], 'outgoing_mail', ['DEL', 'OBS']],
+                    'limit'     => 1
+                ]);
+                if (!empty($attachment[0])) {
+                    ConvertThumbnailController::convert([
+                        'collId'            => 'letterbox_coll',
+                        'resId'             => $aArgs['resId'],
+                        'outgoingId'        => empty($attachment[0]['res_id']) ? $attachment[0]['res_id_version'] : $attachment[0]['res_id'],
+                        'isOutgoingVersion' => empty($attachment[0]['res_id'])
+                    ]);
+                }
+            } else {
+                ConvertThumbnailController::convert(['collId' => 'letterbox_coll', 'resId' => $aArgs['resId']]);
+            }
+            $tnlAdr = AdrModel::getTypedDocumentAdrByResId([
+                'select'    => ['docserver_id', 'path', 'filename'],
+                'resId'     => $aArgs['resId'],
+                'type'      => 'TNL'
+            ]);
         }
 
-        $docserver = DocserverModel::getByDocserverId(['docserverId' => $tnlAdr['docserver_id'], 'select' => ['path_template']]);
-        if (empty($docserver['path_template']) || !file_exists($docserver['path_template'])) {
-            return $response->withStatus(400)->withJson(['errors' => 'Docserver does not exist']);
-        }
+        if (!empty($tnlAdr)) {
+            $docserver = DocserverModel::getByDocserverId(['docserverId' => $tnlAdr['docserver_id'], 'select' => ['path_template']]);
+            if (empty($docserver['path_template']) || !file_exists($docserver['path_template'])) {
+                return $response->withStatus(400)->withJson(['errors' => 'Docserver does not exist']);
+            }
 
-        $pathToThumbnail = $docserver['path_template'] . str_replace('#', DIRECTORY_SEPARATOR, $tnlAdr['path']) . $tnlAdr['filename'];
+            $pathToThumbnail = $docserver['path_template'] . str_replace('#', DIRECTORY_SEPARATOR, $tnlAdr['path']) . $tnlAdr['filename'];
+        }
 
         $fileContent = file_get_contents($pathToThumbnail);
         if ($fileContent === false) {
diff --git a/src/app/resource/controllers/StoreController.php b/src/app/resource/controllers/StoreController.php
index c0b7801fb1ed9d3e8b8679841483f9a6be1c652e..d3f86b38d725351dffeaeb2331f9a234d34cf7c0 100644
--- a/src/app/resource/controllers/StoreController.php
+++ b/src/app/resource/controllers/StoreController.php
@@ -73,7 +73,7 @@ class StoreController
             $resId = false;
             if ($aArgs['table'] == 'res_letterbox') {
                 $resId = ResModel::create($data);
-                ConvertThumbnailController::convert(['collId' => 'letterbox_coll', 'resId' => 260]);
+                ConvertThumbnailController::convert(['collId' => 'letterbox_coll', 'resId' => $resId]);
             } elseif ($aArgs['table'] == 'res_attachments') {
                 $resId = AttachmentModel::create($data);
             }
diff --git a/src/app/signatureBook/controllers/SignatureBookController.php b/src/app/signatureBook/controllers/SignatureBookController.php
index c51f0ee0e2cce0626cd8cc9bb6286b4808232eb0..f565581e7ef605d5d924816fcaa3f0e9cbe8bbd9 100644
--- a/src/app/signatureBook/controllers/SignatureBookController.php
+++ b/src/app/signatureBook/controllers/SignatureBookController.php
@@ -170,7 +170,7 @@ class SignatureBookController
                 'title'         => $incomingMail['subject'],
                 'category_id'   => $incomingMail['category_id'],
                 'viewerLink'    => "index.php?display=true&dir=indexing_searching&page=view_resource_controler&visu&id={$resId}&collid=letterbox_coll",
-                'thumbnailLink' => "index.php?page=doc_thumb&module=thumbnails&res_id={$resId}&coll_id=letterbox_coll&display=true&advanced=true"
+                'thumbnailLink' => "rest/res/{$resId}/thumbnail"
             ]
         ];
 
@@ -202,7 +202,7 @@ class SignatureBookController
                 'format'        => $value['format'],
                 'isConverted'   => $isConverted,
                 'viewerLink'    => "index.php?display=true&module=visa&page=view_pdf_attachement&res_id_master={$resId}&id={$viewerId}",
-                'thumbnailLink' => "index.php?page=doc_thumb&module=thumbnails&res_id={$value['res_id']}&coll_id=attachments_coll&display=true&advanced=true"
+                'thumbnailLink' => "rest/res/{$value['res_id']}/thumbnail"
             ];
         }
 
@@ -317,8 +317,6 @@ class SignatureBookController
             $attachments[$key]['icon'] = $attachmentTypes[$value['attachment_type']]['icon'];
             $attachments[$key]['sign'] = $attachmentTypes[$value['attachment_type']]['sign'];
 
-            $attachments[$key]['thumbnailLink'] = "index.php?page=doc_thumb&module=thumbnails&res_id={$realId}&coll_id={$collId}&display=true&advanced=true";
-
             if(!in_array(strtoupper($value['format']), ['PDF', 'JPG', 'JPEG', 'PNG', 'GIF']) ){
                 $isVersion = 'false';
             }