diff --git "a/dev/iso-normes/format_FEC-Lien_outil_de_test_agr\303\251\303\251.pdf" "b/dev/iso-normes/format_FEC-Lien_outil_de_test_agr\303\251\303\251.pdf"
new file mode 100644
index 0000000000000000000000000000000000000000..1c0d0c91e739f88a744c877728edd1451da7ee2b
Binary files /dev/null and "b/dev/iso-normes/format_FEC-Lien_outil_de_test_agr\303\251\303\251.pdf" differ
diff --git a/dev/iso-normes/format_FEC.pdf b/dev/iso-normes/format_FEC.pdf
index 2b5770305506bdbee07afbf03ca11bd51dc9c37e..ad62797a1903c335112b68aa9ea34c378ae1132d 100644
Binary files a/dev/iso-normes/format_FEC.pdf and b/dev/iso-normes/format_FEC.pdf differ
diff --git a/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php
index a54aac470e5eb70210c986cd0b85d04146ce8d13..ed8f8ed976e9d7f20d9fd0e65778c5576afbf731 100644
--- a/dev/skeletons/modMyModule.class.php
+++ b/dev/skeletons/modMyModule.class.php
@@ -166,7 +166,11 @@ class modMyModule extends DolibarrModules
 		// Add here list of php file(s) stored in core/boxes that contains class to show a box.
         $this->boxes = array();			// List of boxes
 		// Example:
-		//$this->boxes=array(array(0=>array('file'=>'myboxa.php','note'=>'','enabledbydefaulton'=>'Home'),1=>array('file'=>'myboxb.php','note'=>''),2=>array('file'=>'myboxc.php','note'=>'')););
+		//$this->boxes=array(
+		//    0=>array('file'=>'myboxa.php@mymodule','note'=>'','enabledbydefaulton'=>'Home'),
+		//    1=>array('file'=>'myboxb.php@mymodule','note'=>''),
+		//    2=>array('file'=>'myboxc.php@mymodule','note'=>'')
+		//);
 
 		// Cronjobs
 		$this->cronjobs = array();			// List of cron jobs entries to add
diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php
index b6f412d5480042637c20c8028a9710b450055c15..951a07d317122fdb094e2de77f2ad29c8c324518 100644
--- a/htdocs/accountancy/bookkeeping/list.php
+++ b/htdocs/accountancy/bookkeeping/list.php
@@ -44,13 +44,14 @@ $search_doc_ref = GETPOST("search_doc_ref");
 $search_account = GETPOST("search_account");
 $search_thirdparty = GETPOST("search_thirdparty");
 $search_journal = GETPOST("search_journal");
+$limit = $conf->liste_limit;
 
 if ($sortorder == "")
 	$sortorder = "ASC";
 if ($sortfield == "")
 	$sortfield = "bk.rowid";
 
-$offset = $conf->liste_limit * $page;
+$offset = $limit * $page;
 
 $formventilation = new FormVentilation($db);
 $formother = new FormOther($db);
diff --git a/htdocs/accountancy/bookkeeping/listbyyear.php b/htdocs/accountancy/bookkeeping/listbyyear.php
index ce6d10f9730f498b451d13aa4c04e956c2f1dd4c..fe185fd11186d6e3763050112a378a5799a9a4ff 100644
--- a/htdocs/accountancy/bookkeeping/listbyyear.php
+++ b/htdocs/accountancy/bookkeeping/listbyyear.php
@@ -36,6 +36,7 @@ $langs->load("accountancy");
 $page = GETPOST("page");
 $sortorder = GETPOST("sortorder");
 $sortfield = GETPOST("sortfield");
+$limit = $conf->liste_limit;
 
 // Filter
 $year = GETPOST("year", 'int');
@@ -52,7 +53,7 @@ if ($sortorder == "")
 if ($sortfield == "")
 	$sortfield = "bk.rowid";
 
-$offset = $conf->liste_limit * $page;
+$offset = $limit * $page;
 
 llxHeader('', $langs->trans("Bookkeeping"));
 
diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php
index f9cee8a75f32ce53a5dc6d775d02a91b5f44f742..04183bed3368e8ee7a82c5a928d90895fd9a80e2 100644
--- a/htdocs/admin/livraison.php
+++ b/htdocs/admin/livraison.php
@@ -503,7 +503,7 @@ print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
 print '<input type="hidden" name="action" value="set_DELIVERY_FREE_TEXT">';
 print '<tr '.$bc[$var].'><td colspan="2">';
 print $langs->trans("FreeLegalTextOnDeliveryReceipts").' ('.$langs->trans("AddCRIfTooLong").')<br>';
