diff --git a/apps/maarch_entreprise/class/class_lists_Abstract.php b/apps/maarch_entreprise/class/class_lists_Abstract.php
index cb10c2f64aa4f23eed2debdc9e7d42c34da88726..c3c78b3cd707e15512612717ef1cbd885e198b56 100755
--- a/apps/maarch_entreprise/class/class_lists_Abstract.php
+++ b/apps/maarch_entreprise/class/class_lists_Abstract.php
@@ -3448,7 +3448,7 @@ abstract class lists_Abstract extends Database
         if (!isset($parameters['searchBoxAutoCompletionMinChars'])){ $parameters['searchBoxAutoCompletionMinChars']= 1; }
         if (!isset($parameters['searchBoxAutoCompletionUpdate'])){ $parameters['searchBoxAutoCompletionUpdate']= false; }
         if (!isset($parameters['viewDocumentLink'])){ $parameters['viewDocumentLink'] = $_SESSION['config']['businessappurl']
-            .'index.php?display=true&dir=indexing_searching&page=view_resource_controler';}
+            .'index.php?display=true&editingMode=true&dir=indexing_searching&page=view_resource_controler';}
         if (!isset($parameters['viewDetailsLink'])){ $parameters['viewDetailsLink'] = $_SESSION['config']['businessappurl']
             .'index.php?page=details&dir=indexing_searching';}
         if (!isset($parameters['bool_changeLinesToShow'])){ $parameters['bool_changeLinesToShow'] =  true;}
diff --git a/apps/maarch_entreprise/indexing_searching/details.php b/apps/maarch_entreprise/indexing_searching/details.php
index 3093efd2c95b2c4fa6e394382d274331bec98ba4..698ad6267d7c7dcfc239c711f57a3208a713ffea 100755
--- a/apps/maarch_entreprise/indexing_searching/details.php
+++ b/apps/maarch_entreprise/indexing_searching/details.php
@@ -530,7 +530,7 @@ if ((!empty($_SESSION['error']) && ! ($_SESSION['indexation'] ))  )
                 </p>
                 <p id="viewdoc">
                     <?php if($info_mail->filename){?>
-                        <a href="index.php?display=true&dir=indexing_searching&page=view_resource_controler&id=<?php functions::xecho($s_id);?>" 
+                        <a href="index.php?display=true&editingMode=true&dir=indexing_searching&page=view_resource_controler&id=<?php functions::xecho($s_id);?>" 
                             target="_blank"><i class="fa fa-download fa-2x" title="<?php echo _VIEW_DOC; ?>"></i></a>
                     <?php } ?>
                     &nbsp;&nbsp;&nbsp;
diff --git a/modules/thumbnails/class/class_modules_tools.php b/modules/thumbnails/class/class_modules_tools.php
index 27923de8f9073f87159e94f7f5f9a099e07c4111..008bbe26d17b777021a196126363c5b0eae9e181 100755
--- a/modules/thumbnails/class/class_modules_tools.php
+++ b/modules/thumbnails/class/class_modules_tools.php
@@ -173,20 +173,29 @@ class thumbnails
 
 		$catId = $stmt->fetchObject()->category_id;
 
-		$query = "select count(*) as total from res_view_attachments"
-			   . " where res_id_master = ? AND status NOT IN ('DEL','OBS','TMP') AND attachment_type = ?";
+		$query = "SELECT res_id, filename FROM res_view_attachments WHERE status <> 'DEL' and status <> 'OBS' "
+                    . "and res_id_master = ? and attachment_type = 'outgoing_mail' order by res_id desc";
 			   
-		$stmt = $db->query($query, array($res_id,'outgoing_mail'));
+		$stmt = $db->query($query, array($res_id));
+
+		$isOutgoingPj = $stmt->fetchObject();
 
-		$isOutgoingPj = $stmt->fetchObject()->total;
+		if($catId == 'outgoing' && !empty($isOutgoingPj)){
+			// $stmt = $db->query("SELECT tnl_path, tnl_filename FROM res_attachments WHERE res_id_master = ? AND status NOT IN ('DEL','OBS','TMP') AND type_id = '1'", array($res_id));
+				$stmtPdf = $db->query(
+                    "SELECT tnl_path, tnl_filename
+                     FROM res_attachments
+                     WHERE filename=? AND (status = 'TRA' or status = 'A_TRA')", array(substr($isOutgoingPj->filename, 0, strrpos($isOutgoingPj->filename, ".")).'.pdf')
+                );
 
-		if($catId == 'outgoing' && $isOutgoingPj > 0){
-			$stmt = $db->query("SELECT tnl_path, tnl_filename FROM res_attachments WHERE res_id_master = ? AND status NOT IN ('DEL','OBS','TMP') AND type_id = '1'", array($res_id));
+                $linePdf = $stmtPdf->fetchObject();
+                if(!empty($linePdf)){
+                    $data = $linePdf;
+                }
 		}else{
 			$stmt = $db->query("SELECT tnl_path, tnl_filename FROM $table WHERE res_id = ?", array($res_id));
+			$data = $stmt->fetchObject();
 		}
-
-		$data = $stmt->fetchObject();
 		
 		$tnlPath = str_replace("#", DIRECTORY_SEPARATOR , $data->tnl_path);
 		$tnlFilename = $data->tnl_filename;
@@ -285,4 +294,3 @@ class thumbnails
 	}
 
 }
-