diff --git a/visa/trunk/js/functions.js b/visa/trunk/js/functions.js
index ce5bbf1710bf8ac064ea2c38252a67704a25222a..fcc9df83a870e1b0754bc6b6fa2fdbdcdb57a8ab 100644
--- a/visa/trunk/js/functions.js
+++ b/visa/trunk/js/functions.js
@@ -746,6 +746,7 @@ function hasAllAnsSigned(id_doc){
 
 function signFile(res_id,isVersion, mode, pinCode){
 	var reg = /^[0-9]{4}$/;
+	var func_onclic;
 	if(pinCode == undefined || pinCode=='')
     {
         pinCode='';
@@ -828,8 +829,8 @@ function signFile(res_id,isVersion, mode, pinCode){
 					else{
 						$(zone_id).style.visibility = 'hidden';
 					}
-					$('ans_'+num_rep+'_'+newId).innerHTML='<i class="fa fa-certificate fa-lg fa-fw" style="color:#fdd16c"></i>'+$('ans_'+num_rep+'_'+newId).textContent;
-					$('ans_'+num_rep+'_'+newId).title='Réponse signée : '+$('ans_'+num_rep+'_'+newId).textContent;
+					$('ans_'+num_rep+'_'+newId).innerHTML='<i class="fa fa-certificate fa-lg fa-fw" style="color:#fdd16c"></i>Réponse signée';
+					$('ans_'+num_rep+'_'+newId).title=$('ans_'+num_rep+'_'+newId).title;
 					$('list_attach').src = 'index.php?display=true&module=attachments&page=frame_list_attachments&template_selected=documents_list_attachments_simple&load&attach_type_exclude=converted_pdf,print_folder';
 				
 					nb_atach = $("nb_attach").textContent;
@@ -838,6 +839,8 @@ function signFile(res_id,isVersion, mode, pinCode){
 				}
 				else{
 					alert(response.error);
+					console.log(func_onclic);
+					$("sign_link").setAttribute('onclick',func_onclic);
 				}	
 				//$("sign_link").removeAttribute("onclick");
 				//$("sign_link_img").style.display = 'none';
@@ -847,6 +850,7 @@ function signFile(res_id,isVersion, mode, pinCode){
 				$("sign_link_img").style.display = '';
 			},
 			onLoading: function(answer){
+				func_onclic = $("sign_link").getAttribute("onclick");
 				$("sign_link").removeAttribute("onclick");
 				$("sign_link_img").style.display = 'none';
 				$('sign_link').className = 'fa fa-spinner fa-2x fa-spin';
diff --git a/visa/trunk/sign_file.php b/visa/trunk/sign_file.php
index 78d0839d46f04dd575a9063eaa9c1cb08af6ae3f..f34c0bf3c8c38589e72f3afac87cd405a636bc50 100644
--- a/visa/trunk/sign_file.php
+++ b/visa/trunk/sign_file.php
@@ -33,20 +33,22 @@ if (!empty($_REQUEST['id']) && !empty($_REQUEST['collId'])){
 	$db = new Database();
     if (isset($_REQUEST['isVersion'])) {
 
-        $stmt = $db->query("select res_id_version, format, res_id_master, title, identifier, type_id from "
+        $stmt = $db->query("select res_id_version, format, res_id_master, title, identifier, type_id, attachment_type from "
             . $tableName 
             . " where (attachment_type = ? or attachment_type = ? or attachment_type = ? or attachment_type = 'transfer') and res_id_version = ?", array('response_project', 'outgoing_mail', 'waybill', $objectId));
     } elseif (isset($_REQUEST['isOutgoing'])) {
 
-        $stmt = $db->query("select res_id, format, res_id_master, title, identifier, type_id from " 
+        $stmt = $db->query("select res_id, format, res_id_master, title, identifier, type_id, attachment_type from " 
             . $tableName 
             . " where attachment_type = ? and res_id = ?", array('outgoing_mail', $objectId));
     } else {
-        $stmt = $db->query("select res_id, format, res_id_master, title, identifier, type_id from ".$tableName." where (attachment_type = ? or attachment_type = ? or attachment_type = 'transfer') and res_id = ?", array('response_project','waybill', $objectId));
+        $stmt = $db->query("select res_id, format, res_id_master, title, identifier, type_id, attachment_type from ".$tableName." where (attachment_type = ? or attachment_type = ? or attachment_type = 'transfer') and res_id = ?", array('response_project','waybill', $objectId));
     }
 	
     if ($stmt->rowCount() < 1) {
-		$_SESSION['error'] = _FILE . ' ' . _UNKNOWN;
+    	echo "{status:1, error : '". _FILE . ' ' . _UNKNOWN ."'}";
+		exit;
+		//$_SESSION['error'] = _FILE . ' ' . _UNKNOWN;
     } 
 	else {
 		$line = $stmt->fetchObject();
diff --git a/visa/trunk/visa_mail.php b/visa/trunk/visa_mail.php
index d8dd54c364a26d6f5da542b780c83bec9c518dcc..abcad58ff1a2fa818c03f8b9b37abd7c528b2aba 100644
--- a/visa/trunk/visa_mail.php
+++ b/visa/trunk/visa_mail.php
@@ -385,17 +385,17 @@ function get_form_txt($values, $path_manage_action,  $id_action, $table, $module
 		if ($viewMode == 'verysmall') {
 			$titleRep = $i + 1;
 		} elseif ($viewMode == 'small') {
-			$titleRep = substr($tab_path_rep_file[$i]['title'],0,10);
+			$titleRep = substr($_SESSION['attachment_types'][$tab_path_rep_file[$i]['attachment_type']],0,10);
 		} else {
-			if (strlen($tab_path_rep_file[$i]['title']) > 15) $titleRep = substr($tab_path_rep_file[$i]['title'],0,15) . '...';
+			if (strlen($tab_path_rep_file[$i]['title']) > 15) $titleRep = substr($_SESSION['attachment_types'][$tab_path_rep_file[$i]['attachment_type']],0,15) . '...';
 			else $titleRep = $tab_path_rep_file[$i]['title'];
 		}
 		if ($tab_path_rep_file[$i]['attachment_type'] == 'signed_response') {
-			$titleRep = '<i style="color:#fdd16c" class="fa fa-certificate fa-lg fa-fw"></i>' . $_SESSION['attachment_types'][$tab_path_rep_file[$i]['attachment_type']];
+			$titleRep = '<i style="color:#fdd16c" class="fa fa-certificate fa-lg fa-fw"></i>' . $titleRep;
 		}
 		$frm_str .= '<dt title="'  
 				. $tab_path_rep_file[$i]['title'] . '" id="ans_'.$num_rep.'_'.$tab_path_rep_file[$i]['res_id'].'" onclick="updateFunctionModifRep(\''
-				. $tab_path_rep_file[$i]['res_id'].'\', '.$num_rep.', '.$tab_path_rep_file[$i]['is_version'].');">'.$_SESSION['attachment_types'][$tab_path_rep_file[$i]['attachment_type']]
+				. $tab_path_rep_file[$i]['res_id'].'\', '.$num_rep.', '.$tab_path_rep_file[$i]['is_version'].');">'.$titleRep
 				. '</dt><dd id="content_'.$num_rep.'_'.$tab_path_rep_file[$i]['res_id'].'">';
 		$frm_str .= '<iframe src="'.$_SESSION['config']['businessappurl'].'index.php?display=true&module=visa&page=view_pdf_attachement&res_id_master='.$res_id.'&id='.$tab_path_rep_file[$i]['res_id'].'" name="viewframevalidRep'.$num_rep.'" id="viewframevalidRep'.$num_rep.'_'.$tab_path_rep_file[$i]['res_id'].'"  scrolling="auto" frameborder="0" style="width:100%;height:100%;" ></iframe>';
 		$frm_str .= '</dd>';
@@ -508,7 +508,7 @@ function get_form_txt($values, $path_manage_action,  $id_action, $table, $module
 		//$frm_str .= '<input type="hidden" name="next_resId" id="next_resId" value="'.$nextId.'" >';
 		$frm_str .= '</form>';
 		$frm_str .= '</td>';
-		$frm_str .= '<td style="width:25%";">';	
+		$frm_str .= '<td style="width:25%;">';	
 		//if ($core->test_service('sign_document', 'visa', false) && $currentStatus == 'ESIG') {
 		if ($core->test_service('sign_document', 'visa', false) ) {
 			$color = ' style="float:left;color:#666;" ';