-print '<textarea name="DELIVERY_FREE_TEXT" class="flat" cols="120">'.$conf->global->DELIVERY_FREE_TEXT.'</textarea>';
+$variablename='DELIVERY_FREE_TEXT';
 if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
 {
     print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
diff --git a/htdocs/admin/sms.php b/htdocs/admin/sms.php
index 604b426b800f693d9879fe406f551ea8affcd75f..05fe548daffff4f2ab65ef2d87c30015480bf0df 100644
--- a/htdocs/admin/sms.php
+++ b/htdocs/admin/sms.php
@@ -124,10 +124,12 @@ if ($action == 'send' && ! $_POST['cancel'])
 		if ($result)
 		{
 			setEventMessages($langs->trans("SmsSuccessfulySent",$smsfrom,$sendto), null, 'mesgs');
+			setEventMessages($smsfile->error, $smsfile->errors, 'mesgs');
 		}
 		else
 		{
 			setEventMessages($langs->trans("ResultKo"), null, 'errors');
+			setEventMessages($smsfile->error, $smsfile->errors, 'errors');
 		}
 
 		$action='';
diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php
index cc7bafa9f5d4e4f2a1cf4b71f71c8e70f6b84876..20796db24f44b7b5bd31282676790f4147fb6951 100644
--- a/htdocs/comm/mailing/list.php
+++ b/htdocs/comm/mailing/list.php
@@ -32,9 +32,10 @@ $result=restrictedArea($user,'mailing');
 
 $sortfield = GETPOST("sortfield",'alpha');
 $sortorder = GETPOST("sortorder",'alpha');
+$limit = $conf->liste_limit;
 $page = GETPOST("page",'int');
 if ($page == -1) { $page = 0; }
-$offset = $conf->liste_limit * $page;
+$offset = $limit * $page;
 $pageprev = $page - 1;
 $pagenext = $page + 1;
 if (! $sortorder) $sortorder="DESC";
diff --git a/htdocs/comm/multiprix.php b/htdocs/comm/multiprix.php
index 645bdc580b4c1b6d8bf4ac0744ed2d125ab5f2a3..fbaf00e53db91e05028aa2f7267a5b6c43f20606 100644
--- a/htdocs/comm/multiprix.php
+++ b/htdocs/comm/multiprix.php
@@ -105,7 +105,10 @@ if ($_socid > 0)
 		print '<option value="'.$i.'"' ;
 		if($i == $objsoc->price_level)
 		print 'selected';
-		print '>'.$i.'</option>';
+		print '>'.$i;
+		$keyforlabel='PRODUIT_MULTIPRICES_LABEL'.$i;
+		if (! empty($conf->global->$keyforlabel)) print ' - '.$langs->trans($conf->global->$keyforlabel);
+		print '</option>';
 	}
 	print '</select>';
 	print '</td></tr>';
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index 250687a5c02be8e0f7e7768c960e5d4ab50945c8..cda28c80b376264125d7fa05fdb0290aa8c02319 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -2901,8 +2901,7 @@ class Propal extends CommonObject
 
 
 /**
- *	\class      PropaleLigne
- *	\brief      Class to manage commercial proposal lines
+ *	Class to manage commercial proposal lines
  */
 class PropaleLigne  extends CommonObjectLine
 {
diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index b35aa1628f39ce7991e79e6d3615c29e09f605d0..b7caa472425bf259309509a0019f9d3fa96c4291 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -67,13 +67,13 @@ $result = restrictedArea($user, 'commande', $id,'');
 $sortfield = GETPOST("sortfield",'alpha');
 $sortorder = GETPOST("sortorder",'alpha');
 $page = GETPOST("page",'int');
+$limit = $conf->liste_limit;
 if ($page == -1) { $page = 0; }
-$offset = $conf->liste_limit * $page;
+$offset = $limit * $page;
 $pageprev = $page - 1;
 $pagenext = $page + 1;
 if (! $sortfield) $sortfield='c.rowid';
 if (! $sortorder) $sortorder='DESC';
-$limit = $conf->liste_limit;
 
 $viewstatut=GETPOST('viewstatut');
 
diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php
index c3c5f7dd80be3a914a1c274ff1509e920c6db18e..7c849f67f50925cc65d1bbc090029f8ce7a0c87b 100644
--- a/htdocs/compta/deplacement/list.php
+++ b/htdocs/compta/deplacement/list.php
@@ -46,13 +46,13 @@ $search_company=GETPOST('search_company','alpha');
 $sortfield = GETPOST("sortfield",'alpha');
 $sortorder = GETPOST("sortorder",'alpha');
 $page = GETPOST("page",'int');
+$limit = $conf->liste_limit;
 if ($page == -1) { $page = 0; }
-$offset = $conf->liste_limit * $page;
+$offset = $limit * $page;
 $pageprev = $page - 1;
 $pagenext = $page + 1;
 if (! $sortorder) $sortorder="DESC";
 if (! $sortfield) $sortfield="d.dated";
-$limit = $conf->liste_limit;
 
 $year=GETPOST("year");
 $month=GETPOST("month");
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 9ce11ee5abf28b2049c2350e8331277eaef5f1ea..4d3c194bce18d9ddfe6320cfaed441b0c1834bb1 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -2837,7 +2837,7 @@ else if ($id > 0 || ! empty($ref))
 	print '</tr></table>';
 	print '</td><td colspan="5">';
 	if ($action == 'editthirdparty') {
-		$form->form_thirdparty($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->socid, 'socid');
+		$form->form_thirdparty($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->socid, 'socid','client>0');
 	} else {
 		print ' &nbsp;' . $soc->getNomUrl(1, 'compta');
 		print ' &nbsp; ';
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index 707ad32eec744421bce8e9795e8841ade58f3118..0d0d1835732eed2d0b8e99cb0e2b1ce98831cb45 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -77,14 +77,14 @@ if ($option == 'late') $filter = 'paye:0';
 
 $sortfield = GETPOST("sortfield",'alpha');
 $sortorder = GETPOST("sortorder",'alpha');
+$limit = $conf->liste_limit;
 $page = GETPOST("page",'int');
 if ($page == -1) {
     $page = 0;
 }
-$offset = $conf->liste_limit * $page;
+$offset = $limit * $page;
 if (! $sortorder) $sortorder='DESC';
 if (! $sortfield) $sortfield='f.datef';
-$limit = $conf->liste_limit;
 
 $pageprev = $page - 1;
 $pagenext = $page + 1;
diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php
index c322863efc1ac2db0a21682380f069eb520eea48..f4451178e716438cc506be97fcb23cc14cc1f3d8 100644
--- a/htdocs/compta/paiement/cheque/list.php
+++ b/htdocs/compta/paiement/cheque/list.php
@@ -43,12 +43,12 @@ $search_account = GETPOST('search_account','int');
 $search_amount = GETPOST('search_amount','alpha');
 $sortfield = GETPOST("sortfield",'alpha');
 $sortorder = GETPOST("sortorder",'alpha');
+$limit = $conf->liste_limit;
 $page = GETPOST("page",'int');
 if ($page == -1) { $page = 0; }
-$offset = $conf->liste_limit * $page;
+$offset = $limit * $page;
 $pageprev = $page - 1;
 $pagenext = $page + 1;
-$limit = $conf->liste_limit;
 if (! $sortorder) $sortorder="DESC";
 if (! $sortfield) $sortfield="dp";
 
diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php
index 6e3d31364ce9214376d25997893a91d51e6b45d2..0a5c2cd1572779d8f874105b6cdb67b5e7b74d2a 100644
--- a/htdocs/compta/paiement/list.php
+++ b/htdocs/compta/paiement/list.php
@@ -57,12 +57,12 @@ $search_amount=GETPOST("search_amount");
 $search_company=GETPOST("search_company");
 $sortfield = GETPOST("sortfield",'alpha');
 $sortorder = GETPOST("sortorder",'alpha');
+$limit = $conf->liste_limit;
 $page = GETPOST("page",'int');
 if ($page == -1) { $page = 0; }
-$offset = $conf->liste_limit * $page;
+$offset = $limit * $page;
 $pageprev = $page - 1;
 $pagenext = $page + 1;
-$limit = $conf->liste_limit;
 if (! $sortorder) $sortorder="DESC";
 if (! $sortfield) $sortfield="p.rowid";
 
diff --git a/htdocs/compta/ventilation/list.php b/htdocs/compta/ventilation/list.php
index 03a1b658cd274153ad71735257c6a2ae8f20b7d5..264673049add057f41b5bd6259721c9e06e7d8bd 100644
--- a/htdocs/compta/ventilation/list.php
+++ b/htdocs/compta/ventilation/list.php
@@ -47,12 +47,12 @@ llxHeader('','Ventilation');
 
 $sortfield = GETPOST("sortfield",'alpha');
 $sortorder = GETPOST("sortorder",'alpha');
+$limit = $conf->liste_limit;
 $page = GETPOST("page",'int');
 if ($page == -1) { $page = 0; }
-$offset = $conf->liste_limit * $page;
+$offset = $limit * $page;
 $pageprev = $page - 1;
 $pagenext = $page + 1;
-$limit = $conf->liste_limit;
 
 $sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, f.total as price, l.rowid, l.fk_code_ventilation,";
 $sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type";
diff --git a/htdocs/core/class/CSMSFile.class.php b/htdocs/core/class/CSMSFile.class.php
index b6819fdd87f3276a0af2a90a66808f4db5013098..4456df76f834c7409f1f3c01e4802e6c8d6bbf63 100644
--- a/htdocs/core/class/CSMSFile.class.php
+++ b/htdocs/core/class/CSMSFile.class.php
@@ -149,9 +149,10 @@ class CSMSFile
 		            $sms->message=$this->message;
 
                     $res=$sms->SmsSend();
+                    $this->error = $sms->error;
+                    $this->errors = $sms->errors;
     				if ($res <= 0)
     				{
-    					$this->error=$sms->error;
     					dol_syslog("CSMSFile::sendfile: sms send error=".$this->error, LOG_ERR);
     				}
     				else
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 18580c4b6cc3eff3b0a2f5f5cd5d34a975663411..a5643c26dc59458f09415af40b89f50d53a94f4f 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -2017,8 +2017,8 @@ class Form
             {
                 $dur=array("h"=>$langs->trans("Hour"),"d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year"));
             }
-            $opt.= ' - '.$duration_value.' '.$langs->trans($dur[$duration_unit]);
-            $outval.=' - '.$duration_value.' '.$langs->transnoentities($dur[$duration_unit]);
+            $opt.= ' - '.$duration_value.' '.($dur[$duration_unit]?$langs->trans($dur[$duration_unit]):'');
+            $outval.=' - '.$duration_value.' '.($dur[$duration_unit]?$langs->transnoentities($dur[$duration_unit]):'');
         }
 
         $opt.= "</option>\n";
