diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php
index 8904c9b77c9687f1a7d43c5d875724ed5bfeb6e1..83e8cd88fafd00448abdca0eb93bce56efc8cc75 100644
--- a/htdocs/adherents/document.php
+++ b/htdocs/adherents/document.php
@@ -113,7 +113,6 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
     $langs->load("other");
 	$file = $upload_dir . "/" . GETPOST('urlfile');	// Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
 	dol_delete_file($file);
-	setEventMessage($langs->trans("FileWasRemoved",GETPOST('urlfile')));
     Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
     exit;
 }
diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php
index 897e91a8c0aca630a4ab57ecfb287e4f9668c5ab..42492974a1ef230c848f987a0bcf3ac660a81eee 100644
--- a/htdocs/admin/mails.php
+++ b/htdocs/admin/mails.php
@@ -148,10 +148,6 @@ if (! empty($_POST['removedfile']) || ! empty($_POST['removedfilehtml']))
 		$result = dol_delete_file($pathtodelete,1);
 		if ($result >= 0)
 		{
-            $langs->load("other");
-		    $message = '<div class="ok">'.$langs->trans("FileWasRemoved",$filetodelete).'</div>';
-			//print_r($_FILES);
-
 			include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php');
 			$formmail = new FormMail($db);
 			$formmail->remove_attached_files($keytodelete);
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index 1d9612271cf0c770396203203431f87175149701..938f8b77680cae77c026db25147bc9ebbc5c5598 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -1,7 +1,7 @@
 <?php
 /* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  * Copyright (C) 2004-2011 Laurent Destailleur  <eldy@users.sourceforge.net>
- * Copyright (C) 2005-2011 Regis Houssin        <regis@dolibarr.fr>
+ * Copyright (C) 2005-2012 Regis Houssin        <regis@dolibarr.fr>
  * Copyright (C) 2011	   Juanjo Menent        <jmenent@2byte.es>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -43,6 +43,7 @@ class ActionComm extends CommonObject
     var $type;
     var $label;
 
+    var $date;
     var $datec;			// Date creation record (datec)
     var $datem;			// Date modification record (tms)
     var $author;		// Object user that create action
diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php
index 596e18b90321e506ed25eedb1db599cabceb08e1..b95cc35a04f3eec7b9545c3d51d0fa748269d7bc 100644
--- a/htdocs/comm/mailing/fiche.php
+++ b/htdocs/comm/mailing/fiche.php
@@ -495,7 +495,7 @@ if (! empty($_POST['addfile']))
 	require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
 
     // Set tmp user directory
-    $mesg=dol_add_file_process($upload_dir,0,0);
+    dol_add_file_process($upload_dir,0,0);
 
 	$action="edit";
 }
@@ -507,7 +507,7 @@ if (! empty($_POST["removedfile"]))
 
 	require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
 
-    $mesg=dol_remove_file_process($_POST['removedfile'],0);
+    dol_remove_file_process($_POST['removedfile'],0);
 
 	$action="edit";
 }
diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index 1d1262b339b450baaa6f9cd2ad3506ce296b4219..8b024de3442b4fca6f5893897ca0361ca7f59fe2 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -62,8 +62,6 @@ $search_societe=GETPOST('search_societe','alpha');
 $search_montant_ht=GETPOST('search_montant_ht','alpha');
 
 $sall=GETPOST("sall");
-$mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));
-$mesgs=array();
 $year=GETPOST("year");
 $month=GETPOST("month");
 
@@ -98,6 +96,7 @@ $object = new Propal($db);
 if ($id > 0 || ! empty($ref))
 {
 	$ret=$object->fetch($id, $ref);
+	$object->fetch_thirdparty();
 }
 
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
@@ -119,11 +118,11 @@ if ($action == 'confirm_clone' && $confirm == 'yes')
 {
 	if (1==0 &&  ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
 	{
-		$mesg='<div class="error">'.$langs->trans("NoCloneOptionsSpecified").'</div>';
+		setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors');
 	}
 	else
 	{
-		if ($object->fetch($id) > 0)
+		if ($object->id > 0)
 		{
 			$result=$object->createFromClone($socid, $hookmanager);
 			if ($result > 0)
@@ -133,7 +132,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes')
 			}
 			else
 			{
-				$mesg=$object->error;
+				setEventMessage($object->error, 'errors');
 				$action='';
 			}
 		}
@@ -143,8 +142,6 @@ if ($action == 'confirm_clone' && $confirm == 'yes')
 // Suppression de la propale
 else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->propale->supprimer)
 {
-	$object->fetch($id);
-	$object->fetch_thirdparty();
 	$result=$object->delete($user);
 	if ($result > 0)
 	{
@@ -154,16 +151,13 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->prop
 	else
 	{
 		$langs->load("errors");
-		if ($object->error == 'ErrorFailToDeleteDir') $mesg='<div class="error">'.$langs->trans('ErrorFailedToDeleteJoinedFiles').'</div>';
-		else $mesg='<div class="error">'.$object->error.'</div>';
+		setEventMessage($langs->trans($object->error), 'errors');
 	}
 }
 
 // Remove line
 else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->propale->creer)
 {
-	$object->fetch($id);
-	$object->fetch_thirdparty();
 	$result = $object->deleteline($lineid);
 	// reorder lines
 	if ($result) $object->line_order(true);
@@ -171,7 +165,7 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->
 	// Define output language
 	$outputlangs = $langs;
 	$newlang='';
-	if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
+	if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
 	if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
 	if (! empty($newlang))
 	{
@@ -191,16 +185,13 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->
 // Validation
 else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->propale->valider)
 {
-	$object->fetch($id);
-	$object->fetch_thirdparty();
-
 	$result=$object->valid($user);
 	if ($result >= 0)
 	{
 		// Define output language
 		$outputlangs = $langs;
 		$newlang='';
-		if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
+		if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
 		if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
 		if (! empty($newlang))
 		{
@@ -209,13 +200,14 @@ else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->pr
 		}
 		if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
 		{
-            $ret=$object->fetch($id);    // Reload to get new records
+            $ret=$object->fetch($object->id);    // Reload to get new records
 		    propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
 		}
 	}
 	else
 	{
-		$mesg='<div class="error">'.$object->error.'</div>';
+		$langs->load("errors");
+		setEventMessage($langs->trans($object->error), 'errors');
 	}
 }
 
@@ -226,25 +218,22 @@ else if ($action == 'setdate' && $user->rights->propale->creer)
     if (empty($datep))
     {
         $error++;
-        $mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")).'</div>';
+        setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")), 'errors');
     }
 
     if (! $error)
     {
-    	$object->fetch($id);
     	$result=$object->set_date($user,$datep);
     	if ($result < 0) dol_print_error($db,$object->error);
     }
 }
 else if ($action == 'setecheance' && $user->rights->propale->creer)
 {
-	$object->fetch($id);
 	$result=$object->set_echeance($user,dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']));
 	if ($result < 0) dol_print_error($db,$object->error);
 }
 else if ($action == 'setdate_livraison' && $user->rights->propale->creer)
 {
-	$object->fetch($id);
 	$result=$object->set_date_livraison($user,dol_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year']));
 	if ($result < 0) dol_print_error($db,$object->error);
 }
@@ -252,20 +241,17 @@ else if ($action == 'setdate_livraison' && $user->rights->propale->creer)
 // Positionne ref client
 else if ($action == 'set_ref_client' && $user->rights->propale->creer)
 {
-	$object->fetch($id);
 	$object->set_ref_client($user, $_POST['ref_client']);
 }
 
 else if ($action == 'setnote_public' && $user->rights->propale->creer)
 {
-	$object->fetch($id);
 	$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
 	if ($result < 0) dol_print_error($db,$object->error);
 }
 
 else if ($action == 'setnote' && $user->rights->propale->creer)
 {
-	$object->fetch($id);
 	$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
 	if ($result < 0) dol_print_error($db,$object->error);
 }
@@ -291,7 +277,7 @@ else if ($action == 'add' && $user->rights->propale->creer)
     	$db->begin();
 
     	// Si on a selectionne une propal a copier, on realise la copie
-    	if(GETPOST('createmode')=='copy' && GETPOST('copie_propal'))
+    	if (GETPOST('createmode')=='copy' && GETPOST('copie_propal'))
     	{
     		if ($object->fetch(GETPOST('copie_propal')) > 0)
     		{
@@ -318,7 +304,7 @@ else if ($action == 'add' && $user->rights->propale->creer)
     		}
     		else
     		{
-    			$mesg = '<div class="error">'.$langs->trans("ErrorFailedToCopyProposal",GETPOST('copie_propal')).'</div>';
+    			setEventMessage($langs->trans("ErrorFailedToCopyProposal",GETPOST('copie_propal')), 'errors');
     		}
     	}
     	else
@@ -359,21 +345,14 @@ else if ($action == 'add' && $user->rights->propale->creer)
 
     	if ($id > 0)
     	{
-    		$error=0;
-
     		// Insertion contact par defaut si defini
     		if (GETPOST('contactidp'))
     		{
     			$result=$object->add_contact(GETPOST('contactidp'),'CUSTOMER','external');
-
-    			if ($result > 0)
-    			{
-    				$error=0;
-    			}
-    			else
+    			if ($result < 0)
     			{
-    				$mesg = '<div class="error">'.$langs->trans("ErrorFailedToAddContact").'</div>';
-    				$error=1;
+    				$error++;
+    				setEventMessage($langs->trans("ErrorFailedToAddContact"), 'errors');
     			}
     		}
 
@@ -413,44 +392,35 @@ else if ($action == 'add' && $user->rights->propale->creer)
 // Classify billed
 else if ($action == 'classifybilled' && $user->rights->propale->cloturer)
 {
-	$object->fetch($id);
 	$object->cloture($user, 4, '');
 }
 
 // Reopen proposal
-else if ($action == 'confirm_reopen' && $user->rights->propale->cloturer)
+else if ($action == 'confirm_reopen' && $user->rights->propale->cloturer && ! GETPOST('cancel'))
 {
-	if (! $_POST['cancel'])
+	// prevent browser refresh from reopening proposal several times
+	if ($object->statut==2 || $object->statut==3)
 	{
-		$object->fetch($id);
-		// prevent browser refresh from reopening proposal several times
-		if ($object->statut==2 || $object->statut==3)
-		{
-			$object->setStatut(1);
-		}
+		$object->setStatut(1);
 	}
 }
 
 // Close proposal
-else if ($action == 'setstatut' && $user->rights->propale->cloturer)
+else if ($action == 'setstatut' && $user->rights->propale->cloturer && ! GETPOST('cancel'))
 {
-    if (! $_POST['cancel'])
-    {
-        if (! GETPOST('statut'))
-        {
-            $mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("CloseAs")).'</div>';
-            $action='statut';
-        }
-        else
-        {
-            $object->fetch($id);
-            // prevent browser refresh from closing proposal several times
-            if ($object->statut==1)
-            {
-                $object->cloture($user, $_REQUEST['statut'], $_REQUEST['note']);
-            }
-        }
-    }
+	if (! GETPOST('statut'))
+	{
+		setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("CloseAs")), 'errors');
+		$action='statut';
+	}
+	else
+	{
+		// prevent browser refresh from closing proposal several times
+		if ($object->statut==1)
+		{
+			$object->cloture($user, GETPOST('statut'), GETPOST('note'));
+		}
+	}
 }
 
 /*
@@ -464,16 +434,14 @@ if (GETPOST('addfile'))
 	$vardir=$conf->user->dir_output."/".$user->id;
 	$upload_dir_tmp = $vardir.'/temp';
 
-	$mesg=dol_add_file_process($upload_dir_tmp,0,0);
-
+	dol_add_file_process($upload_dir_tmp,0,0);
 	$action='presend';
-	$_POST["action"]='presend';
 }
 
 /*
  * Remove file in email form
  */
-if (! empty($_POST['removedfile']))
+if (GETPOST('removedfile'))
 {
 	require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
 
@@ -482,171 +450,148 @@ if (! empty($_POST['removedfile']))
 	$upload_dir_tmp = $vardir.'/temp';
 
 	// TODO Delete only files that was uploaded from email form
-	$mesg=dol_remove_file_process($_POST['removedfile'],0);
-
+	dol_remove_file_process($_POST['removedfile'],0);
 	$action='presend';
-	$_POST["action"]='presend';
 }
 
 /*
  * Send mail
  */
-if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel'])
+if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! GETPOST('cancel'))
 {
 	$langs->load('mails');
 
-	$result=$object->fetch($_POST["id"]);
-	$result=$object->fetch_thirdparty();
-
-	if ($result > 0)
+	if ($object->id > 0)
 	{
-//		$objectref = dol_sanitizeFileName($object->ref);
-//		$file = $conf->propal->dir_output . '/' . $objectref . '/' . $objectref . '.pdf';
-
-//		if (is_readable($file))
-//		{
-			if ($_POST['sendto'])
+		if ($_POST['sendto'])
+		{
+			// Le destinataire a ete fourni via le champ libre
+			$sendto = $_POST['sendto'];
+			$sendtoid = 0;
+		}
+		elseif ($_POST['receiver'] != '-1')
+		{
+			// Recipient was provided from combo list
+			if ($_POST['receiver'] == 'thirdparty')	// Id of third party
 			{
-				// Le destinataire a ete fourni via le champ libre
-				$sendto = $_POST['sendto'];
+				$sendto = $object->client->email;
 				$sendtoid = 0;
 			}
-			elseif ($_POST['receiver'] != '-1')
+			else	// Id du contact
 			{
-				// Recipient was provided from combo list
-				if ($_POST['receiver'] == 'thirdparty')	// Id of third party
-				{
-					$sendto = $object->client->email;
-					$sendtoid = 0;
-				}
-				else	// Id du contact
-				{
-					$sendto = $object->client->contact_get_property($_POST['receiver'],'email');
-					$sendtoid = $_POST['receiver'];
-				}
+				$sendto = $object->client->contact_get_property($_POST['receiver'],'email');
+				$sendtoid = $_POST['receiver'];
 			}
+		}
 
-			if (dol_strlen($sendto))
+		if (dol_strlen($sendto))
+		{
+			$langs->load("commercial");
+
+			$from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>';
+			$replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>';
+			$message = $_POST['message'];
+			$sendtocc = $_POST['sendtocc'];
+			$deliveryreceipt = $_POST['deliveryreceipt'];
+
+			if (dol_strlen($_POST['subject'])) $subject = $_POST['subject'];
+			else $subject = $langs->transnoentities('Propal').' '.$object->ref;
+			$actiontypecode='AC_PROP';
+			$actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n";
+			if ($message)
 			{
-				$langs->load("commercial");
+				$actionmsg.=$langs->transnoentities('MailTopic').": ".$subject."\n";
+				$actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n";
+				$actionmsg.=$message;
+			}
+			$actionmsg2=$langs->transnoentities('Action'.$actiontypecode);
+
+			// Create form object
+			include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php');
+			$formmail = new FormMail($db);
 
-				$from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>';
-				$replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>';
-				$message = $_POST['message'];
-				$sendtocc = $_POST['sendtocc'];
-				$deliveryreceipt = $_POST['deliveryreceipt'];
+			$attachedfiles=$formmail->get_attached_files();
+			$filepath = $attachedfiles['paths'];
+			$filename = $attachedfiles['names'];
+			$mimetype = $attachedfiles['mimes'];
 
-				if ($_POST['action'] == 'send')
+			// Envoi de la propal
+			require_once(DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php');
+			$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt);
+			if ($mailfile->error)
+			{
+				setEventMessage($mailfile->error, 'errors');
+			}
+			else
+			{
+				$result=$mailfile->sendfile();
+				if ($result)
 				{
-					if (dol_strlen($_POST['subject'])) $subject = $_POST['subject'];
-					else $subject = $langs->transnoentities('Propal').' '.$object->ref;
-					$actiontypecode='AC_PROP';
-					$actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n";
-					if ($message)
-					{
-						$actionmsg.=$langs->transnoentities('MailTopic').": ".$subject."\n";
-						$actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n";
-						$actionmsg.=$message;
+					// Initialisation donnees
+					$object->sendtoid		= $sendtoid;
+					$object->actiontypecode	= $actiontypecode;
+					$object->actionmsg		= $actionmsg;
+					$object->actionmsg2		= $actionmsg2;
+					$object->fk_element		= $object->id;
+					$object->elementtype	= $object->element;
+
+					// Appel des triggers
+					include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
+					$interface=new Interfaces($db);
+					$result=$interface->run_triggers('PROPAL_SENTBYMAIL',$object,$user,$langs,$conf);
+					if ($result < 0) {
+						$error++; $this->errors=$interface->errors;
 					}
-					$actionmsg2=$langs->transnoentities('Action'.$actiontypecode);
-				}
-
-				// Create form object
-				include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php');
-				$formmail = new FormMail($db);
+					// Fin appel triggers
 
-				$attachedfiles=$formmail->get_attached_files();
-				$filepath = $attachedfiles['paths'];
-				$filename = $attachedfiles['names'];
-				$mimetype = $attachedfiles['mimes'];
-
-				// Envoi de la propal
-				require_once(DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php');
-				$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt);
-				if ($mailfile->error)
-				{
-					$mesg='<div class="error">'.$mailfile->error.'</div>';
+					if (! $error)
+					{
+						// Redirect here
+						// This avoid sending mail twice if going out and then back to page
+						$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2));
+						setEventMessage($mesg);
+						Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
+						exit;
+					}
+					else
+					{
+						dol_print_error($db);
+					}
 				}
 				else
 				{
-					$result=$mailfile->sendfile();
-					if ($result)
+					$langs->load("other");
+					if ($mailfile->error)
 					{
-						$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2));	// Must not contain "
-
-						$error=0;
-
-						// Initialisation donnees
-						$object->sendtoid		= $sendtoid;
-						$object->actiontypecode	= $actiontypecode;
-						$object->actionmsg		= $actionmsg;
-						$object->actionmsg2		= $actionmsg2;
-						$object->fk_element		= $object->id;
-						$object->elementtype	= $object->element;
-
-						// Appel des triggers
-						include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
-						$interface=new Interfaces($db);
-						$result=$interface->run_triggers('PROPAL_SENTBYMAIL',$object,$user,$langs,$conf);
-						if ($result < 0) { $error++; $this->errors=$interface->errors; }
-						// Fin appel triggers
-
-						if ($error)
-						{
-							dol_print_error($db);
-						}
-						else
-						{
-							// Redirect here
-							// This avoid sending mail twice if going out and then back to page
-							Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&mesg='.urlencode($mesg));
-							exit;
-						}
+						$mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto);
+						$mesg.='<br>'.$mailfile->error;
 					}
 					else
 					{
-						$langs->load("other");
-						$mesg='<div class="error">';
-						if ($mailfile->error)
-						{
-							$mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto);
-							$mesg.='<br>'.$mailfile->error;
-						}
-						else
-						{
-							$mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
-						}
-						$mesg.='</div>';
+						$mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
 					}
