diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index 973c1b9c961bca6d0c6208054c5484cea4e4a16e..3b567c794d5ba1fd06b6ae1f1390152be07a8a92 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -692,7 +692,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
         $resql = $db->query($sql);
         if (! $resql)
         {
-            setEventMessage($db->error(), 'errors');
+            setEventMessages($db->error(), null, 'errors');
         }
     }
     //$_GET["id"]=GETPOST('id', 'int');       // Force affichage dictionnaire en cours d'edition
diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php
index 204ac36ea0356f9b52f0ed9e55d8b5a5711b502d..4ba759a66fa7ef2aa5b1edf936c62a790095d4cc 100644
--- a/htdocs/admin/tools/listevents.php
+++ b/htdocs/admin/tools/listevents.php
@@ -111,7 +111,7 @@ if ($action == 'confirm_purge' && $confirm == 'yes' && $user->admin)
 	if (! $resql)
 	{
 		$error++;
-		setEventMessage($db->lasterror(), 'errors');
+		setEventMessages($db->lasterror(), null, 'errors');
 	}
 
 	// Add event purge
diff --git a/htdocs/admin/tools/purge.php b/htdocs/admin/tools/purge.php
index 0c5915fd3268d73284c94af3a17bf8ff428f7fe0..af29f244d01207441176091af373d04356baeeab 100644
--- a/htdocs/admin/tools/purge.php
+++ b/htdocs/admin/tools/purge.php
@@ -105,7 +105,7 @@ if ($action=='purge' && ! preg_match('/^confirm/i',$choice) && ($choice != 'allf
 
 	if ($count) $mesg=$langs->trans("PurgeNDirectoriesDeleted", $count);
 	else $mesg=$langs->trans("PurgeNothingToDelete");
-	setEventMessage($mesg);
+	setEventMessages($mesg, null, 'mesgs');
 }
 
 
diff --git a/htdocs/categories/admin/categorie.php b/htdocs/categories/admin/categorie.php
index 37ed08703f84328926df8f8e2f8b9d29dbb01aad..12b4d3ced813753c5142dc02f08b22cf25010a94 100644
--- a/htdocs/categories/admin/categorie.php
+++ b/htdocs/categories/admin/categorie.php
@@ -47,7 +47,7 @@ if (preg_match('/set_(.*)/',$action,$reg))
     }
     else
     {
-        setEventMessage($db->lasterror(),'errors');
+        setEventMessages($db->lasterror(), null, 'errors');
     }
 }
 
@@ -61,7 +61,7 @@ if (preg_match('/del_(.*)/',$action,$reg))
     }
     else
     {
-         setEventMessage($db->lasterror(),'errors');
+         setEventMessages($db->lasterror(), null, 'errors');
     }
 }
 
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 63efabe486179778c681b8e334b38bc31c5dff14..86a49f9f232c1ca4124978182b6e5256f9c78c42 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -402,7 +402,7 @@ if (empty($reshook))
 					$langs->load("errors");
 				$error ++;
 
-				setEventMessage($langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId' . $i, $object->thirdparty->country_code)), 'errors');
+				setEventMessages($langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId' . $i, $object->thirdparty->country_code)), null, 'errors');
 			}
 		}
 
@@ -418,7 +418,7 @@ if (empty($reshook))
 		{
 			if (! $idwarehouse || $idwarehouse == - 1) {
 				$error ++;
-				setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), 'errors');
+				setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors');
 				$action = '';
 			}
 		}
@@ -448,7 +448,7 @@ if (empty($reshook))
 			}
 			else
 			{
-				if (count($object->errors)) setEventMessage($object->errors, 'errors');
+				if (count($object->errors)) setEventMessages(null, $object->errors, 'errors');
 				else setEventMessages($object->error, $object->errors, 'errors');
 			}
 		}
@@ -1054,7 +1054,7 @@ if (empty($reshook))
 										if ($discountid > 0) {
 											$result = $object->insert_discount($discountid); // This include link_to_invoice
 										} else {
-											setEventMessage($discount->error, 'errors');
+											setEventMessages($discount->error, $discount->errors, 'errors');
 											$error ++;
 											break;
 										}
diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php
index 22220db68329dacca7edc0261a17e34346626a7c..e49b52b8a90468c8ddffce85ffe0e9e39899ba1a 100644
--- a/htdocs/contact/card.php
+++ b/htdocs/contact/card.php
@@ -143,7 +143,7 @@ if (empty($reshook))
     	$object->fetch($id);
     	if ($object->setstatus(0)<0)
     	{
-    	    setEventMessage($object->error,'errors');
+    	    setEventMessages($object->error, $object->errors, 'errors');
     	}
     	else
     	{
@@ -158,7 +158,7 @@ if (empty($reshook))
     	$object->fetch($id);
         	if ($object->setstatus(1)<0)
     	{
-    	    setEventMessage($object->error,'errors');
+    	    setEventMessages($object->error, $object->errors, 'errors');
     	}
     	else
     	{
@@ -397,8 +397,7 @@ if (empty($reshook))
             }
             else
             {
-                setEventMessage($object->error,'errors');
-                setEventMessage($object->errors,'errors');
+                setEventMessages($object->error, $object->errors, 'errors');
                 $action = 'edit';
             }
         }
diff --git a/htdocs/contact/ldap.php b/htdocs/contact/ldap.php
index 2ec187eafc6e35430ba4061a62e0190fa8b49841..a626c57b6aff34a53c4ea0461c5e4a5842206b06 100644
--- a/htdocs/contact/ldap.php
+++ b/htdocs/contact/ldap.php
@@ -65,12 +65,12 @@ if ($action == 'dolibarr2ldap')
 
 	if ($result >= 0)
 	{
-		setEventMessage($langs->trans("ContactSynchronized"));
+		setEventMessages($langs->trans("ContactSynchronized"), null, 'mesgs');
 		$db->commit();
 	}
 	else
 	{
-		setEventMessage($ldap->error, 'errors');
+		setEventMessages($ldap->error, $ldap->errors, 'errors');
 		$db->rollback();
 	}
 }