diff --git a/htdocs/core/lib/accounting.lib.php b/htdocs/core/lib/accounting.lib.php
index 6e6da6bd6861ede6c3eef4030a4a09c46eb0cd64..502e83010f7fb22850b24a18510f1b9239255810 100644
--- a/htdocs/core/lib/accounting.lib.php
+++ b/htdocs/core/lib/accounting.lib.php
@@ -91,6 +91,19 @@ function accounting_prepare_head(AccountingAccount $object)
 	return $head;
 }
 
+/**
+ * Return accounting account without zero on the right
+ *
+ * @param 	string	$account		Accounting account
+ * @return	string          		String without zero on the right
+ */
+function clean_account($account)
+{
+	$account = rtrim($account,"0");
+	
+	return $account;
+}
+
 /**
  * Return general accounting account with defined length
  *
@@ -131,7 +144,7 @@ function length_accountg($account)
  */
 function length_accounta($accounta)
 {
-	global $conf, $langs;
+	global $conf;
 
 	$a = $conf->global->ACCOUNTING_LENGTH_AACCOUNT;
 
diff --git a/htdocs/don/list.php b/htdocs/don/list.php
index 0a91e59593d395ab092d588b278a317c38540d53..9477e91837eff8bf993ed347344705d0c4216518 100644
--- a/htdocs/don/list.php
+++ b/htdocs/don/list.php
@@ -34,13 +34,13 @@ $langs->load("donations");
 $sortfield = GETPOST("sortfield",'alpha');
 $sortorder = GETPOST("sortorder",'alpha');
 $page = GETPOST("page",'int');
+$limit = $conf->liste_limit;
 if ($page == -1) { $page = 0; }
-$offset = $conf->liste_limit * $page;
+$offset = $limit * $page;
 $pageprev = $page - 1;
 $pagenext = $page + 1;
 if (! $sortorder) $sortorder="DESC";
 if (! $sortfield) $sortfield="d.datedon";
-$limit = $conf->liste_limit;
 
 $statut=isset($_GET["statut"])?$_GET["statut"]:"-1";
 $search_all=GETPOST('sall','alpha');
diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php
index 36d85366805af587dca915202b9f5d9b9fbdc205..dfe848808c8fd6c3181c157674aa55781faa6844 100644
--- a/htdocs/expedition/card.php
+++ b/htdocs/expedition/card.php
@@ -224,7 +224,7 @@ if (empty($reshook))
 						$ret=$object->addline($entrepot_id,GETPOST($idl,'int'),GETPOST($qty,'int'));
 						if ($ret < 0)
 						{
-							$mesg='<div class="error">'.$object->error.'</div>';
+							setEventMessages($object->error, $object->errors, 'errors');
 							$error++;
 						}
 					}
@@ -237,7 +237,7 @@ if (empty($reshook))
 						$ret=$object->addline_batch($batch_line[$i]);
 						if ($ret < 0)
 						{
-							$mesg='<div class="error">'.$object->error.'</div>';
+							setEventMessages($object->error, $object->errors, 'errors');
 							$error++;
 						}
 					}
@@ -249,14 +249,14 @@ if (empty($reshook))
 	            $ret=$object->create($user);		// This create shipment (like Odoo picking) and line of shipments. Stock movement will when validating shipment.
 	            if ($ret <= 0)
 	            {
-	                $mesg='<div class="error">'.$object->error.'</div>';
+	                setEventMessages($object->error, $object->errors, 'errors');
 	                $error++;
 	            }
 	        }
 	    }
 	    else
 	    {
-	        $mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Qty")).'</div>';
+	        setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("QtyToShip")), null, 'errors');
 	        $error++;
 	    }
 
@@ -287,7 +287,7 @@ if (empty($reshook))
 	    }
 	    else
 	    {
-	        $mesg=$object->error;
+	        setEventMessages($object->error, $object->errors, 'errors');
 	    }
 	}
 
@@ -337,19 +337,18 @@ if (empty($reshook))
 	    }
 	    else
 		{
-			$langs->load("errors");
-	        setEventMessages($langs->trans($object->error), null, 'errors');
+			setEventMessages($object->error, $object->errors, 'errors');
 	    }
 	}
-
-	else if ($action == 'reopen' && (! empty($user->rights->expedition->creer) || ! empty($user->rights->expedition->shipping_advance->validate)))
+	// TODO add alternative status
+	/*else if ($action == 'reopen' && (! empty($user->rights->expedition->creer) || ! empty($user->rights->expedition->shipping_advance->validate)))
 	{
 	    $result = $object->setStatut(0);
 	    if ($result < 0)
 	    {
-	        $mesg = $object->error;
+	        setEventMessages($object->error, $object->errors, 'errors');
 	    }
-	}
+	}*/
 
 	else if ($action == 'setdate_livraison' && $user->rights->expedition->creer)
 	{
@@ -360,7 +359,7 @@ if (empty($reshook))
 	    $result=$object->set_date_livraison($user,$datedelivery);
 	    if ($result < 0)
 	    {
-	        $mesg='<div class="error">'.$object->error.'</div>';
+	        setEventMessages($object->error, $object->errors, 'errors');
 	    }
 	}
 
@@ -485,8 +484,6 @@ if ($action == 'create')
         setEventMessages($langs->trans("ErrorBadParameters"), null, 'errors');
     }
 
-    dol_htmloutput_mesg($mesg);
-
     if ($origin)
     {
         $classname = ucfirst($origin);
@@ -928,8 +925,6 @@ else if ($id || $ref)
 
 	if ($object->id > 0)
 	{
-		dol_htmloutput_mesg($mesg);
-
 		if (!empty($object->origin))
 		{
 			$typeobject = $object->origin;
@@ -943,8 +938,6 @@ else if ($id || $ref)
 		$head=shipping_prepare_head($object);
 		dol_fiche_head($head, 'shipping', $langs->trans("Shipment"), 0, 'sending');
 
-		dol_htmloutput_mesg($mesg);
-
 		/*
 		 * Confirmation de la suppression
 		*/
diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php
index d7bfc9aed9873c17a52eeb30e7d071349d0d1948..08b53bf9e2545708063cc24dd3961d1078319b25 100644
--- a/htdocs/expedition/class/expedition.class.php
+++ b/htdocs/expedition/class/expedition.class.php
@@ -1068,6 +1068,7 @@ class Expedition extends CommonObject
 								break;
 							}
 						}
+						if ($error) break; // break for loop incase of error
 					} 
 				}
 			}
diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php
index 5339538901e0d939e56b8742c8011490b6025c22..bee47fe25bd08f34b85193c192db13ffc73a498f 100644
--- a/htdocs/expedition/list.php
+++ b/htdocs/expedition/list.php
@@ -43,15 +43,14 @@ $optioncss = GETPOST('optioncss','alpha');
 $sortfield = GETPOST('sortfield','alpha');
 $sortorder = GETPOST('sortorder','alpha');
 $page = GETPOST('page','int');
+$limit = $conf->liste_limit;
 
 if ($page == -1) { $page = 0; }
-$offset = $conf->liste_limit * $page;
+$offset = $limit * $page;
 $pageprev = $page - 1;
 $pagenext = $page + 1;
-$limit = $conf->liste_limit;
 if (! $sortfield) $sortfield="e.ref";
 if (! $sortorder) $sortorder="DESC";
-$limit = $conf->liste_limit;
 
 $viewstatut=GETPOST('viewstatut');
 
diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php
index 502125faf613a631bb23c875315ea2746a3ea1fb..0d1dc22971a27150a9a09b2a8f5ea7b31ee2eba3 100644
--- a/htdocs/expensereport/list.php
+++ b/htdocs/expensereport/list.php
@@ -93,15 +93,15 @@ $sortfield     = GETPOST("sortfield");
 $page          = GETPOST("page");
 if (!$sortorder) $sortorder="DESC";
 if (!$sortfield) $sortfield="d.date_debut";
+$limit = $conf->liste_limit;
 
 if ($page == -1) {
 	$page = 0 ;
 }
 
-$offset = $conf->liste_limit * $page;
+$offset = $limit * $page;
 $pageprev = $page - 1;
 $pagenext = $page + 1;
-$limit = $conf->liste_limit;
 
 $sql = "SELECT d.rowid, d.ref, d.fk_user_author, d.total_ht, d.total_tva, d.total_ttc, d.fk_statut as status,";
 $sql.= " d.date_debut, d.date_fin,";
diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php
index 896d8c6a4fa4197c0b6dcfde6adce6229d96e283..35224cb7780bb1bf4cca42c9ae3ed06f2cbc5bc8 100644
--- a/htdocs/fichinter/list.php
+++ b/htdocs/fichinter/list.php
@@ -44,9 +44,10 @@ $result = restrictedArea($user, 'ficheinter', $fichinterid,'fichinter');
 
 $sortfield = GETPOST('sortfield','alpha');
 $sortorder = GETPOST('sortorder','alpha');
+$limit = $conf->liste_limit;
 $page = GETPOST('page','int');
 if ($page == -1) { $page = 0; }
-$offset = $conf->liste_limit * $page;
+$offset = $limit * $page;
 $pageprev = $page - 1;
 $pagenext = $page + 1;
 if (! $sortorder) $sortorder="DESC";
@@ -55,7 +56,6 @@ if (! $sortfield)
  	if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $sortfield="fd.date";
  	else $sortfield="f.ref";
 }
-$limit = $conf->liste_limit;
 
 $search_ref=GETPOST('search_ref')?GETPOST('search_ref','alpha'):GETPOST('search_inter','alpha');
 $search_company=GETPOST('search_company','alpha');
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index 1888cdc8adcb32283431c682c805dc7087a4935c..236eca113ff186070c1bdf388990491953694ac4 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -996,7 +996,7 @@ class CommandeFournisseur extends CommonOrder
         {
             $result = -1;
             $this->error = $langs->trans('NotAuthorized');
-            $this->errors[] = $lanfs->trans('NotAuthorized');
+            $this->errors[] = $langs->trans('NotAuthorized');
             dol_syslog(get_class($this)."::commande User not Authorized", LOG_ERR);
         }
         return $result ;
diff --git a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql
new file mode 100644
index 0000000000000000000000000000000000000000..f8a74fec247d8979823e90d699b771ba58450464
--- /dev/null
+++ b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql
@@ -0,0 +1,25 @@
+--
+-- Be carefull to requests order.
+-- This file must be loaded by calling /install/index.php page
+-- when current version is 4.0.0 or higher.
+--
+-- To rename a table:       ALTER TABLE llx_table RENAME TO llx_table_new;
+-- To add a column:         ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol;
+-- To rename a column:      ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60);
+-- To drop a column:        ALTER TABLE llx_table DROP COLUMN oldname;
+-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60);
+-- To drop a foreign key:   ALTER TABLE llx_table DROP FOREIGN KEY fk_name;
+-- To drop an index:        -- VMYSQL4.0 DROP INDEX nomindex on llx_table
+-- To drop an index:        -- VPGSQL8.0 DROP INDEX nomindex
+-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y
+-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y
+-- To make pk to be auto increment (mysql):    VMYSQL4.3 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT;
+-- To make pk to be auto increment (postgres): VPGSQL8.2 NOT POSSIBLE. MUST DELETE/CREATE TABLE
+-- To set a field as NULL:                     VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL;
+-- To set a field as default NULL:             VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL;
+-- Note: fields with type BLOB/TEXT can't have default value.
+-- -- VPGSQL8.2 DELETE FROM llx_usergroup_user      WHERE fk_user      NOT IN (SELECT rowid from llx_user);
+-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user      WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup);
+
+
+ALTER TABLE llx_accounting_bookkeeping ADD COLUMN validated tinyint DEFAULT 0 NOT NULL;
diff --git a/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql b/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql
index 660dd4745b321fcf90db5f8ef62b2d91c00adb36..dca4b70a5d56a2c93b1001832e5d11e4e851554f 100644
--- a/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql
+++ b/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql
@@ -35,5 +35,6 @@ CREATE TABLE llx_accounting_bookkeeping
   fk_user_author	integer NOT NULL,
   import_key		varchar(14),
   code_journal		varchar(10) DEFAULT NULL,
-  piece_num			integer NOT NULL
+  piece_num			integer NOT NULL,
+  validated         tinyint DEFAULT 0 NOT NULL -- 0 line not validated / 1 line validated (No deleting / No modification) 
 ) ENGINE=innodb;
diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php
index 4844d9f8e5941342197c1973da70914b036235ef..fe73419c98bf0d1e53e7d507ff5890b3122d87e7 100644
--- a/htdocs/opensurvey/list.php
+++ b/htdocs/opensurvey/list.php
@@ -38,9 +38,10 @@ $status=GETPOST('status');
 
 $sortfield = GETPOST("sortfield",'alpha');
 $sortorder = GETPOST("sortorder",'alpha');
+$limit = $conf->liste_limit;
 $page = GETPOST("page",'int');
 if ($page == -1) { $page = 0; }
-$offset = $conf->liste_limit * $page;
+$offset = $limit * $page;
 $pageprev = $page - 1;
 $pagenext = $page + 1;
 if (! $sortfield) $sortfield="p.date_fin";
@@ -48,8 +49,6 @@ if (! $sortorder) $sortorder="DESC";
 if ($page < 0) {
 	$page = 0;
 }