+					setEventMessage($mesg, 'errors');
 				}
 			}
-			else
-			{
-				$langs->load("other");
-				$mesg='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').' !</div>';
-				dol_syslog('Recipient email is empty');
-			}
-/*		}
+		}
 		else
 		{
-			$langs->load("errors");
-			$mesg='<div class="error">'.$langs->trans('ErrorCantReadFile',$file).'</div>';
-			dol_syslog('Failed to read file: '.$file);
-		}*/
+			$langs->load("other");
+			setEventMessage($langs->trans('ErrorMailRecipientIsEmpty').'!', 'errors');
+			dol_syslog($langs->trans('ErrorMailRecipientIsEmpty'));
+		}
 	}
 	else
 	{
 		$langs->load("other");
-		$mesg='<div class="error">'.$langs->trans('ErrorFailedToReadEntity',$langs->trans("Proposal")).'</div>';
-		dol_syslog('Impossible de lire les donnees de la facture. Le fichier propal n\'a peut-etre pas ete genere.');
+		setEventMessage($langs->trans('ErrorFailedToReadEntity',$langs->trans("Proposal")), 'errors');
+		dol_syslog($langs->trans('ErrorFailedToReadEntity',$langs->trans("Proposal")));
 	}
 }
 
 // Go back to draft
 if ($action == 'modif' && $user->rights->propale->creer)
 {
-	$object->fetch($id);
-	$object->fetch_thirdparty();
 	$object->set_draft($user);
 
 	// Define output language
@@ -667,49 +612,33 @@ else if ($action == "setabsolutediscount" && $user->rights->propale->creer)
 {
 	if ($_POST["remise_id"])
 	{
-		$object->id=$id;
-		$ret=$object->fetch($id);
-		if ($ret > 0)
+		if ($object->id > 0)
 		{
 			$result=$object->insert_discount($_POST["remise_id"]);
 			if ($result < 0)
 			{
-				$mesg='<div class="error">'.$object->error.'</div>';
+				setEventMessage($object->error, 'errors');
 			}
 		}
-		else
-		{
-			dol_print_error($db,$object->error);
-		}
 	}
 }
 
 //Ajout d'une ligne produit dans la propale
 else if ($action == "addline" && $user->rights->propale->creer)
 {
-	$result=0;
-
 	if (empty($_POST['idprod']) && GETPOST('type') < 0)
 	{
-		$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'</div>';
-		$result = -1 ;
+		setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors');
+		$error++;
 	}
 	if (empty($_POST['idprod']) && (! isset($_POST["np_price"]) || $_POST["np_price"]==''))	// Unit price can be 0 but not ''
 	{
-		$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")).'</div>';
-		$result = -1 ;
+		setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")), 'errors');
+		$error++;
 	}
 
-	if ($result >= 0 && isset($_POST['qty']) && ((GETPOST('np_price')!='' && (GETPOST('np_desc') || GETPOST('dp_desc'))) || GETPOST('idprod')))
+	if (! $error && isset($_POST['qty']) && ((GETPOST('np_price')!='' && (GETPOST('np_desc') || GETPOST('dp_desc'))) || GETPOST('idprod')))
 	{
-		$ret=$object->fetch($id);
-		if ($ret < 0)
-		{
-			dol_print_error($db,$object->error);
-			exit;
-		}
-		$ret=$object->fetch_thirdparty();
-
 		$pu_ht=0;
 		$pu_ttc=0;
 		$price_min=0;
@@ -729,7 +658,7 @@ else if ($action == "addline" && $user->rights->propale->creer)
 			$tva_npr = get_default_npr($mysoc,$object->client,$prod->id);
 
 			// On defini prix unitaire
-			if ($conf->global->PRODUIT_MULTIPRICES && $object->client->price_level)
+			if (! empty($conf->global->PRODUIT_MULTIPRICES) && $object->client->price_level)
 			{
 				$pu_ht  = $prod->multiprices[$object->client->price_level];
 				$pu_ttc = $prod->multiprices_ttc[$object->client->price_level];
@@ -798,7 +727,8 @@ else if ($action == "addline" && $user->rights->propale->creer)
 
 		if (! empty($price_min) && (price2num($pu_ht)*(1-price2num(GETPOST('remise_percent'))/100) < price2num($price_min)))
 		{
-			$mesg = '<div class="error">'.$langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').' '.$langs->trans("Currency".$conf->currency)).'</div>' ;
+			$mesg = $langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').' '.$langs->trans("Currency".$conf->currency));
+			setEventMessage($mesg, 'errors');
 		}
 		else
 		{
@@ -852,7 +782,7 @@ else if ($action == "addline" && $user->rights->propale->creer)
 			}
 			else
 			{
-				$mesg='<div class="error">'.$object->error.'</div>';
+				setEventMessage($object->error, 'errors');
 			}
 		}
 	}
@@ -861,13 +791,6 @@ else if ($action == "addline" && $user->rights->propale->creer)
 // Mise a jour d'une ligne dans la propale
 else if ($action == 'updateligne' && $user->rights->propale->creer && GETPOST('save') == $langs->trans("Save"))
 {
-	if (! $object->fetch($_POST["id"]) > 0)
-	{
-		dol_print_error($db,$object->error);
-		exit;
-	}
-	$object->fetch_thirdparty();
-
 	// Define info_bits
 	$info_bits=0;
 	if (preg_match('/\*/',$_POST['tva_tx'])) $info_bits |= 0x01;
@@ -877,18 +800,11 @@ else if ($action == 'updateligne' && $user->rights->propale->creer && GETPOST('s
 	$vat_rate=str_replace('*','',$vat_rate);
 	$localtax1_rate=get_localtax($vat_rate,1,$object->client);
 	$localtax2_rate=get_localtax($vat_rate,2,$object->client);
-  $pu_ht=GETPOST('pu')?GETPOST('pu'):GETPOST('subprice');
-
-	// ajout prix d'achat
-	$fk_fournprice = $_POST['fournprice'];
-	if ( ! empty($_POST['buying_price']) )
-	  $pa_ht = $_POST['buying_price'];
-	else
-	  $pa_ht = null;
+	$pu_ht=GETPOST('pu')?GETPOST('pu'):GETPOST('subprice');
 
-  // Define special_code for special lines
-  $special_code=0;
-  if (empty($_POST['qty'])) $special_code=3;
+	// Define special_code for special lines
+	$special_code=0;
+	if (empty($_POST['qty'])) $special_code=3;
 
 	// On verifie que le prix minimum est respecte
 	$productid = $_POST['productid'] ;
@@ -901,7 +817,8 @@ else if ($action == 'updateligne' && $user->rights->propale->creer && GETPOST('s
 	}
 	if ($productid && $price_min && (price2num($pu_ht)*(1-price2num($_POST['remise_percent'])/100) < price2num($price_min)))
 	{
-		$mesg = '<div class="error">'.$langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').' '.$langs->trans("Currency".$conf->currency)).'</div>' ;
+		$mesg = $langs->trans("CantBeLessThanMinPrice",price2num($price_min,'MU').' '.$langs->trans("Currency".$conf->currency));
+		setEventMessage($mesg, 'errors');
 	}
 	else
 	{
@@ -919,8 +836,8 @@ else if ($action == 'updateligne' && $user->rights->propale->creer && GETPOST('s
     		$special_code,
     		$_POST['fk_parent_line'],
     		0,
-    		$fk_fournprice,
-    		$pa_ht
+    		GETPOST('fournprice'),
+    		GETPOST('buying_price')
 		);
 
 		// Define output language
@@ -935,15 +852,15 @@ else if ($action == 'updateligne' && $user->rights->propale->creer && GETPOST('s
 		}
 		if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
 		{
-        $ret=$object->fetch($id);    // Reload to get new records
-		    propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
-
-				unset($_POST['qty']);
-				unset($_POST['type']);
-				unset($_POST['np_price']);
-				unset($_POST['dp_desc']);
-				unset($_POST['np_tva_tx']);
-				unset($_POST['np_buying_price']);
+			$ret=$object->fetch($id);    // Reload to get new records
+			propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
+
+			unset($_POST['qty']);
+			unset($_POST['type']);
+			unset($_POST['np_price']);
+			unset($_POST['dp_desc']);
+			unset($_POST['np_tva_tx']);
+			unset($_POST['np_buying_price']);
 		}
 	}
 }
@@ -951,12 +868,9 @@ else if ($action == 'updateligne' && $user->rights->propale->creer && GETPOST('s
 // Generation doc (depuis lien ou depuis cartouche doc)
 else if ($action == 'builddoc' && $user->rights->propale->creer)
 {
-	$object->fetch($id);
-	$object->fetch_thirdparty();
-
-	if ($_REQUEST['model'])
+	if (GETPOST('model'))
 	{
-		$object->setDocModel($user, $_REQUEST['model']);
+		$object->setDocModel($user, GETPOST('model'));
 	}
 
 	// Define output language
@@ -983,66 +897,56 @@ else if ($action == 'builddoc' && $user->rights->propale->creer)
 }
 
 // Remove file in doc form
-else if ($action == 'remove_file')
+else if ($action == 'remove_file' && $user->rights->propale->creer)
 {
-	if ($object->fetch($id))
+	if ($object->id > 0)
 	{
 		require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
 
-		$object->fetch_thirdparty();
-
 		$langs->load("other");
 		$upload_dir = $conf->propal->dir_output;
 		$file = $upload_dir . '/' . GETPOST('file');
 		dol_delete_file($file,0,0,0,$object);
-		$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('file')).'</div>';
 	}
 }
 
 // Set project
 else if ($action == 'classin' && $user->rights->propale->creer)
 {
-	$object->fetch($id);
 	$object->setProject($_POST['projectid']);
 }
 
 // Delai de livraison
 else if ($action == 'setavailability' && $user->rights->propale->creer)
 {
-	$object->fetch($id);
 	$result = $object->availability($_POST['availability_id']);
 }
 
 // Origine de la propale
 else if ($action == 'setdemandreason' && $user->rights->propale->creer)
 {
-	$object->fetch($id);
 	$result = $object->demand_reason($_POST['demand_reason_id']);
 }
 
 // Conditions de reglement
 else if ($action == 'setconditions' && $user->rights->propale->creer)
 {
-	$object->fetch($id);
 	$result = $object->setPaymentTerms(GETPOST('cond_reglement_id','int'));
 }
 
 else if ($action == 'setremisepercent' && $user->rights->propale->creer)
 {
-	$object->fetch($id);
 	$result = $object->set_remise_percent($user, $_POST['remise_percent']);
 }
 
 else if ($action == 'setremiseabsolue' && $user->rights->propale->creer)
 {
-	$object->fetch($id);
 	$result = $object->set_remise_absolue($user, $_POST['remise_absolue']);
 }
 
 // Mode de reglement
 else if ($action == 'setmode' && $user->rights->propale->creer)
 {
-	$object->fetch($id);
 	$result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
 }
 
@@ -1052,14 +956,12 @@ else if ($action == 'setmode' && $user->rights->propale->creer)
 
 else if ($action == 'up' && $user->rights->propale->creer)
 {
-	$object->fetch($id);
-	$object->fetch_thirdparty();
 	$object->line_up(GETPOST('rowid'));
 
 	// Define output language
 	$outputlangs = $langs;
 	$newlang='';
-	if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
+	if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
 	if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
 	if (! empty($newlang))
 	{
@@ -1074,14 +976,12 @@ else if ($action == 'up' && $user->rights->propale->creer)
 
 else if ($action == 'down' && $user->rights->propale->creer)
 {
-	$object->fetch($id);
-	$object->fetch_thirdparty();
 	$object->line_down(GETPOST('rowid'));
 
 	// Define output language
 	$outputlangs = $langs;
 	$newlang='';
-	if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
+	if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
 	if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
 	if (! empty($newlang))
 	{
@@ -1094,16 +994,14 @@ else if ($action == 'down' && $user->rights->propale->creer)
 	exit;
 }
 
-if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
+if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->propale->creer)
 {
-	if ($action == 'addcontact' && $user->rights->propale->creer)
+	if ($action == 'addcontact')
 	{
-		$result = $object->fetch($id);
-
-		if ($result > 0 && $id > 0)
+		if ($object->id > 0)
 		{
 			$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
-			$result = $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
+			$result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
 		}
 
 		if ($result >= 0)
@@ -1116,17 +1014,17 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
 			if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
 			{
 				$langs->load("errors");
-				$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
+				setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
 			}
 			else
 			{
-				$mesg = '<div class="error">'.$object->error.'</div>';
+				setEventMessage($object->error, 'errors');
 			}
 		}
 	}
 
 	// Bascule du statut d'un contact
-	else if ($action == 'swapstatut' && $user->rights->propale->creer)
+	else if ($action == 'swapstatut')
 	{
 		if ($object->fetch($id) > 0)
 		{
@@ -1139,7 +1037,7 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
 	}
 
 	// Efface un contact
-	else if ($action == 'deletecontact' && $user->rights->propale->creer)
+	else if ($action == 'deletecontact')
 	{
 		$object->fetch($id);
 		$result = $object->delete_contact($lineid);
@@ -1175,8 +1073,6 @@ $now=dol_now();
  * Show object in view mode
  */
 
-dol_htmloutput_mesg($mesg,$mesgs);
-
 $soc = new Societe($db);
 $soc->fetch($object->socid);
 
@@ -1863,7 +1759,7 @@ if ($action == 'presend')
 	$formmail->withtosocid=$soc->id;
 	$formmail->withtocc=1;
 	$formmail->withtoccsocid=0;
-	$formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC;
+	$formmail->withtoccc=(! empty($conf->global->MAIN_EMAIL_USECCC)?$conf->global->MAIN_EMAIL_USECCC:false);
 	$formmail->withtocccsocid=0;
 	$formmail->withtopic=$langs->trans('SendPropalRef','__PROPREF__');
 	$formmail->withfile=2;
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index 5c588bd482bf540cf43a85e7a2e137375fbe517a..7e85625ac3694ea1b7fdc686b6acfd088fc2b667 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -1845,7 +1845,6 @@ class Propal extends CommonObject
 
                                 if (! dol_delete_file($file,0,0,0,$this)) // For triggers
                                 {
-                                    $this->error='ErrorFailToDeleteFile';
                                     $this->db->rollback();
                                     return 0;
                                 }
diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php
index 406453a432b383f8ac0ac4d4f58fddad7e7a960d..c07282596ba7c02840bfb941ed0b78046e6056cf 100644
--- a/htdocs/comm/propal/document.php
+++ b/htdocs/comm/propal/document.php
@@ -125,7 +125,6 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
         $upload_dir = $conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref);
     	$file = $upload_dir . '/' . GETPOST('urlfile');	// Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
     	dol_delete_file($file,0,0,0,$object);
-    	setEventMessage($langs->trans("FileWasRemoved",GETPOST('urlfile')));
     	Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
     	exit;
     }
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index ec114d174147c738ffb0f1e99a612467a8757ea6..057f4b04794b78d1611d502ae450b87742d1c443 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -2344,7 +2344,6 @@ class Commande extends CommonOrder
 
         			if (! dol_delete_file($file,0,0,0,$this)) // For triggers
         			{
-        				$this->error=$langs->trans("ErrorCanNotDeleteFile",$file);
         				$this->db->rollback();
         				return 0;
         			}
diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php
index 39f83d3f6b96154c8fa2044ebd511a1b9b1e8d42..a4014a6fa17e4b5251ec5e5dc0f4346fc4b23781 100644
--- a/htdocs/commande/document.php
+++ b/htdocs/commande/document.php
@@ -122,7 +122,6 @@ else if ($action == 'confirm_deletefile' && $confirm == 'yes')
     	$upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref);
     	$file = $upload_dir . '/' . GETPOST('urlfile');	// Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
     	dol_delete_file($file,0,0,0,$object);
-    	setEventMessage($langs->trans("FileWasRemoved",GETPOST('urlfile')));
     	Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
     	exit;
     }
diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index 43a284f4e2087634025cbac3ce8e65e8b6d6754b..3470eeeee1d62d37d9d832597cf0dc4f7976fb56 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -1005,7 +1005,6 @@ else if ($action == 'remove_file')
 		$upload_dir = $conf->commande->dir_output;
 		$file = $upload_dir . '/' . GETPOST('file');
 		dol_delete_file($file,0,0,0,$object);
-		$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('file')).'</div>';
 	}
 }
 
@@ -1020,8 +1019,7 @@ if (GETPOST('addfile'))
 	$vardir=$conf->user->dir_output."/".$user->id;
 	$upload_dir_tmp = $vardir.'/temp';
 
-	$mesg=dol_add_file_process($upload_dir_tmp,0,0);
-
+	dol_add_file_process($upload_dir_tmp,0,0);
 	$action ='presend';
 }
 
@@ -1037,8 +1035,7 @@ if (GETPOST('removedfile'))
 	$upload_dir_tmp = $vardir.'/temp';
 
 	// TODO Delete only files that was uploaded from email form
-	$mesg=dol_remove_file_process(GETPOST('removedfile'),0);
-
+	dol_remove_file_process(GETPOST('removedfile'),0);
 	$action ='presend';
 }
 
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 18327d85e4bc2c676545c64d250ea1743f111cda..12d26ccf9bd79feed84802ef8e92d28929a453d1 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -1323,8 +1323,7 @@ if (GETPOST('addfile'))
     $vardir=$conf->user->dir_output."/".$user->id;
     $upload_dir_tmp = $vardir.'/temp';
 
-    $mesgs[]=dol_add_file_process($upload_dir_tmp,0,0);
-
+    dol_add_file_process($upload_dir_tmp,0,0);
     $action='presend';
 }
 
@@ -1340,8 +1339,7 @@ if (! empty($_POST['removedfile']))
     $upload_dir_tmp = $vardir.'/temp';
 
 	// TODO Delete only files that was uploaded from email form
-    $mesgs[]=dol_remove_file_process($_POST['removedfile'],0);
-
+    dol_remove_file_process($_POST['removedfile'],0);
     $action='presend';
 }
 
@@ -1566,7 +1564,6 @@ else if ($action == 'remove_file')
 		$upload_dir = $conf->facture->dir_output;
 		$file = $upload_dir . '/' . GETPOST('file');
 		dol_delete_file($file,0,0,0,$object);
-		$mesgs[] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('file')).'</div>';
 	}
 }
 
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 5cd0857f92313d3d91d8b9218f2d9d54bb139753..f3905deba6eca94e0a38480ca82a6f96b8df7096 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -1263,7 +1263,6 @@ class Facture extends CommonInvoice
 
                 			if (! dol_delete_file($file,0,0,0,$this)) // For triggers
                 			{
-                				$this->error=$langs->trans("ErrorCanNotDeleteFile",$file);
                 				$this->db->rollback();
                 				return 0;
                 			}
diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php
index 358fd3477bc246ccec1d3f1a6a4589e8c17ddae6..35397aea1f7b416f3bd1c6f49a75f6b6608fe251 100644
--- a/htdocs/compta/facture/document.php
+++ b/htdocs/compta/facture/document.php
@@ -125,7 +125,6 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
 		$upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref);
 		$file = $upload_dir . '/' . GETPOST('urlfile');	// Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
 		dol_delete_file($file,0,0,0,$object);
-		setEventMessage($langs->trans("FileWasRemoved",GETPOST('urlfile')));
     	Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
     	exit;
 	}
diff --git a/htdocs/compta/sociales/document.php b/htdocs/compta/sociales/document.php
index 4d89e43d4594bc857d425e0451e2c6b1c9249db0..8050f3ba77ed8aef143b91cb48d6acf2be85d5a6 100644
--- a/htdocs/compta/sociales/document.php
+++ b/htdocs/compta/sociales/document.php
@@ -129,7 +129,6 @@ if ($object->id)
     {
         $file = $upload_dir . '/' . GETPOST("urlfile");	// Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
         $result=dol_delete_file($file);
-        //if ($result >= 0) $mesg=$langs->trans("FileWasRemoced");
     }
 
     $head=tax_prepare_head($object, $user);
diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php
index fdcf3e77922a1a1c7b45f837d6ebb0ed2eca4033..f58f4d879f1f423f0146c7b29b2b3c2553e1277c 100644
--- a/htdocs/contrat/document.php
+++ b/htdocs/contrat/document.php
@@ -122,7 +122,6 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
 
 		$file = $upload_dir . '/' . GETPOST('urlfile');	// Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
 		$ret=dol_delete_file($file,0,0,0,$object);
