diff --git a/apps/maarch_entreprise/admin/contacts/contact_types/contact_types_up.php b/apps/maarch_entreprise/admin/contacts/contact_types/contact_types_up.php
index 41a496c7c5327a9437fcada0f51fff0270f62cdc..cf3777dcdbfc7862003adeed90223f875918815e 100644
--- a/apps/maarch_entreprise/admin/contacts/contact_types/contact_types_up.php
+++ b/apps/maarch_entreprise/admin/contacts/contact_types/contact_types_up.php
@@ -32,6 +32,7 @@ require "core" . DIRECTORY_SEPARATOR . "class" . DIRECTORY_SEPARATOR
     . "class_history.php";
 $core = new core_tools();
 $core->test_admin('admin_contacts', 'apps');
+$core->load_lang();
 
 $mode = "";
 if (isset($_GET['id']) && ! empty($_GET['id'])) {
diff --git a/apps/maarch_entreprise/class/class_business_app_tools_Abstract.php b/apps/maarch_entreprise/class/class_business_app_tools_Abstract.php
index d84ed10a1e4f4d301303901a3955f6280e8e5b70..983709eeb821f3969618afca1112b41c2991f895 100755
--- a/apps/maarch_entreprise/class/class_business_app_tools_Abstract.php
+++ b/apps/maarch_entreprise/class/class_business_app_tools_Abstract.php
@@ -626,7 +626,7 @@ abstract class business_app_tools_Abstract extends Database
             if (($_SESSION['maarch_entreprise']['xml_versionbase'] <> $_SESSION['maarch_entreprise']['database_version'])
                 || ($_SESSION['maarch_entreprise']['database_version'] == 'none')
             ) {
-                $_SESSION['error'] .= _VERSION_BASE_AND_XML_BASEVERSION_NOT_MATCH;
+                $_SESSION['error'] .= _VERSION_BASE_AND_XML_BASEVERSION_NOT_MATCH. "(".$_SESSION['maarch_entreprise']['xml_versionbase']."/".$_SESSION['maarch_entreprise']['database_version'].")";
             }
         }
     }
diff --git a/apps/maarch_entreprise/merged_css.php b/apps/maarch_entreprise/merged_css.php
index 4959cf170c97a9308cdab72c12390750759b1344..108e78323274d2ded33c5f78f5424ddcae8dca44 100644
--- a/apps/maarch_entreprise/merged_css.php
+++ b/apps/maarch_entreprise/merged_css.php
@@ -48,5 +48,7 @@ readfile('node_modules/tooltipster/dist/css/tooltipster.bundle.min.css');
 readfile('node_modules/photoswipe/dist/photoswipe.css');
 readfile('node_modules/photoswipe/dist/default-skin/default-skin.css');
 
+include_once 'apps/' . $_SESSION['config']['app_id'] . '/css/photoswipe_custom.css';
+
 ob_end_flush();
 