-$limit = $conf->liste_limit;
-$offset = $limit * $page;
 
 $langs->load("opensurvey");
 
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index 5f60724a135680e6fd764578ccfe49db20825d00..80deacdea889207ac5082cb5a89887e8731fcd12 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -151,21 +151,21 @@ if (empty($reshook))
         	else $errors[] = 'FailedToValidateBarCode';
 
 			$error++;
-			setEventMessage($errors,'errors');
+			setEventMessages($errors, null, 'errors');
 		}
     }
 
     if ($action == 'setaccountancy_code_buy') {
 
 	    $result = $object->setAccountancyCode('buy', GETPOST('accountancy_code_buy'));
-        if ($result < 0) setEventMessage(join(',',$object->errors), 'errors');
+        if ($result < 0) setEventMessages(join(',',$object->errors), null, 'errors');
         $action="";
     }
 
     if ($action == 'setaccountancy_code_sell')
     {
 	    $result = $object->setAccountancyCode('sell', GETPOST('accountancy_code_sell'));
-	    if ($result < 0) setEventMessage(join(',',$object->errors), 'errors');
+	    if ($result < 0) setEventMessages(join(',',$object->errors), null, 'errors');
 	    $action="";
     }
 
@@ -176,17 +176,23 @@ if (empty($reshook))
 
         if (! GETPOST('label'))
         {
-            setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('Label')), 'errors');
+            setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentities('Label')), null, 'errors');
             $action = "create";
             $error++;
         }
         if (empty($ref))
         {
-            setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('Ref')), 'errors');
+            setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentities('Ref')), null, 'errors');
             $action = "create";
             $error++;
         }
-
+        if (! empty(GETPOST('duration_value')) && empty(GETPOST('duration_unit')))
+        {
+            setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('Unit')), 'errors');
+            $action = "create";
+            $error++;
+        }
+        
         if (! $error)
         {
 	        $units = GETPOST('units', 'int');
@@ -226,7 +232,8 @@ if (empty($reshook))
             if ($result < 0)
             {
             	$error++;
-            	setEventMessage('Failed to get bar code type information '.$stdobject->error, 'errors');
+            	$mesg='Failed to get bar code type information ';
+            	setEventMessages($mesg.$stdobject->error, $mesg.$stdobject->errors, 'errors');
             }
             $object->barcode_type_code      = $stdobject->barcode_type_code;
             $object->barcode_type_coder     = $stdobject->barcode_type_coder;
@@ -295,8 +302,8 @@ if (empty($reshook))
             }
             else
 			{
-            	if (count($object->errors)) setEventMessage($object->errors, 'errors');
-				else setEventMessage($langs->trans($object->error), 'errors');
+            	if (count($object->errors)) setEventMessages($object->error, $object->errors, 'errors');
+				else setEventMessages($langs->trans($object->error), null, 'errors');
                 $action = "create";
             }
         }
@@ -358,7 +365,8 @@ if (empty($reshook))
     	        if ($result < 0)
     	        {
     	        	$error++;
-    	        	setEventMessage('Failed to get bar code type information '.$stdobject->error, 'errors');
+    	        	$mesg='Failed to get bar code type information ';
+            		setEventMessages($mesg.$stdobject->error, $mesg.$stdobject->errors, 'errors');
     	        }
     	        $object->barcode_type_code      = $stdobject->barcode_type_code;
     	        $object->barcode_type_coder     = $stdobject->barcode_type_coder;
@@ -383,15 +391,15 @@ if (empty($reshook))
                     }
                     else
 					{
-						if (count($object->errors)) setEventMessage($object->errors, 'errors');
-                    	else setEventMessage($langs->trans($object->error), 'errors');
+						if (count($object->errors)) setEventMessages($object->error, $object->errors, 'errors');
+                    	else setEventMessages($langs->trans($object->error), null, 'errors');
                         $action = 'edit';
                     }
                 }
                 else
 				{
-					if (count($object->errors)) setEventMessage($object->errors, 'errors');
-                	else setEventMessage($langs->trans("ErrorProductBadRefOrLabel"), 'errors');
+					if (count($object->errors)) setEventMessages($object->error, $object->errors, 'errors');
+                	else setEventMessages($langs->trans("ErrorProductBadRefOrLabel"), null, 'errors');
                     $action = 'edit';
                 }
             }
@@ -405,7 +413,7 @@ if (empty($reshook))
     {
         if (! GETPOST('clone_content') && ! GETPOST('clone_prices') )
         {
-        	setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors');
+        	setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
         }
         else
         {
@@ -432,7 +440,7 @@ if (empty($reshook))
                             if ($result < 1)
                             {
                                 $db->rollback();
-                                setEventMessage($langs->trans('ErrorProductClone'), 'errors');
+                                setEventMessages($langs->trans('ErrorProductClone'), null, 'errors');
                                 header("Location: ".$_SERVER["PHP_SELF"]."?id=".$originalId);
                                 exit;
                             }
@@ -459,7 +467,7 @@ if (empty($reshook))
 
                             $mesg=$langs->trans("ErrorProductAlreadyExists",$object->ref);
                             $mesg.=' <a href="'.$_SERVER["PHP_SELF"].'?ref='.$object->ref.'">'.$langs->trans("ShowCardHere").'</a>.';
-                            setEventMessage($mesg, 'errors');
+                            setEventMessages($mesg, null, 'errors');
                             $object->fetch($id);
                         }
                         else
@@ -467,12 +475,12 @@ if (empty($reshook))
                             $db->rollback();
                             if (count($object->errors))
                             {
-                            	setEventMessage($object->errors, 'errors');
+                            	setEventMessages($object->error, $object->errors, 'errors');
                             	dol_print_error($db,$object->errors);
                             }
                             else
                             {
-                            	setEventMessage($langs->trans($object->error), 'errors');
+                            	setEventMessages($langs->trans($object->error), null, 'errors');
                             	dol_print_error($db,$object->error);
                             }
                         }
@@ -503,7 +511,7 @@ if (empty($reshook))
         }
         else
         {
-        	setEventMessage($langs->trans($object->error), 'errors');
+        	setEventMessages($langs->trans($object->error), null, 'errors');
             $reload = 0;
             $action='';
         }
@@ -629,7 +637,7 @@ if (empty($reshook))
                     return;
                 }
 
-                setEventMessage($langs->trans("ErrorUnknown") . ": $result", 'errors');
+                setEventMessages($langs->trans("ErrorUnknown") . ": $result", null, 'errors');
             } elseif (GETPOST('commandeid') > 0) {
                 $result = $commande->addline(
                     $desc,
@@ -701,7 +709,7 @@ if (empty($reshook))
         }
         else {
             $action="";
-            setEventMessage($langs->trans("WarningSelectOneDocument"), 'warnings');
+            setEventMessages($langs->trans("WarningSelectOneDocument"), null, 'warnings');
 
         }
     }
diff --git a/htdocs/product/document.php b/htdocs/product/document.php
index ecb3d12bb52d8ffb76d63248fbf3c8f985536322..8a4c68990c6820c22be7baae1e4219a09a799efe 100644
--- a/htdocs/product/document.php
+++ b/htdocs/product/document.php
@@ -105,7 +105,7 @@ if (empty($reshook))
 			$filetomerge->file_name=$filename;
 			$result=$filetomerge->delete_by_file($user);
 			if ($result<0) {
-				setEventMessage($filetomerge->error,'errors');
+				setEventMessages($filetomerge->error, $filetomerge->errors, 'errors');
 			}
 		}
 	}