-		setEventMessage($langs->trans("FileWasRemoved",GETPOST('urlfile')));
 		Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
 		exit;
 	}
diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php
index d1eabadedac0fd1247983a44576b1eb347241953..b3ceab6376a87698abf86a774aeab60befbec873 100644
--- a/htdocs/core/lib/files.lib.php
+++ b/htdocs/core/lib/files.lib.php
@@ -671,6 +671,9 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$notrigger=0,$objec
 {
 	global $db, $conf, $user, $langs;
 
+	$langs->load("other");
+	$langs->load("errors");
+
 	$error=0;
 
     //print "x".$file." ".$disableglob;
@@ -684,7 +687,8 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$notrigger=0,$objec
             else $ok=unlink($filename);  // The unlink encapsulated by dolibarr
             if ($ok)
             {
-            	dol_syslog("Removed file ".$filename,LOG_DEBUG);
+            	dol_syslog("Removed file ".$filename, LOG_DEBUG);
+            	setEventMessage($langs->trans("FileWasRemoved", basename($filename)));
             	if (! $notrigger)
             	{
                     if (! is_object($object)) $object=(object) 'dummy';
@@ -699,15 +703,24 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$notrigger=0,$objec
             		// Fin appel triggers
             	}
             }
-            else dol_syslog("Failed to remove file ".$filename,LOG_WARNING);
+            else {
+            	dol_syslog("Failed to remove file ".$filename, LOG_WARNING);
+            	setEventMessage($langs->trans("ErrorFailToDeleteFile", basename($filename)), 'errors');
+            }
         }
     }
     else
     {
         if ($nophperrors) $ok=@unlink($file_osencoded);        // The unlink encapsulated by dolibarr
         else $ok=unlink($file_osencoded);        // The unlink encapsulated by dolibarr
-        if ($ok) dol_syslog("Removed file ".$file_osencoded,LOG_DEBUG);
-        else dol_syslog("Failed to remove file ".$file_osencoded,LOG_WARNING);
+        if ($ok) {
+        	dol_syslog("Removed file ".$file_osencoded, LOG_DEBUG);
+        	setEventMessage($langs->trans("FileWasRemoved", basename($file_osencoded)));
+        }
+        else {
+        	dol_syslog("Failed to remove file ".$file_osencoded, LOG_WARNING);
+        	setEventMessage($langs->trans("ErrorFailToDeleteFile", basename($file_osencoded)), 'errors');
+        }
     }
     return $ok;
 }