diff --git a/apps/maarch_entreprise/smartphone/details.php b/apps/maarch_entreprise/smartphone/details.php
index 0f3f4a6f271693b1bc2ec87c1075e9c7e0be95bb..4b703eff78eb73c795aa5fb8f9a3c3f1f934a44e 100755
--- a/apps/maarch_entreprise/smartphone/details.php
+++ b/apps/maarch_entreprise/smartphone/details.php
@@ -173,6 +173,10 @@ if (isset($_REQUEST['res_id_master'])){
     $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;
 
@@ -180,7 +184,7 @@ if (isset($_REQUEST['res_id_master'])){
 }
 else{
     $path = $tnl->getPathTnl($s_id, $coll_id);
-    if (!is_file($path)) $path=$tnl->generateTnl($pdf_id, $coll_id);
+    if (!is_file($path)) $path=$tnl->generateTnl($s_id, $coll_id);
 }
 ?>
 <div id="details" title="Détails" class="panel">
@@ -208,7 +212,6 @@ else{
 		}
 		?>
 	
-	<br />
     <hr/>
     <?php
     if($core->is_module_loaded('notes')) {
@@ -234,6 +237,7 @@ else{
     }
     if ($_SESSION['current_basket']['id'] == "EsigBasket" && $infos_attach['attachment_type'] != 'signed_response'){
         ?>
+            
         <a href="signature_main_panel.php?id=<?php functions::xecho($s_id);?>&collId=<?php
                     functions::xecho($_SESSION['collection_id_choice']);
         ?>&tableName=<?php
@@ -241,10 +245,11 @@ else{
         ?>&res_id_attach=<?php
             functions::xecho($att_id);
         ?>">
-            <span class="bubble"><img src="<?php
-            functions::xecho($_SESSION['config']['businessappurl'])
-            ?>smartphone/img/sign.png" alt="Signer" style="height:22px;"/></span>
+            <span class="bubble"><i class="fa fa-certificate fa-2x mCdarkGrey" aria-hidden="true"></i></span>
         </a>
+
+        <span class="bubble" style="cursor: pointer" 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/smartphone/js/iui/iui.css b/apps/maarch_entreprise/smartphone/js/iui/iui.css
index b334dbb6aa5a3fb4e6d8713ed10fd4bdcb95b972..98f7f5dee0c3b32eb06accf262e6bfeaa49baf07 100755
--- a/apps/maarch_entreprise/smartphone/js/iui/iui.css
+++ b/apps/maarch_entreprise/smartphone/js/iui/iui.css
@@ -19,7 +19,7 @@ body > *:not(.toolbar) {
     margin: 0;
     padding: 0;
     left: 0;
-    top: 45px;
+    top: 40px;
     width: 100%;
     height: auto;
     min-height: 415px;
@@ -56,7 +56,7 @@ body > .toolbar {
     border-bottom: 1px solid #2d3642;
     border-top: 1px solid #6d84a2;
     padding: 0 10px 10px 10px;
-    height: 45px;
+    height: 40px;
 }
 
 .toolbar > h1 {
@@ -65,8 +65,8 @@ body > .toolbar {
     left: 50%;
     margin: 1px 0 0 -75px;
     padding-top: 10px;
-    height: 45px;
-    font-size: 20px;
+    height: 40px;
+    font-size: 18px;
     width: 150px;
     font-weight: bold;
     text-shadow: rgba(0, 0, 0, 0.4) 0px -1px 0;
diff --git a/apps/maarch_entreprise/smartphone/js/maarch_functions.js b/apps/maarch_entreprise/smartphone/js/maarch_functions.js
index 26010784b9cda19e4b7054164dd1275e528c0771..21e9a6a44b0a1383bebfdc04b36db0dfdc2446c9 100755
--- a/apps/maarch_entreprise/smartphone/js/maarch_functions.js
+++ b/apps/maarch_entreprise/smartphone/js/maarch_functions.js
@@ -262,8 +262,11 @@ function clean(){
     if(document.getElementById('notes')){
         document.getElementById('notes').parentNode.removeChild(document.getElementById('notes'));
     }
-    else if(document.getElementById('load_user_signatures')){ 
-           document.getElementById('load_user_signatures').parentNode.removeChild(document.getElementById('load_user_signatures'));
+    else if(document.getElementById('signature_recap')){ 
+           document.getElementById('signature_recap').parentNode.removeChild(document.getElementById('signature_recap'));
+    }
+    else if(document.getElementById('sign_main_panel')){ 
+           document.getElementById('sign_main_panel').parentNode.removeChild(document.getElementById('sign_main_panel'));
     }
     else if(document.getElementById('sign_main_panel')){ 
            document.getElementById('sign_main_panel').parentNode.removeChild(document.getElementById('sign_main_panel'));
@@ -330,7 +333,35 @@ function replaceFrameResize(){
     ifrm.setAttribute("id", "ifrm");
     ifrm.setAttribute("scrolling", "no");
     
-    ifrm.style.height = window.innerHeight - 100 + "px";
+    ifrm.style.height = window.innerHeight - 120 + "px";
+    ifrm.style.width = window.innerWidth - 5 + "px";
+    frameThumb.appendChild(ifrm);
+    frameThumb.removeChild(cur_frm);
+  }
+}
+
+function switchFrame(path, res_id, id_ans){
+  var frameThumb = document.getElementById('frameThumb');
+  if (frameThumb){
+    var cur_frm = document.getElementById('ifrm');
+
+    var cur_show = document.getElementById('type_doc_show').value;
+    if (cur_show == 'attach'){
+      var link = path+'&res_id='+res_id+'&coll_id=letterbox_coll';
+      document.getElementById('type_doc_show').value = 'doc';
+    }
+    else{
+      var link = path+'&res_id='+res_id+'&coll_id=letterbox_coll&res_id_attach='+id_ans;
+      document.getElementById('type_doc_show').value = 'attach';
+    }
+    
+    var ifrm = document.createElement("IFRAME");
+    ifrm.setAttribute("src", link);
+    ifrm.setAttribute("frameborder", "0");
+    ifrm.setAttribute("id", "ifrm");
+    ifrm.setAttribute("scrolling", "no");
+    
+    ifrm.style.height = window.innerHeight - 120 + "px";
     ifrm.style.width = window.innerWidth - 5 + "px";
     frameThumb.appendChild(ifrm);
     frameThumb.removeChild(cur_frm);
diff --git a/apps/maarch_entreprise/smartphone/signature_main_panel.php b/apps/maarch_entreprise/smartphone/signature_main_panel.php
index e5275e3c8c043454fd12703b4e284ecb5225cef1..39f9336e6d88e4628e67ff02ed4bce8ea6e4cd2f 100644
--- a/apps/maarch_entreprise/smartphone/signature_main_panel.php
+++ b/apps/maarch_entreprise/smartphone/signature_main_panel.php
@@ -126,9 +126,7 @@ $subject = $res->subject;
            <span class="action_but_sign stampBut" data-action="stampBut" id="stampBut"><i class="fa fa-certificate fa-2x" aria-hidden="true"></i></span>-->
            <span class="action_but_sign clearBut disabled_but" data-action="clearBut" id="clearBut"><i class="fa fa-eraser fa-2x" aria-hidden="true"></i>Effacer</span>
            <!-- <span class="action_but_sign addBut" data-action="addBut"><i class="fa fa-bookmark fa-2x" aria-hidden="true"></i>Ajouter</span> -->
-          <span class="action_but_sign saveBut disabled_but" data-action="saveBut" id="saveBut"><img src="<?php
-            functions::xecho($_SESSION['config']['businessappurl'])
-            ?>smartphone/img/sign.png" />Signer <span id="loading_sign" style="display:none;"><i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i></span></span>
+          <span class="action_but_sign saveBut disabled_but" data-action="saveBut" id="saveBut"><i class="fa fa-certificate fa-2x" aria-hidden="true"></i>Signer <span id="loading_sign" style="display:none;"><i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i></span></span>
         </div>
     </div>  
 
diff --git a/apps/maarch_entreprise/smartphone/view_attachments.php b/apps/maarch_entreprise/smartphone/view_attachments.php
index 76fe7120cc04d74b3382c610ac25ed5d4e2cc006..377fe670b491dd7dd8f73113412cea05222ebdfd 100644
--- a/apps/maarch_entreprise/smartphone/view_attachments.php
+++ b/apps/maarch_entreprise/smartphone/view_attachments.php
@@ -17,7 +17,7 @@ $_SESSION['doc_id'] = $s_id;
 
 
 $_SESSION['collection_id_choice'] = $_SESSION['current_basket']['coll_id'];
-$whereRequest = " res_id_master = $s_id and attachment_type <> 'simple_attachement' and attachment_type <> 'converted_pdf' and status <> 'SIGN'";
+$whereRequest = " res_id_master = $s_id and attachment_type <> 'simple_attachement' and attachment_type <> 'converted_pdf' and status <> 'SIGN' and status <> 'DEL'";
 $basket_label = _RESPONSE_PROJECTS;
 $view = 'res_view_attachments';
 
diff --git a/apps/maarch_entreprise/tools/signature_pad/css/signature-pad.css b/apps/maarch_entreprise/tools/signature_pad/css/signature-pad.css
index 8a0d8802113c05c5c21645f2d4c977fb78e47796..eba9269b5854743ec1708379a7d37c04a9c310da 100644
--- a/apps/maarch_entreprise/tools/signature_pad/css/signature-pad.css
+++ b/apps/maarch_entreprise/tools/signature_pad/css/signature-pad.css
@@ -43,9 +43,9 @@
 .m-signature-pad--body {
   position: absolute;
   left: 120px;
-  right: 20px;
-  top: 20px;
-  bottom: 60px;
+  right: 5px;
+  top: 5px;
+  bottom: 45px;
   border: 1px solid #f4f4f4;
 }
 
@@ -63,8 +63,8 @@
 .m-signature-pad--left {
   position: absolute;
   left: 0px;
-  top: 20px;
-  bottom: 60px;
+  top: 5px;
+  bottom: 50px;
   width: 120px;
 }
 
@@ -101,7 +101,7 @@
   position: absolute;
   left: 20px;
   right: 20px;
-  bottom: 20px;
+  bottom: 5px;
   height: 40px;
 }
 
diff --git a/modules/thumbnails/class/class_modules_tools.php b/modules/thumbnails/class/class_modules_tools.php
index ae6b6161f45a3a507881d6ed0bfffd56a3c06883..1e017031c84540205c393210319d291bd4e51c82 100644
--- a/modules/thumbnails/class/class_modules_tools.php
+++ b/modules/thumbnails/class/class_modules_tools.php
@@ -53,7 +53,6 @@ class thumbnails
 		$db = new Database();
 		$query = "select priority_number, docserver_id from docservers where is_readonly = 'N' and "
 	   . " enabled = 'Y' and coll_id = ? and docserver_type_id = 'TNL' order by priority_number";
-
 		$stmt1 = $db->query($query, array($coll_id));
 
 		if($res = $stmt1->fetchObject()){
@@ -63,13 +62,13 @@ class thumbnails
 		}
 
 		$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));
 
@@ -77,6 +76,7 @@ class thumbnails
 			$fileFormat = $queryResult->format;
 			$path= $queryResult->path;
 			$filename= $queryResult->filename;
+
 			$pathToFile = $pathToDocServer[$queryResult->docserver_id] 
 			. str_replace("#", DIRECTORY_SEPARATOR, $path)
         	. $queryResult->filename;
@@ -119,6 +119,7 @@ class thumbnails
 					. escapeshellarg($outputPathFile);
 				}
 			}
+			echo $command;
 			exec($command.' 2>&1', $output, $result);
 			if($result > 0)
 			{
diff --git a/modules/thumbnails/doc_thumb_frame.php b/modules/thumbnails/doc_thumb_frame.php
index 94824abe5948ca831d49e2d99f4b04601b777bbf..08f729df0cced60b7565b0e1b78c8e0e4b77f1c9 100644
--- a/modules/thumbnails/doc_thumb_frame.php
+++ b/modules/thumbnails/doc_thumb_frame.php
@@ -39,10 +39,13 @@
 			<div class="pswp__item"></div>
 			<div class="pswp__item"></div>
 		</div>
-
-		<div class="pswp__ui pswp__ui--hidden">
+		<?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>
+				<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>-->