@@ -137,7 +137,7 @@ if ($action=='filemerge')
 			$result=$filetomerge->delete_by_product($user, $object->id);
 		}
 		if ($result<0) {
-			setEventMessage($filetomerge->error,'errors');
+			setEventMessages($filetomerge->error, $filetomerge->errors, 'errors');
 		}
 
 		// for each file checked add it to the product
@@ -152,7 +152,7 @@ if ($action=='filemerge')
 
 				$result=$filetomerge->create($user);
 				if ($result<0) {
-					setEventMessage($filetomerge->error,'errors');
+					setEventMessages($filetomerge->error, $filetomerge->errors, 'errors');
 				}
 			}
 		}
diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php
index 04007d2ede18f8ff53a9a47d1f2dad631eb2e732..1f5e35a043a1351fadb821ec79a522e80daa2a84 100644
--- a/htdocs/product/fournisseurs.php
+++ b/htdocs/product/fournisseurs.php
@@ -101,7 +101,7 @@ if (empty($reshook))
 			if ($result > 0)
 			{
 				$object->cost_price = price2num($cost_price);
-				setEventMessage($langs->trans("RecordSaved"));
+				setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
 			}
 			else
 			{
@@ -119,7 +119,7 @@ if (empty($reshook))
 			$action = '';
 			$result=$object->remove_product_fournisseur_price($rowid);
 			if($result > 0){
-				setEventMessage($langs->trans("PriceRemoved"));
+				setEventMessages($langs->trans("PriceRemoved"), null, 'mesgs');
 			}else{
 				$error++;
 				setEventMessages($object->error, $object->errors, 'errors');
@@ -151,7 +151,7 @@ if (empty($reshook))
 		{
 			$error++;
 			$langs->load("errors");
-			setEventMessage($langs->trans("ErrorFieldMustBeANumeric",'eeee'), 'errors');
+			setEventMessages($langs->trans("ErrorFieldMustBeANumeric",'eeee'), null, 'errors');
 		}
 		if (empty($quantity))
 		{
@@ -199,12 +199,12 @@ if (empty($reshook))
 					$object->fetch($object->product_id_already_linked);
 					$productLink = $object->getNomUrl(1,'supplier');
 
-					setEventMessage($langs->trans("ReferenceSupplierIsAlreadyAssociatedWithAProduct",$productLink), 'errors');
+					setEventMessages($langs->trans("ReferenceSupplierIsAlreadyAssociatedWithAProduct",$productLink), null, 'errors');
 				}
 				else if ($ret < 0)
 				{
 					$error++;
-					setEventMessage($object->error, 'errors');
+					setEventMessages($object->error, $object->errors, 'errors');
 				}
 			}
 
@@ -220,7 +220,7 @@ if (empty($reshook))
 				{
 
 					$error++;
-					setEventMessage($object->error, $object->errors, 'errors');
+					setEventMessages($object->error, $object->errors, 'errors');
 				}
 				else
 				{
@@ -231,7 +231,7 @@ if (empty($reshook))
 						$price_result = $priceparser->parseProductSupplier($id, $price_expression, $quantity, $tva_tx);
 						if ($price_result < 0) { //Expression is not valid
 							$error++;
-							setEventMessage($priceparser->translatedError(), 'errors');
+							setEventMessages($priceparser->translatedError(), null, 'errors');
 						}
 					}
 					if (! $error && ! empty($conf->dynamicprices->enabled)) {
@@ -239,7 +239,7 @@ if (empty($reshook))
 						if ($ret < 0)
 						{
 							$error++;
-							setEventMessage($object->error, 'errors');
+							setEventMessages($object->error, $object->errors, 'errors');
 						}
 					}
 				}
diff --git a/htdocs/product/list.php b/htdocs/product/list.php
index b656b88efc689ebb23913d9c7779224b3e29983c..5924a89956bfbda120c22e443c9e6b0ab4830211 100644
--- a/htdocs/product/list.php
+++ b/htdocs/product/list.php
@@ -61,7 +61,7 @@ $sortfield = GETPOST("sortfield",'alpha');
 $sortorder = GETPOST("sortorder",'alpha');
 $page = GETPOST("page",'int');
 if ($page == -1) { $page = 0; }
-$offset = $liste_limit * $page;
+$offset = $limit * $page;
 $pageprev = $page - 1;
 $pagenext = $page + 1;
 if (! $sortfield) $sortfield="p.ref";
@@ -293,7 +293,7 @@ else
 
     	// Displays product removal confirmation
     	if (GETPOST('delprod'))	{
-		    setEventMessage($langs->trans("ProductDeleted", GETPOST('delprod')));
+		    setEventMessages($langs->trans("ProductDeleted", GETPOST('delprod')), null, 'mesgs');
 	    }
 
     	if ($sref) $param="&amp;sref=".$sref;
diff --git a/htdocs/product/price.php b/htdocs/product/price.php
index 2a770841c603386274c1a1bdef76ef679bf7a08b..e5b93d981afc722b344ba650d3b07f12ae292a66 100644
--- a/htdocs/product/price.php
+++ b/htdocs/product/price.php
@@ -6,7 +6,7 @@
  * Copyright (C) 2006		Andre Cianfarani		<acianfa@free.fr>
  * Copyright (C) 2014		Florian Henry			<florian.henry@open-concept.pro>
  * Copyright (C) 2014		Juanjo Menent			<jmenent@2byte.es>
- * Copyright (C) 2014 	    Philippe Grand 		    <philippe.grand@atoo-net.com>
+ * Copyright (C) 2014-2015 	Philippe Grand 		    <philippe.grand@atoo-net.com>
  * Copyright (C) 2014		Ion agorria				<ion@agorria.com>
  * Copyright (C) 2015		Alexandre Spangaro		<aspangaro.dolibarr@gmail.com>
  * Copyright (C) 2015		Marcos GarcĂ­a			<marcosgdf@gmail.com>
@@ -131,7 +131,7 @@ if (empty($reshook))
 
 				if ($priceparser->parseProduct($object) < 0) {
 					$error ++;
-					setEventMessage($priceparser->translatedError(), 'errors');
+					setEventMessages($priceparser->translatedError(), null, 'errors');
 				}
 			}
 		}
@@ -194,7 +194,7 @@ if (empty($reshook))
 				$newprice_min = price2num($val['price_min'], 'MU');
 
 				if (!empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE) && $newprice_min < $maxpricesupplier) {
-					setEventMessage($langs->trans("MinimumPriceLimit", price($maxpricesupplier, 0, '', 1, - 1, - 1, 'auto')), 'errors');
+					setEventMessages($langs->trans("MinimumPriceLimit", price($maxpricesupplier, 0, '', 1, - 1, - 1, 'auto')), null, 'errors');
 					$error ++;
 					break;
 				}
@@ -203,7 +203,7 @@ if (empty($reshook))
 
 				if ($res < 0) {
 					$error ++;
-					setEventMessage($object->error, 'errors');
+					setEventMessages($object->error, $object->errors, 'errors');
 					break;
 				}
 			}