@@ -917,14 +930,12 @@ function dol_init_file_process($pathtoscan='')
  * @param	string	$upload_dir				Directory to store upload files
  * @param	int		$allowoverwrite			1=Allow overwrite existing file
  * @param	int		$donotupdatesession		1=Do no edit _SESSION variable
- * @return	string							Message with result of upload and store.
+ * @return	void
  */
 function dol_add_file_process($upload_dir,$allowoverwrite=0,$donotupdatesession=0)
 {
 	global $db,$user,$conf,$langs,$_FILES;
 
-	$mesg='';
-
 	if (! empty($_FILES['addedfile']['tmp_name']))
 	{
 		if (dol_mkdir($upload_dir) >= 0)
@@ -932,7 +943,7 @@ function dol_add_file_process($upload_dir,$allowoverwrite=0,$donotupdatesession=
 			$resupload = dol_move_uploaded_file($_FILES['addedfile']['tmp_name'], $upload_dir . "/" . $_FILES['addedfile']['name'],$allowoverwrite,0, $_FILES['addedfile']['error']);
 			if (is_numeric($resupload) && $resupload > 0)
 			{
-				$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
+				setEventMessage($langs->trans("FileTransferComplete"));
 
 				if (empty($donotupdatesession))
 				{
@@ -946,15 +957,15 @@ function dol_add_file_process($upload_dir,$allowoverwrite=0,$donotupdatesession=
 				$langs->load("errors");
 				if ($resupload < 0)	// Unknown error
 				{
-					$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>';
+					setEventMessage($langs->trans("ErrorFileNotUploaded"), 'errors');
 				}
 				else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload))	// Files infected by a virus
 				{
-					$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus").'</div>';
+					setEventMessage($langs->trans("ErrorFileIsInfectedWithAVirus"), 'errors');
 				}
 				else	// Known error
 				{
-					$mesg = '<div class="error">'.$langs->trans($resupload).'</div>';
+					setEventMessage($langs->trans($resupload), 'errors');
 				}
 			}
 		}
@@ -962,10 +973,8 @@ function dol_add_file_process($upload_dir,$allowoverwrite=0,$donotupdatesession=
 	else
 	{
 		$langs->load("errors");
-		$mesg = '<div class="warning">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("File")).'</div>';
+		setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("File")), 'warnings');
 	}
-
-	return $mesg;
 }
 
 