@@ -211,12 +211,12 @@ if (empty($reshook))
 
 		if (!$error && $object->update($object->id, $user) < 0) {
 			$error++;
-			setEventMessage($object->error, 'errors');
+			setEventMessages($object->error, $object->errors, 'errors');
 		}
 
 		if (empty($error)) {
 			$action = '';
-			setEventMessage($langs->trans("RecordSaved"));
+			setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
 			$db->commit();
 		} else {
 			$action = 'edit_price';
@@ -229,7 +229,7 @@ if (empty($reshook))
 	{
 		$result = $object->log_price_delete($user, $_GET ["lineid"]);
 		if ($result < 0) {
-			setEventMessage($object->error, 'errors');
+			setEventMessages($object->error, $object->errors, 'errors');
 		}
 	}
 
@@ -341,7 +341,7 @@ if (empty($reshook))
 
 		if (! empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE) && $prodcustprice->price_min<$maxpricesupplier)
 		{
-			setEventMessage($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')),'errors');
+			setEventMessages($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')), null, 'errors');
 			$error++;
 			$action='add_customer_price';
 		}
@@ -351,9 +351,9 @@ if (empty($reshook))
 			$result = $prodcustprice->create($user, 0, $update_child_soc);
 
 			if ($result < 0) {
-				setEventMessage($prodcustprice->error, 'errors');
+				setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
 			} else {
-				setEventMessage($langs->trans('RecordSaved'), 'mesgs');
+				setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
 			}
 
 			$action = '';
@@ -367,9 +367,9 @@ if (empty($reshook))
 		$result = $prodcustprice->delete($user);
 
 		if ($result < 0) {
-			setEventMessage($prodcustprice->error, 'mesgs');
+			setEventMessages($prodcustprice->error, $prodcustprice->errors, 'mesgs');
 		} else {
-			setEventMessage($langs->trans('RecordDeleted'), 'errors');
+			setEventMessages($langs->trans('RecordDeleted'), null, 'errors');
 		}
 		$action = '';
 	}
@@ -391,7 +391,7 @@ if (empty($reshook))
 
 		if ($prodcustprice->price_min<$maxpricesupplier && !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE))
 		{
-			setEventMessage($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')),'errors');
+			setEventMessages($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')), null, 'errors');
 			$error++;
 			$action='update_customer_price';
 		}
@@ -401,9 +401,9 @@ if (empty($reshook))
 			$result = $prodcustprice->update($user, 0, $update_child_soc);
 
 			if ($result < 0) {
-				setEventMessage($prodcustprice->error, 'errors');
+				setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
 			} else {
-				setEventMessage($langs->trans('Save'), 'mesgs');
+				setEventMessages($langs->trans('Save'), null, 'mesgs');
 			}
 
 			$action = '';
@@ -1257,7 +1257,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
 
 		$result = $prodcustprice->fetch(GETPOST('lineid', 'int'));
 		if ($result < 0) {
-			setEventMessage($prodcustprice->error, 'errors');
+			setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
 		}
 
 		print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">';
@@ -1346,7 +1346,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
 
 		$result = $prodcustprice->fetch_all_log($sortorder, $sortfield, $conf->liste_limit, $offset, $filter);
 		if ($result < 0) {
-			setEventMessage($prodcustprice->error, 'errors');
+			setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
 		}
 
 		$option = '&socid=' . GETPOST('socid', 'int') . '&id=' . $object->id;
@@ -1422,7 +1422,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
 
 		$result = $prodcustprice->fetch_all($sortorder, $sortfield, $conf->liste_limit, $offset, $filter);
 		if ($result < 0) {
-			setEventMessage($prodcustprice->error, 'errors');
+			setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
 		}
 
 		$option = '&search_soc=' . $search_soc . '&id=' . $object->id;
diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php
index 561b38977ac2552c1789301fc004d35da3ef2d09..dde89bfb6e52272b243516dc12f45591487e54c3 100644
--- a/htdocs/product/stock/class/mouvementstock.class.php
+++ b/htdocs/product/stock/class/mouvementstock.class.php
@@ -139,15 +139,15 @@ class MouvementStock extends CommonObject
             		$obj = $this->db->fetch_object($resql);
             		if ($this->db->jdate($obj->eatby) != $eatby)
             		{
-						$this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, $this->db->jdate($obj->eatby), $eatby);
-						dol_syslog($langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, $this->db->jdate($obj->eatby), $eatby));
+						$this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby)), dol_print_date($eatby));
+						dol_syslog($langs->transnoentities("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby)), dol_print_date($eatby)), LOG_ERR);
 						$this->db->rollback();
             			return -3;
             		}
             		if ($this->db->jdate($obj->sellby) != $sellby)
             		{
-						$this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, $this->db->jdate($obj->sellby), $sellby);
-						dol_syslog($langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, $this->db->jdate($obj->sellby), $sellby));
+						$this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->sellby)), dol_print_date($sellby));
+						dol_syslog($langs->transnoentities("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->sellby)), dol_print_date($sellby)), LOG_ERR);
 						$this->db->rollback();
             			return -3;
             		}
diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php
index a6085699a63a86f8db3138c4afb4b13529270655..fbb80551fadcbd84625bc26624fff79a80a971fd 100644
--- a/htdocs/product/stock/mouvement.php
+++ b/htdocs/product/stock/mouvement.php
@@ -54,11 +54,12 @@ $search_warehouse = trim(GETPOST("search_warehouse"));
 $search_inventorycode = trim(GETPOST("search_inventorycode"));
 $search_user = trim(GETPOST("search_user"));
 $search_batch = trim(GETPOST("search_batch"));
+$limit = $conf->liste_limit;
 $page = GETPOST("page",'int');
 $sortfield = GETPOST("sortfield",'alpha');
 $sortorder = GETPOST("sortorder",'alpha');
 if ($page < 0) $page = 0;
-$offset = $conf->liste_limit * $page;
+$offset = $limit * $page;
 
 if (! $sortfield) $sortfield="m.datem";
 if (! $sortorder) $sortorder="DESC";
@@ -100,7 +101,7 @@ if ($action == "correct_stock")
 	if (! is_numeric($_POST["nbpiece"]))
 	{
 		$error++;
-		setEventMessage($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentitiesnoconv("NumberOfUnit")), 'errors');
+		setEventMessages($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentitiesnoconv("NumberOfUnit")), null, 'errors');
 		$action='correction';
 	}
 
@@ -203,6 +204,14 @@ if (! empty($search_product))       $sql.= " AND p.label LIKE '%".$db->escape($s
 if (! empty($search_warehouse))     $sql.= " AND e.label LIKE '%".$db->escape($search_warehouse)."%'";
 if (! empty($search_user))          $sql.= " AND u.login LIKE '%".$db->escape($search_user)."%'";
 if (! empty($search_batch))         $sql.= " AND m.batch LIKE '%".$db->escape($search_batch)."%'";
+
+$nbtotalofrecords = 0;
+if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
+{
+    $result = $db->query($sql);
+    $nbtotalofrecords = $db->num_rows($result);
+}
+
 $sql.= $db->order($sortfield,$sortorder);
 $sql.= $db->plimit($conf->liste_limit+1, $offset);
 
@@ -248,7 +257,7 @@ if ($resql)
 
         print '<table class="border" width="100%">';
 
-        $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>';
+        $linkback = '<a href="'.DOL_URL_ROOT.'/product/stock/list.php">'.$langs->trans("BackToList").'</a>';
 
         // Ref
         print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td colspan="3">';
@@ -470,8 +479,8 @@ if ($resql)
     if (!empty($snom)) $param.='&snom='.urlencode($snom); // FIXME $snom is not defined
     if ($search_user)    $param.='&search_user='.urlencode($search_user);
     if ($idproduct > 0)  $param.='&idproduct='.$idproduct;
-    if ($id) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num,0,'');
-    else print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num);
+    if ($id) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $nbtotalofrecords,'');
+    else print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $nbtotalofrecords);
 
     print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">';
     if ($id) print '<input type="hidden" name="id" value="'.$id.'">';
diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php
index 0476a459f606e4dca2eb9209ea540a36d611f230..ad4acbe362af73a6015e59e43c32cb20b489d752 100644
--- a/htdocs/product/stock/product.php
+++ b/htdocs/product/stock/product.php
@@ -77,7 +77,7 @@ if ($action == 'setstocklimit')
     $object->seuil_stock_alerte=$stocklimit;
     $result=$object->update($object->id,$user,0,'update');
     if ($result < 0)
-    	setEventMessage($object->error, 'errors');
+    	setEventMessages($object->error, $object->errors, 'errors');
     $action='';
 }
 
@@ -89,7 +89,7 @@ if ($action == 'setdesiredstock')
     $object->desiredstock=$desiredstock;
     $result=$object->update($object->id,$user,0,'update');
     if ($result < 0)
-    	setEventMessage($object->error, 'errors');
+    	setEventMessages($object->error, $object->errors, 'errors');
     $action='';
 }
 
diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php
index 620f1acbb404bb9c0a32d3ca74b6ba7cd8ae2da3..5df580877c57ce18eb8d6f4c72b1d9be2d904423 100644
--- a/htdocs/product/stock/replenish.php
+++ b/htdocs/product/stock/replenish.php
@@ -176,7 +176,7 @@ if ($action == 'order' && isset($_POST['valid']))
                     $fail++;
                     $msg = $langs->trans('OrderFail') . "&nbsp;:&nbsp;";
                     $msg .= $order->error;
-                    setEventMessage($msg, 'errors');
+                    setEventMessages($msg, null, 'errors');
                 } else {
                     $id = $result;
                 }
@@ -195,7 +195,7 @@ if ($action == 'order' && isset($_POST['valid']))
                     $fail++;
                     $msg = $langs->trans('OrderFail') . "&nbsp;:&nbsp;";
                     $msg .= $order->error;
-                    setEventMessage($msg, 'errors');
+                    setEventMessages($msg, null, 'errors');
                 }
                 $i++;
             }
@@ -205,7 +205,7 @@ if ($action == 'order' && isset($_POST['valid']))
         {
         	$db->commit();
 
-            setEventMessage($langs->trans('OrderCreated'), 'mesgs');
+            setEventMessages($langs->trans('OrderCreated'), null, 'mesgs');
             header('Location: replenishorders.php');
             exit;
         }
@@ -216,7 +216,7 @@ if ($action == 'order' && isset($_POST['valid']))
     }
     if ($box == 0)
     {
-        setEventMessage($langs->trans('SelectProductWithNotNullQty'), 'warnings');
+        setEventMessages($langs->trans('SelectProductWithNotNullQty'), null, 'warnings');
     }
 }
 
diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php
index a40b7b15cd9abe1cc6230fd5864beb5e47793170..96c94e9efffc326755429677a5a1e9751238bb35 100644
--- a/htdocs/product/traduction.php
+++ b/htdocs/product/traduction.php
@@ -94,7 +94,7 @@ $cancel != $langs->trans("Cancel") &&
 	else
 	{
 		$action = 'add';
-		setEventMessage($object->error,'errors');
+		setEventMessages($object->error, $object->errors, 'errors');
 	}
 }
 
@@ -130,7 +130,7 @@ $cancel != $langs->trans("Cancel") &&
 	else
 	{
 		$action = 'edit';
-		setEventMessage($object->error,'errors');
+		setEventMessages($object->error, $object->errors, 'errors');
 	}
 }
 
@@ -151,7 +151,7 @@ $cancel != $langs->trans("Cancel") &&
 	else
 	{
 		$action = 'edit';
-		setEventMessage($object->error,'errors');
+		setEventMessages($object->error, $object->errors, 'errors');
 	}
 }
 
diff --git a/htdocs/public/members/public_list.php b/htdocs/public/members/public_list.php
index ea2b70c24475835650abfb575fb74707301bfced..d96d238c41bf13dd62029913228761507d93e803 100644
--- a/htdocs/public/members/public_list.php
+++ b/htdocs/public/members/public_list.php
@@ -81,9 +81,10 @@ function llxFooterVierge()
 
 $sortfield = GETPOST("sortfield",'alpha');
 $sortorder = GETPOST("sortorder",'alpha');
+$limit = $conf->liste_limit;
 $page = GETPOST("page",'int');
 if ($page == -1) { $page = 0; }
-$offset = $conf->liste_limit * $page;
+$offset = $limit * $page;
 $pageprev = $page - 1;
 $pagenext = $page + 1;
 
diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php
index 64ac2fbb2565f671366a01de52b1821c697657af..6341f1dd37e731ad2f01f87ab271053ab5feb5ef 100644
--- a/htdocs/societe/price.php
+++ b/htdocs/societe/price.php
@@ -181,11 +181,12 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
 
 	$sortfield = GETPOST("sortfield", 'alpha');
 	$sortorder = GETPOST("sortorder", 'alpha');
+    $limit = $conf->liste_limit;
 	$page = GETPOST("page", 'int');
 	if ($page == - 1) {
 		$page = 0;
 	}
-	$offset = $conf->liste_limit * $page;
+	$offset = $limit * $page;
 	$pageprev = $page - 1;
 	$pagenext = $page + 1;
 	if (! $sortorder)
@@ -200,7 +201,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
 
 	$search_soc = GETPOST('search_soc');
 	if (! empty($search_soc)) {
-		$filter ['soc.nom'] = $search_soc;
+		$filter['soc.nom'] = $search_soc;
 	}
 
 	if ($action == 'add_customer_price') {
diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php
index 6aad541c1f97f5d3e861768e9cddffa3a8adee29..1df4b49b56a169eef38c05c87156c47d34258969 100644
--- a/htdocs/supplier_proposal/list.php
+++ b/htdocs/supplier_proposal/list.php
@@ -139,15 +139,15 @@ $now=dol_now();
 
 $sortfield = GETPOST("sortfield",'alpha');
 $sortorder = GETPOST("sortorder",'alpha');
+$limit = $conf->liste_limit;
 $page = GETPOST("page",'int');
 if ($page == -1) { $page = 0; }
-$offset = $conf->liste_limit * $page;
+$offset = $limit * $page;
 $pageprev = $page - 1;
 $pagenext = $page + 1;
 
 if (! $sortfield) $sortfield='p.date_livraison';
 if (! $sortorder) $sortorder='DESC';
-$limit = $conf->liste_limit;
 
 
 $sql = 'SELECT s.rowid, s.nom as name, s.town, s.client, s.code_client,';