@@ -976,14 +985,12 @@ function dol_add_file_process($upload_dir,$allowoverwrite=0,$donotupdatesession=
  * @param	int		$filenb					File nb to delete
  * @param	int		$donotupdatesession		1=Do not edit _SESSION variable
  * @param   int		$donotdeletefile        1=Do not delete physically file
- * @return	string							Message with result of upload and store.
+ * @return	void
  */
 function dol_remove_file_process($filenb,$donotupdatesession=0,$donotdeletefile=0)
 {
 	global $db,$user,$conf,$langs,$_FILES;
 
-	$mesg='';
-
 	$keytodelete=$filenb;
 	$keytodelete--;
 
@@ -1002,12 +1009,6 @@ function dol_remove_file_process($filenb,$donotupdatesession=0,$donotdeletefile=
 		else $result=0;
 		if ($result >= 0)
 		{
-			if (empty($donotdeletefile))
-			{
-			    $langs->load("other");
-			    $mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",$filetodelete).'</div>';
-    			//print_r($_FILES);
-			}
 			if (empty($donotupdatesession))
 			{
 				include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php');
@@ -1016,8 +1017,6 @@ function dol_remove_file_process($filenb,$donotupdatesession=0,$donotdeletefile=
 			}
 		}
 	}
-
-	return $mesg;
 }
 
 /**
diff --git a/htdocs/ecm/docmine.php b/htdocs/ecm/docmine.php
index 9070a53a1cfa61c666bdebd0f5f05f638ca2c65e..c5a98c23f31a315febe5d2d614483f7b6ed422c7 100644
--- a/htdocs/ecm/docmine.php
+++ b/htdocs/ecm/docmine.php
@@ -112,8 +112,6 @@ if (GETPOST('action') == 'confirm_deletefile' && GETPOST('confirm') == 'yes')
     $file = $upload_dir . "/" . GETPOST('urlfile');	// Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
     $result=dol_delete_file($file);
 
-    $mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
-
     $result=$ecmdir->changeNbOfFiles('-');
 }
 
diff --git a/htdocs/ecm/docother.php b/htdocs/ecm/docother.php
index 634ee0b5605a04ae6e257165c09bdd3f4b19a528..ca679993b2234d418966ee356509f05ee6481432 100644
--- a/htdocs/ecm/docother.php
+++ b/htdocs/ecm/docother.php
@@ -81,7 +81,6 @@ if ($_POST['action'] == 'confirm_deletefile' && $_POST['confirm'] == 'yes')
     $langs->load("other");
 	$file = $upload_dir . "/" . GETPOST('urlfile');	// Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
 	dol_delete_file($file);
-	$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
 }
 
 
diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php
index 49486ffc728bc69ce50e83589085d974860174e2..4e78670c40062844f3fe63ff30dbefff0ea4af66 100644
--- a/htdocs/ecm/index.php
+++ b/htdocs/ecm/index.php
@@ -167,8 +167,6 @@ if ($action == 'confirm_deletefile')
 
     	$result=dol_delete_file($file);
 
-    	$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
-
     	$result=$ecmdir->changeNbOfFiles('-');
 
     	clearstatcache();
diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php
index 8abd1f270c8af39404bd8c1f6d6b40d1e69874c4..b4217bff558e39844f4a5f49f4b1dc5cc42ff979 100644
--- a/htdocs/expedition/class/expedition.class.php
+++ b/htdocs/expedition/class/expedition.class.php
@@ -155,7 +155,7 @@ class Expedition extends CommonObject
 	function create($user)
 	{
 		global $conf, $langs;
-		
+
 		$now=dol_now();
 
 		require_once DOL_DOCUMENT_ROOT ."/product/stock/class/mouvementstock.class.php";
@@ -547,10 +547,7 @@ class Expedition extends CommonObject
 				$file = $dir . "/" . $expeditionref . ".pdf";
 				if (file_exists($file))
 				{
-					if (!dol_delete_file($file))
-					{
-						$this->error=$langs->trans("ErrorCanNotDeleteFile",$file);
-					}
+					dol_delete_file($file);
 				}
 				if (file_exists($dir))
 				{
@@ -794,9 +791,8 @@ class Expedition extends CommonObject
 						$file = $conf->expedition->dir_output . "/" . $expref . "/" . $expref . ".pdf";
 						if (file_exists($file))
 						{
-							if (!dol_delete_file($file))
+							if (! dol_delete_file($file))
 							{
-								$this->error=$langs->trans("ErrorCanNotDeleteFile",$file);
 								return 0;
 							}
 						}
diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php
index d57bc9823eb16dcf174d6a29a4dd47915f29cc44..a5d78c2ade88b3bb012ecf829ad5faa56cddd8bb 100644
--- a/htdocs/expedition/fiche.php
+++ b/htdocs/expedition/fiche.php
@@ -331,8 +331,7 @@ if (GETPOST('addfile','alpha'))
     $vardir=$conf->user->dir_output."/".$user->id;
     $upload_dir_tmp = $vardir.'/temp';
 
-    $mesg=dol_add_file_process($upload_dir_tmp,0,0);
-
+    dol_add_file_process($upload_dir_tmp,0,0);
     $action ='presend';
 }
 
@@ -348,8 +347,7 @@ if (GETPOST('removedfile','alpha'))
     $upload_dir_tmp = $vardir.'/temp';
 
     // TODO Delete only files that was uploaded from email form
-    $mesg=dol_remove_file_process(GETPOST('removedfile','int'),0);
-
+    dol_remove_file_process(GETPOST('removedfile','int'),0);
     $action ='presend';
 }
 
diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php
index 6862c855c5de7fe9f7301804091ce078a3d2a2f5..7bb03ff21980f53f2caf6c1b1215786d2ff2fe4d 100644
--- a/htdocs/fichinter/class/fichinter.class.php
+++ b/htdocs/fichinter/class/fichinter.class.php
@@ -164,7 +164,7 @@ class Fichinter extends CommonObject
 				$error++; $this->errors=$interface->errors;
 			}
 			// Fin appel triggers
-			
+
 			$this->id=$this->db->last_insert_id(MAIN_DB_PREFIX."fichinter");
 			$this->db->commit();
 			return $this->id;
@@ -210,7 +210,7 @@ class Fichinter extends CommonObject
 				$error++; $this->errors=$interface->errors;
 			}
 			// Fin appel triggers
-			
+
 			$this->db->commit();
 			return 1;
 		}
@@ -339,7 +339,7 @@ class Fichinter extends CommonObject
 		if ($this->statut != 1)
 		{
 			$this->db->begin();
-			
+
 			$now=dol_now();
 
 			$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter";
@@ -651,7 +651,6 @@ class Fichinter extends CommonObject
 
 						if (! dol_delete_file($file,0,0,0,$this)) // For triggers
 						{
-							$this->error=$langs->trans("ErrorCanNotDeleteFile",$file);
 							return 0;
 						}
 					}
@@ -664,7 +663,7 @@ class Fichinter extends CommonObject
 						}
 					}
 				}
-				
+
 				// Appel des triggers
 				include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
 				$interface=new Interfaces($this->db);
diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php
index 5364fb1f0e24019287898ec868c6a33afe8102e9..cd423cc7f68bd58048d02acf88bc3eaa100e673e 100644
--- a/htdocs/fichinter/document.php
+++ b/htdocs/fichinter/document.php
@@ -121,7 +121,6 @@ else if ($action == 'confirm_deletefile' && $confirm == 'yes')
 
 		$file = $upload_dir . '/' . GETPOST('urlfile');	// Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
 		dol_delete_file($file,0,0,0,$object);
-		setEventMessage($langs->trans("FileWasRemoved",GETPOST('urlfile')));
 		Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
 		exit;
 	}
diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php
index 77dc95ad6bc5140b78ff0341b879448e2fa814df..df699cba86544415176c3e2bde7fb7877f5ffbf5 100644
--- a/htdocs/fichinter/fiche.php
+++ b/htdocs/fichinter/fiche.php
@@ -213,7 +213,6 @@ else if ($action == 'remove_file')
 		$upload_dir = $conf->ficheinter->dir_output;
 		$file = $upload_dir . '/' . GETPOST('file');
 		dol_delete_file($file,0,0,0,$object);
-		$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('file')).'</div>';
 	}
 }
 
@@ -467,8 +466,7 @@ if (GETPOST('addfile','alpha'))
     $vardir=$conf->user->dir_output."/".$user->id;
     $upload_dir_tmp = $vardir.'/temp';
 
-    $mesg=dol_add_file_process($upload_dir_tmp,0,0);
-
+    dol_add_file_process($upload_dir_tmp,0,0);
     $action='presend';
 }
 
@@ -484,8 +482,7 @@ if (GETPOST('removedfile','alpha'))
     $upload_dir_tmp = $vardir.'/temp';
 
 	// TODO Delete only files that was uploaded from email form
-    $mesg=dol_remove_file_process(GETPOST('removedfile','alpha'),0);
-
+    dol_remove_file_process(GETPOST('removedfile','alpha'),0);
     $action='presend';
 }
 
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index 612bfb01ee049e4088abd98f217d591c61f5258a..a94b674b3e0e3df8af4e597c961ecae4bef72c99 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -1322,7 +1322,6 @@ class CommandeFournisseur extends CommonOrder
         		{
         			if (! dol_delete_file($file,0,0,0,$this)) // For triggers
         			{
-        				$this->error='ErrorFailToDeleteFile';
         				$error++;
         			}
         		}
diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php
index 1c087f956ac4e6a11666bcdd05e993d2efc28273..c37fc310a6b5b3fcf74be3489596ff3994ab6086 100644
--- a/htdocs/fourn/commande/document.php
+++ b/htdocs/fourn/commande/document.php
@@ -122,7 +122,6 @@ else if ($action == 'confirm_deletefile' && $confirm == 'yes')
 
 		$file = $upload_dir . '/' . GETPOST('urlfile');	// Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
 		dol_delete_file($file,0,0,0,$object);
-		setEventMessage($langs->trans("FileWasRemoved",GETPOST('urlfile')));
 		Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
 		exit;
 	}
diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php
index b5a826e60c2b598c2e4b120eca795f4175d2375a..0572da65ca041e8b8e139c70db24f0eeff8e8639 100644
--- a/htdocs/fourn/commande/fiche.php
+++ b/htdocs/fourn/commande/fiche.php
@@ -615,7 +615,6 @@ else if ($action == 'remove_file' && $user->rights->fournisseur->commande->creer
         $upload_dir =	$conf->fournisseur->commande->dir_output;
         $file =	$upload_dir	. '/' .	GETPOST('file');
         dol_delete_file($file,0,0,0,$object);
-        $mesg	= '<div	class="ok">'.$langs->trans("FileWasRemoved",GETPOST('file')).'</div>';
     }
 }
 
@@ -668,8 +667,7 @@ if (GETPOST('addfile'))
     $vardir=$conf->user->dir_output."/".$user->id;
     $upload_dir_tmp = $vardir.'/temp';
 
-    $mesg=dol_add_file_process($upload_dir_tmp,0,0);
-
+    dol_add_file_process($upload_dir_tmp,0,0);
     $action='presend';
 }
 
@@ -685,8 +683,7 @@ if (GETPOST('removedfile'))
     $upload_dir_tmp = $vardir.'/temp';
 
 	// TODO Delete only files that was uploaded from email form
-    $mesg=dol_remove_file_process($_POST['removedfile'],0);
-
+    dol_remove_file_process($_POST['removedfile'],0);
     $action='presend';
 }
 
diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php
index 0b44c881c4fb7894b98c618ed0d09bf18f2cae54..7de4ac0652c8ab41daa997d7578abfa9c3972231 100644
--- a/htdocs/fourn/facture/document.php
+++ b/htdocs/fourn/facture/document.php
@@ -124,7 +124,6 @@ if ($action=='delete')
 
         $file = $upload_dir . '/' . GETPOST('urlfile');	// Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
         dol_delete_file($file);
-        $mesg = '<div class="ok">'.$langs->trans('FileWasRemoved',GETPOST('urlfile')).'</div>';
     }
 }
 
diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php
index f9fedc97d8592535bab8597b38825ea982daa3b0..dee76961f6481b6d98db27f3cb95f5cf377bbfd4 100644
--- a/htdocs/fourn/facture/fiche.php
+++ b/htdocs/fourn/facture/fiche.php
@@ -617,8 +617,7 @@ if (GETPOST('addfile'))
     $vardir=$conf->user->dir_output."/".$user->id;
     $upload_dir_tmp = $vardir.'/temp';
 
-    $mesg=dol_add_file_process($upload_dir_tmp,0,0);
-
+    dol_add_file_process($upload_dir_tmp,0,0);
     $action='presend';
 }
 
@@ -632,8 +631,7 @@ if (! empty($_POST['removedfile']))
     $upload_dir_tmp = $vardir.'/temp';
 
 	// TODO Delete only files that was uploaded from email form
-    $mesg=dol_remove_file_process($_POST['removedfile'],0);
-
+    dol_remove_file_process($_POST['removedfile'],0);
     $action='presend';
 }
 
@@ -832,7 +830,6 @@ elseif ($action == 'remove_file')
         $upload_dir =	$conf->fournisseur->facture->dir_output . "/";
         $file =	$upload_dir	. '/' .	GETPOST('file');
         dol_delete_file($file);
-        $mesg	= '<div	class="ok">'.$langs->trans("FileWasRemoved",GETPOST('file')).'</div>';
     }
 }
 
diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php
index 3dcfd88f2204aa1eeea6781e5ab2836f9f3fa7fc..5b9d5446c5b578760d15839be8da8eb04ad5e9a7 100644
--- a/htdocs/livraison/class/livraison.class.php
+++ b/htdocs/livraison/class/livraison.class.php
@@ -397,15 +397,14 @@ class Livraison extends CommonObject
 							$file = $dir . "/" . $numref . ".pdf";
 							if (file_exists($file))
 							{
-								if (!dol_delete_file($file))
+								if (! dol_delete_file($file))
 								{
-									$this->error=$langs->trans("ErrorCanNotDeleteFile",$file);
 									return 0;
 								}
 							}
 							if (file_exists($dir))
 							{
-								if (!dol_delete_dir($dir))
+								if (! dol_delete_dir($dir))
 								{
 									$this->error=$langs->trans("ErrorCanNotDeleteDir",$dir);
 									return 0;
@@ -581,7 +580,6 @@ class Livraison extends CommonObject
 						{
 							if (!dol_delete_file($file))
 							{
-								$this->error=$langs->trans("ErrorCanNotDeleteFile",$file);
 								return 0;
 							}
 						}
diff --git a/htdocs/product/document.php b/htdocs/product/document.php
index 4e63ec969bd1848b83337c293f9d35ad0f2f5c1d..059843ab43903b3fb86a4e3f765448ed7160ae6b 100755
--- a/htdocs/product/document.php
+++ b/htdocs/product/document.php
@@ -129,7 +129,6 @@ if ($object->id)
 	{
 		$file = $upload_dir . '/' . $_GET['urlfile'];	// Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
 		$result=dol_delete_file($file);
-		//if ($result >= 0) $mesg=$langs->trans("FileWasRemoced");
 	}
 
 	$head=product_prepare_head($object, $user);
diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php
index 74efec961bd6ea3e22cacec15573633d85e204e2..653e0009b7bf747e9da5a89957dbd61feeed4d23 100644
--- a/htdocs/projet/document.php
+++ b/htdocs/projet/document.php
@@ -115,7 +115,6 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->projet->s
 	$upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref);
 	$file = $upload_dir . '/' . GETPOST('urlfile');	// Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
 	dol_delete_file($file,0,0,0,$object);
-	setEventMessage($langs->trans("FileWasRemoved",GETPOST('urlfile')));
     Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
     exit;
 }
diff --git a/htdocs/projet/fiche.php b/htdocs/projet/fiche.php
index 967d57b4367fbf5c24edb9bd4971e2efdbfc5fd2..be8d437dc5313d9d4bc74cf3695058bd84b61ba9 100644
--- a/htdocs/projet/fiche.php
+++ b/htdocs/projet/fiche.php
@@ -252,7 +252,6 @@ if ($action == 'remove_file' && $user->rights->projet->creer)
         $upload_dir =	$conf->projet->dir_output . "/";
         $file =	$upload_dir	. '/' .	GETPOST('file');
         dol_delete_file($file);
-        $mesg	= '<div	class="ok">'.$langs->trans("FileWasRemoved",GETPOST('file')).'</div>';
     }
 }
 
diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php
index 8e88ba814c4f24150b4d55289b2b581898ac4b99..50f1214831485bcb38088b33fc7a85a7b52a3ffa 100644
--- a/htdocs/projet/tasks/document.php
+++ b/htdocs/projet/tasks/document.php
@@ -112,7 +112,6 @@ if ($action=='delete')
     $langs->load("other");
 	$file = $upload_dir . '/' . GETPOST('urlfile');	// Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
 	dol_delete_file($file);
-	setEventMessage($langs->trans("FileWasRemoved",GETPOST('urlfile')));
     Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
     exit;
 }
diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php
index cf27d4948a1a250f8ff5ac3030a5f3c0551ddb89..bc63741bac1bfe1ac1f2e08b43f1ab2428af5cf6 100644
--- a/htdocs/societe/document.php
+++ b/htdocs/societe/document.php
@@ -124,7 +124,6 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
 		$file = $upload_dir . "/" . GETPOST('urlfile');	// Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
 
 		dol_delete_file($file,0,0,0,$object);
-		setEventMessage($langs->trans("FileWasRemoved",GETPOST('urlfile')));
     	Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
     	exit;
 	}
diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php
index 2457bcdce80c686644965bb5d5a8e34b9cd895f2..f77c4b65f799f2910339c183caa4ea8ef70d9644 100644
--- a/htdocs/societe/soc.php
+++ b/htdocs/societe/soc.php
@@ -463,7 +463,6 @@ if (empty($reshook))
     		$upload_dir = $conf->societe->dir_output;
     		$file = $upload_dir . '/' . GETPOST('file');
     		dol_delete_file($file,0,0,0,$object);
-    		$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('file')).'</div>';
     	}
     }
 }