diff --git a/htdocs/admin/askpricesupplier.php b/htdocs/admin/askpricesupplier.php
index 5644605e625f2dc1f2e487ffdb6369ba0cbc5a7d..9bde4673ace7dde297ac2d9999424aea5397eecd 100644
--- a/htdocs/admin/askpricesupplier.php
+++ b/htdocs/admin/askpricesupplier.php
@@ -249,7 +249,7 @@ dol_fiche_head($head, 'general', $langs->trans("CommRequests"), 0, 'askpricesupp
 /*
  *  Module numerotation
  */
-print load_fiche_titre($langs->trans("AskPriceSupplierNumberingModules"));
+print load_fiche_titre($langs->trans("AskPriceSupplierNumberingModules"),'','');
 
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre">';
@@ -351,7 +351,7 @@ print "</table><br>\n";
  * Document templates generators
  */
 
-print load_fiche_titre($langs->trans("AskPriceSupplierPDFModules"));
+print load_fiche_titre($langs->trans("AskPriceSupplierPDFModules"),'','');
 
 // Load array def with activated templates
 $def = array();
@@ -513,7 +513,7 @@ print '<br>';
  * Other options
  *
  */
-print load_fiche_titre($langs->trans("OtherOptions"));
+print load_fiche_titre($langs->trans("OtherOptions"),'','');
 
 $var=true;
 print "<table class=\"noborder\" width=\"100%\">";
@@ -594,7 +594,7 @@ print '</table>';
  *  Directory
  */
 print '<br>';
-print load_fiche_titre($langs->trans("PathToDocuments"));
+print load_fiche_titre($langs->trans("PathToDocuments"),'','');
 
 print "<table class=\"noborder\" width=\"100%\">\n";
 print "<tr class=\"liste_titre\">\n";
diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php
index 1d51e552280902dc1a922ecaf5dfe2dfdfb624c5..b36a222c165900fb895842c2940a4071fbc1c056 100644
--- a/htdocs/admin/barcode.php
+++ b/htdocs/admin/barcode.php
@@ -188,7 +188,7 @@ foreach($dirbarcode as $reldir)
 $var=true;
 
 print '<br>';
-print load_fiche_titre($langs->trans("BarcodeEncodeModule"));
+print load_fiche_titre($langs->trans("BarcodeEncodeModule"),'','');
 
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre">';
@@ -288,7 +288,7 @@ print "<br>";
  * Autres options
  *
  */
-print load_fiche_titre($langs->trans("OtherOptions"));
+print load_fiche_titre($langs->trans("OtherOptions"),'','');
 
 print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
 print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@@ -358,7 +358,7 @@ print '<br>';
 // Select barcode numbering module
 if ($conf->produit->enabled)
 {
-	print load_fiche_titre($langs->trans("BarCodeNumberManager")." (".$langs->trans("Product").")");
+	print load_fiche_titre($langs->trans("BarCodeNumberManager")." (".$langs->trans("Product").")",'','');
 
 	print '<table class="noborder" width="100%">';
 	print '<tr class="liste_titre">';
diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php
index b2d44047d779578d4ea5c1700b9fa9953a794041..860e1a217724e4890860eedd4c23ffbdae35e282 100644
--- a/htdocs/admin/commande.php
+++ b/htdocs/admin/commande.php
@@ -273,7 +273,7 @@ dol_fiche_head($head, 'general', $langs->trans("Orders"), 0, 'order');
  * Orders Numbering model
  */
 
-print load_fiche_titre($langs->trans("OrdersNumberingModules"));
+print load_fiche_titre($langs->trans("OrdersNumberingModules"),'','');
 
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre">';
@@ -377,7 +377,7 @@ print "</table><br>\n";
  * Document templates generators
  */
 
-print load_fiche_titre($langs->trans("OrdersModelModule"));
+print load_fiche_titre($langs->trans("OrdersModelModule"),'','');
 
 // Load array def with activated templates
 $def = array();
@@ -540,7 +540,7 @@ print "<br>";
  *
  */
 
-print load_fiche_titre($langs->trans("OtherOptions"));
+print load_fiche_titre($langs->trans("OtherOptions"),'','');
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre">';
 print '<td>'.$langs->trans("Parameter").'</td>';
@@ -638,7 +638,7 @@ print '<br>';
  * Notifications
  */
 
-print load_fiche_titre($langs->trans("Notifications"));
+print load_fiche_titre($langs->trans("Notifications"),'','');
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre">';
 print '<td>'.$langs->trans("Parameter").'</td>';
diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php
index cf93977fc8b436ac0dad19c0e0f8858e6974524f..a45045a5381ef1e9ac656b141145ec8e6234cfdf 100644
--- a/htdocs/admin/contract.php
+++ b/htdocs/admin/contract.php
@@ -226,7 +226,7 @@ dol_fiche_head($head, 'contract', $langs->trans("Contracts"), 0, 'contract');
  * Contracts Numbering model
  */
 
-print load_fiche_titre($langs->trans("ContractsNumberingModules"));
+print load_fiche_titre($langs->trans("ContractsNumberingModules"),'','');
 
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre">';
@@ -329,7 +329,7 @@ print '</table><br>';
  *  Documents models for Contracts
  */
 
-print load_fiche_titre($langs->trans("TemplatePDFContracts"));
+print load_fiche_titre($langs->trans("TemplatePDFContracts"),'','');
 
 // Defini tableau def des modeles
 $def = array();
@@ -494,7 +494,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
 print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
 print '<input type="hidden" name="action" value="set_other">';
 
-print load_fiche_titre($langs->trans("OtherOptions"));
+print load_fiche_titre($langs->trans("OtherOptions"),'','');
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre">';
 print '<td>'.$langs->trans("Parameter").'</td>';
diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php
index f1b5eeb142788bf671b7c5db806977c68379656f..ab5f7fb013f5c7bc450d084f71b3da8fec800e68 100644
--- a/htdocs/admin/expensereport.php
+++ b/htdocs/admin/expensereport.php
@@ -244,7 +244,7 @@ dol_fiche_head($head, 'expensereport', $langs->trans("ExpenseReports"), 0, 'trip
 
 // Interventions numbering model
 /*
-print load_fiche_titre($langs->trans("FicheinterNumberingModules"));
+print load_fiche_titre($langs->trans("FicheinterNumberingModules"),'','');
 
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre">';
diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php
index 07b00e5133ff3a86731986644b387391a7f4c04b..568cd5dca2191af65c7986f5e5c15172416d0694 100644
--- a/htdocs/admin/facture.php
+++ b/htdocs/admin/facture.php
@@ -302,7 +302,7 @@ dol_fiche_head($head, 'general', $langs->trans("Invoices"), 0, 'invoice');
  *  Numbering module
  */
 
-print load_fiche_titre($langs->trans("BillsNumberingModule"));
+print load_fiche_titre($langs->trans("BillsNumberingModule"),'','');
 
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre">';
@@ -471,7 +471,7 @@ print '</table>';
  *  Document templates generators
  */
 print '<br>';
-print load_fiche_titre($langs->trans("BillsPDFModules"));
+print load_fiche_titre($langs->trans("BillsPDFModules"),'','');
 
 // Load array def with activated templates
 $type='invoice';
@@ -631,7 +631,7 @@ print '</table>';
  *  Modes de reglement
  */
 print '<br>';
-print load_fiche_titre($langs->trans("SuggestedPaymentModesIfNotDefinedInInvoice"));
+print load_fiche_titre($langs->trans("SuggestedPaymentModesIfNotDefinedInInvoice"),'','');
 
 print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
 print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
@@ -726,7 +726,7 @@ print "</form>";
 
 
 print "<br>";
-print load_fiche_titre($langs->trans("OtherOptions"));
+print load_fiche_titre($langs->trans("OtherOptions"),'','');
 
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre">';
@@ -805,7 +805,7 @@ print '</table>';
  *  Repertoire
  */
 print '<br>';
-print load_fiche_titre($langs->trans("PathToDocuments"));
+print load_fiche_titre($langs->trans("PathToDocuments"),'','');
 
 print '<table class="noborder" width="100%">'."\n";
 print '<tr class="liste_titre">'."\n";
@@ -823,7 +823,7 @@ print "</table>\n";
  * Notifications
  */
 print '<br>';
-print load_fiche_titre($langs->trans("Notifications"));
+print load_fiche_titre($langs->trans("Notifications"),'','');
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre">';
 print '<td>'.$langs->trans("Parameter").'</td>';
diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php
index 865945e2e5b9c6081ae7c79e26dac9cd71acb323..d29420316a989ba468f9ed9436aef711f40e28c8 100644
--- a/htdocs/admin/fichinter.php
+++ b/htdocs/admin/fichinter.php
@@ -255,7 +255,7 @@ dol_fiche_head($head, 'ficheinter', $langs->trans("Interventions"), 0, 'interven
 
 // Interventions numbering model
 
-print load_fiche_titre($langs->trans("FicheinterNumberingModules"));
+print load_fiche_titre($langs->trans("FicheinterNumberingModules"),'','');
 
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre">';
@@ -357,7 +357,7 @@ print '</table><br>';
  *  Documents models for Interventions
  */
 
-print load_fiche_titre($langs->trans("TemplatePDFInterventions"));
+print load_fiche_titre($langs->trans("TemplatePDFInterventions"),'','');
 
 // Defini tableau def des modeles
 $type='ficheinter';
@@ -511,7 +511,7 @@ print "<br>";
  *
  */
 
-print load_fiche_titre($langs->trans("OtherOptions"));
+print load_fiche_titre($langs->trans("OtherOptions"),'','');
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre">';
 print '<td>'.$langs->trans("Parameter").'</td>';
diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php
index 9257aada0292cc39c680acc48a83e514bbf05303..38345adac9a23fd65a691d6d425f4e38f587fa52 100644
--- a/htdocs/admin/livraison.php
+++ b/htdocs/admin/livraison.php
@@ -237,7 +237,7 @@ dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
  * Livraison numbering model
  */
 
-print load_fiche_titre($langs->trans("DeliveryOrderNumberingModules"));
+print load_fiche_titre($langs->trans("DeliveryOrderNumberingModules"),'','');
 
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre">';
@@ -340,7 +340,7 @@ print '</table>';
  *  Documents Models for delivery
  */
 print '<br>';
-print load_fiche_titre($langs->trans("DeliveryOrderModel"));
+print load_fiche_titre($langs->trans("DeliveryOrderModel"),'','');
 
 // Defini tableau def de modele
 $type="delivery";
@@ -487,7 +487,7 @@ print '</table>';
  *  Autres Options
  */
 print "<br>";
-print load_fiche_titre($langs->trans("OtherOptions"));
+print load_fiche_titre($langs->trans("OtherOptions"),'','');
 
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre">';
diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php
index b9242bd0c4eec5b6d351548b9255cc0431d52cbc..41362fd5664ad1144c8e4c393f70d3706b5c169c 100644
--- a/htdocs/admin/propal.php
+++ b/htdocs/admin/propal.php
@@ -270,7 +270,7 @@ dol_fiche_head($head, 'general', $langs->trans("Proposals"), 0, 'propal');
 /*
  *  Module numerotation
  */
-print load_fiche_titre($langs->trans("ProposalsNumberingModules"));
+print load_fiche_titre($langs->trans("ProposalsNumberingModules"),'','');
 
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre">';
@@ -374,7 +374,7 @@ print "</table><br>\n";
  * Document templates generators
  */
 
-print load_fiche_titre($langs->trans("ProposalsPDFModules"));
+print load_fiche_titre($langs->trans("ProposalsPDFModules"),'','');
 
 // Load array def with activated templates
 $def = array();
@@ -536,7 +536,7 @@ print '<br>';
  * Other options
  *
  */
-print load_fiche_titre($langs->trans("OtherOptions"));
+print load_fiche_titre($langs->trans("OtherOptions"),'','');
 
 $var=true;
 print "<table class=\"noborder\" width=\"100%\">";
@@ -643,7 +643,7 @@ print '</table>';
  *  Directory
  */
 print '<br>';
-print load_fiche_titre($langs->trans("PathToDocuments"));
+print load_fiche_titre($langs->trans("PathToDocuments"),'','');
 
 print "<table class=\"noborder\" width=\"100%\">\n";
 print "<tr class=\"liste_titre\">\n";
@@ -658,7 +658,7 @@ print "</table>\n<br>";
  * Notifications
  */
 
-print load_fiche_titre($langs->trans("Notifications"));
+print load_fiche_titre($langs->trans("Notifications"),'','');
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre">';
 print '<td>'.$langs->trans("Parameter").'</td>';
diff --git a/htdocs/admin/salaries.php b/htdocs/admin/salaries.php
index bb37e73fc88d6eae20eeffc95df39d6320808174..53deb9610ca2b8a01155ea0b2de0ca7c74582bf4 100644
--- a/htdocs/admin/salaries.php
+++ b/htdocs/admin/salaries.php
@@ -83,6 +83,8 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
 print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
 print '<input type="hidden" name="action" value="update">';
 
+dol_fiche_head();
+
 /*
  *  Params
  */
@@ -109,10 +111,13 @@ foreach ($list as $key)
 
 print '</tr>';
 
-print '</form>';
 print "</table>\n";
 
-print '<br /><div style="text-align:center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
+print '</form>';
+
+dol_fiche_end();
+
+print '<div style="text-align:center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
 
 llxFooter();
-$db->close();
\ No newline at end of file
+$db->close();
diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php
index 694247e7b81ef6cf5d663b3a09e924e3bcb8d4c0..7e075f25c8f92ff0dc87223cf1f11f3a35ae4f31 100644
--- a/htdocs/admin/supplier_invoice.php
+++ b/htdocs/admin/supplier_invoice.php
@@ -205,7 +205,7 @@ dol_fiche_head($head, 'invoice', $langs->trans("Suppliers"), 0, 'company');
 
 // Supplier invoice numbering module
 
-print load_fiche_titre($langs->trans("SuppliersInvoiceNumberingModel"));
+print load_fiche_titre($langs->trans("SuppliersInvoiceNumberingModel"),'','');
 
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre">';
@@ -311,7 +311,7 @@ print '</table><br>';
  * Modeles documents for supplier invoices
  */
 
-print load_fiche_titre($langs->trans("BillsPDFModules"));
+print load_fiche_titre($langs->trans("BillsPDFModules"),'','');
 
 // Defini tableau def de modele
 $def = array();
@@ -453,7 +453,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
 print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
 print '<input type="hidden" name="action" value="set_SUPPLIER_INVOICE_FREE_TEXT">';
 
-print load_fiche_titre($langs->trans("OtherOptions"));
+print load_fiche_titre($langs->trans("OtherOptions"),'','');
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre">';
 print '<td>'.$langs->trans("Parameter").'</td>';
@@ -487,7 +487,7 @@ print '</form>';
  * Notifications
  */
 
-print load_fiche_titre($langs->trans("Notifications"));
+print load_fiche_titre($langs->trans("Notifications"),'','');
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre">';
 print '<td>'.$langs->trans("Parameter").'</td>';
diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php
index 861e94c881bdf0fbfece8a5de2e4515f69997381..69d518d9a619555b3dc12d15b2f148567ec24a05 100644
--- a/htdocs/admin/supplier_order.php
+++ b/htdocs/admin/supplier_order.php
@@ -221,7 +221,7 @@ dol_fiche_head($head, 'order', $langs->trans("Suppliers"), 0, 'company');
 
 // Supplier order numbering module
 
-print load_fiche_titre($langs->trans("OrdersNumberingModules"));
+print load_fiche_titre($langs->trans("OrdersNumberingModules"),'','');
 
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre">';
@@ -325,7 +325,7 @@ print '</table><br>';
  *  Documents models for supplier orders
  */
 
-print load_fiche_titre($langs->trans("OrdersModelModule"));
+print load_fiche_titre($langs->trans("OrdersModelModule"),'','');
 
 // Defini tableau def de modele
 $def = array();
@@ -464,7 +464,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
 print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
 print '<input type="hidden" name="action" value="set_SUPPLIER_ORDER_OTHER">';
 
-print load_fiche_titre($langs->trans("OtherOptions"));
+print load_fiche_titre($langs->trans("OtherOptions"),'','');
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre">';
 print '<td>'.$langs->trans("Parameter").'</td>';
@@ -512,7 +512,7 @@ print '</form>';
  * Notifications
  */
 
-print load_fiche_titre($langs->trans("Notifications"));
+print load_fiche_titre($langs->trans("Notifications"),'','');
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre">';
 print '<td>'.$langs->trans("Parameter").'</td>';
diff --git a/htdocs/comm/prospect/list.php b/htdocs/comm/prospect/list.php
index 2282b39420e21664b17a7db66a6d99f7b5f2e8c5..8ec43d955a462f9a1eb732069cc7ce3b1d44f81a 100644
--- a/htdocs/comm/prospect/list.php
+++ b/htdocs/comm/prospect/list.php
@@ -159,7 +159,8 @@ $sts = array(-1,0,1,2,3);
 
 
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
-$hookmanager->initHooks(array('prospectlist'));
+$contextpage='prospectlist';
+$hookmanager->initHooks(array($contextpage));
 $extrafields = new ExtraFields($db);
 
 // fetch optionals attributes and labels
@@ -167,7 +168,7 @@ $extralabels = $extrafields->fetch_name_optionals_label('thirdparty');
 $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
 
 // Do we click on purge search criteria ?
-if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
+if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
 {
     $socname="";
 	$stcomm="";
@@ -271,7 +272,7 @@ if ($socname)
 	$sortfield = "s.nom";
 	$sortorder = "ASC";
 }
-// Extra fields
+// Add where from extra fields
 foreach ($search_array_options as $key => $val)
 {
     $crit=$val;
@@ -339,15 +340,14 @@ if ($resql)
  	if ($search_status != '') $param.='&search_status='.$search_status;
  	if ($search_country != '') $param.='&amp;search_country='.$search_country;
  	if ($search_type_thirdparty != '') $param.='&amp;search_type_thirdparty='.$search_type_thirdparty;
-    foreach ($search_array_options as $key => $val)
+    // Add $param from extra fields
+ 	foreach ($search_array_options as $key => $val)
     {
         $crit=$val;
         $tmpkey=preg_replace('/search_options_/','',$key);
         $param.='&search_options_'.$tmpkey.'='.urlencode($val);
     } 	
- 	// $param and $urladd should have the same value
- 	$urladd = $param;
-
+ 	
 	print_barre_liste($langs->trans("ListOfProspects"), $page, $_SERVER["PHP_SELF"], $param, $sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_companies.png');
 
 
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index b7ea040fc17159e7f71a2811b23342bb3f3e9b3b..a0a0e6497554e131950e3e1c91324eaef9ef4afd 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -4671,12 +4671,12 @@ class Form
      *	Show a multiselect form from an array.
      *
      *	@param	string	$htmlname		Name of select
-     *	@param	array	$array			Array with array of fields we could show
+     *	@param	array	$array			Array with array of fields we could show. This array may be modified according to setup of user.
      *  @param  string  $varpage        Id of context for page. Can be set with $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
      *	@return	string					HTML multiselect string
      *  @see selectarray
      */
-    static function multiSelectArrayWithCheckbox($htmlname, $array, $varpage)
+    static function multiSelectArrayWithCheckbox($htmlname, &$array, $varpage)
     {
         global $user;
         
@@ -4699,7 +4699,11 @@ class Form
         
         foreach($array as $key => $val)
         {
-           if (isset($val['cond']) && ! $val['cond']) continue; 
+           if (isset($val['enabled']) && ! $val['enabled']) 
+           {
+               unset($array[$key]);     // We don't want this field
+               continue; 
+           }
            if ($val['label']) 
 	       {
 	           $lis.='<li><input type="checkbox" value="'.$key.'"'.(empty($val['checked'])?'':' checked="checked"').'/>'.dol_escape_htmltag($val['label']).'</li>';
diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php
index d65f85bd59d3cb4b80904ec27aa8b368b0d58bf0..e8c63f2b96ca9fbf8de8271ce2fd5fced7048f4e 100644
--- a/htdocs/core/lib/files.lib.php
+++ b/htdocs/core/lib/files.lib.php
@@ -921,7 +921,7 @@ function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists)
  *
  * @param	string  $srcfile            Source file (can't be a directory. use native php @rename() to move a directory)
  * @param   string	$destfile           Destination file (can't be a directory. use native php @rename() to move a directory)
- * @param   integer	$newmask            Mask for new file (0 by default means $conf->global->MAIN_UMASK)
+ * @param   integer	$newmask            Mask in octal string for new file (0 by default means $conf->global->MAIN_UMASK)
  * @param   int		$overwriteifexists  Overwrite file if exists (1 by default)
  * @return  boolean 		            True if OK, false if KO
  */
@@ -954,7 +954,7 @@ function dol_move($srcfile, $destfile, $newmask=0, $overwriteifexists=1)
         // Currently method is restricted to files (dol_delete_files previously used is for files, and mask usage if for files too)
         // to allow mask usage for dir, we shoul introduce a new param "isdir" to 1 to complete newmask like this
         // if ($isdir) $newmaskdec |= octdec('0111');  // Set x bit required for directories
-        @chmod($newpathofdestfile, $newmaskdesc);
+        @chmod($newpathofdestfile, $newmaskdec);
     }
 
     return $result;
diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php
index 23e122b89f690bd374c3ede7eef78e4acc634a4d..243438b0aa6598880cef67ca31743650bb6cbbbe 100644
--- a/htdocs/core/lib/usergroups.lib.php
+++ b/htdocs/core/lib/usergroups.lib.php
@@ -486,7 +486,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
 	   	{
 	   		print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default"));
 	   	}
-    	print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
+    	print ' &nbsp; ('.$langs->trans("Default").': <strong>e6e6e6</strong>, '.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
 	    print '</td>';
 
 	    print '</tr>';
diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql
index 02f716633f5eccdb5fd719815c689a445dc86859..5442c1c1862d22b853411e7d9977302788d2da8f 100755
--- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql
+++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql
@@ -57,3 +57,7 @@ ALTER TABLE llx_paiement ADD COLUMN ref varchar(30) NOT NULL AFTER rowid;
 ALTER TABLE llx_socpeople ADD COLUMN photo varchar(255) AFTER skype;
 
 ALTER TABLE llx_user_param MODIFY COLUMN value text NOT NULL;
+
+ALTER TABLE llx_expedition ADD COLUMN import_key varchar(14);
+ALTER TABLE llx_expedition ADD COLUMN extraparams varchar(255);
+
diff --git a/htdocs/install/mysql/tables/llx_expedition.sql b/htdocs/install/mysql/tables/llx_expedition.sql
index d142a5cc628cf966b48a90c720d30d12e3f74b70..8421bb1649cf04357ea9358f35f3952d8358a82e 100644
--- a/htdocs/install/mysql/tables/llx_expedition.sql
+++ b/htdocs/install/mysql/tables/llx_expedition.sql
@@ -52,6 +52,8 @@ create table llx_expedition
   note_public           text,
   model_pdf             varchar(255),
   fk_incoterms          integer,						-- for incoterms
-  location_incoterms    varchar(255)					-- for incoterms
+  location_incoterms    varchar(255),					-- for incoterms
   
+  import_key			varchar(14),
+  extraparams			varchar(255)							-- for other parameters with json format
 )ENGINE=innodb;
diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang
index ce3f8edc0d8e6dbbad3f8f9b7515c02e471183ac..2761ba85c4546811dea4aa5b1fb0e6bc4ae9b1a0 100644
--- a/htdocs/langs/en_US/main.lang
+++ b/htdocs/langs/en_US/main.lang
@@ -229,6 +229,7 @@ DateAndHour=Date and hour
 DateStart=Date start
 DateEnd=Date end
 DateCreation=Creation date
+DateCreationShort=Creat. date
 DateModification=Modification date
 DateModificationShort=Modif. date
 DateLastModification=Last modification date
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 41bc2520d8f978244dda1cd0a797b781f6c1c89a..d499652a0437e10a6dcbc73567d97baa40fe21ea 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -821,7 +821,7 @@ class Product extends CommonObject
 	function delete($id=0)
 	{
 		// Deprecation warning
-		if (0 == $id) {
+		if ($id > 0) {
 			dol_syslog(__METHOD__ . " with parameter is deprecated", LOG_WARNING);
 		}
 
diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php
index 10f5ab290450cd4a0ad6e06f97e78762f1596eff..0318caa665b8189a1be47b3a361033be00efc8b8 100644
--- a/htdocs/societe/admin/societe.php
+++ b/htdocs/societe/admin/societe.php
@@ -299,7 +299,7 @@ $dirsociete=array_merge(array('/core/modules/societe/'),$conf->modules_parts['so
 
 // Module to manage customer/supplier code
 
-print load_fiche_titre($langs->trans("CompanyCodeChecker"));
+print load_fiche_titre($langs->trans("CompanyCodeChecker"),'','');
 
 print '<table class="noborder" width="100%">'."\n";
 print '<tr class="liste_titre">'."\n";
@@ -381,7 +381,7 @@ print "<br>";
 
 // Select accountancy code numbering module
 
-print load_fiche_titre($langs->trans("AccountCodeManager"));
+print load_fiche_titre($langs->trans("AccountCodeManager"),'','');
 
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre">';
@@ -452,7 +452,7 @@ print "</table>\n";
  *  Document templates generators
  */
 print '<br>';
-print load_fiche_titre($langs->trans("ModelModules"));
+print load_fiche_titre($langs->trans("ModelModules"),'','');
 
 // Load array def with activated templates
 $def = array();
@@ -598,7 +598,7 @@ print '</table>';
 print '<br>';
 
 //IDProf
-print load_fiche_titre($langs->trans("CompanyIdProfChecker"));
+print load_fiche_titre($langs->trans("CompanyIdProfChecker"),'','');
 
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre">';
@@ -691,7 +691,7 @@ while ($i < $nbofloop)
 print "</table><br>\n";
 
 
-print load_fiche_titre($langs->trans("Other"));
+print load_fiche_titre($langs->trans("Other"),'','');
 
 // Autres options
 $form=new Form($db);
@@ -804,6 +804,7 @@ print '</form>';
 
 dol_fiche_end();
 
-$db->close();
 
 llxFooter();
+
+$db->close();
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index 8170c9219279cb43717f036fc1d67e9f99956a3a..a0989f3b8c336e06b7a84b41ea262500adcf5510 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -677,8 +677,8 @@ class Societe extends CommonObject
         $this->localtax1_value=trim($this->localtax1_value);
         $this->localtax2_value=trim($this->localtax2_value);
 
-        $this->capital=price2num(trim($this->capital),'MT');
-        if (empty($this->capital) || ! is_numeric($this->capital)) $this->capital = 0;
+        if ($this->capital != '') $this->capital=price2num(trim($this->capital));
+        if (! is_numeric($this->capital)) $this->capital = '';     // '' = undef
 
         $this->effectif_id=trim($this->effectif_id);
         $this->forme_juridique_code=trim($this->forme_juridique_code);
@@ -806,7 +806,7 @@ class Societe extends CommonObject
             }
             else $sql .=",localtax2_value =0.000";
 
-            $sql .= ",capital = ".$this->capital;
+            $sql .= ",capital = ".($this->capital == '' ? "null" : $this->capital);
 
             $sql .= ",prefix_comm = ".(! empty($this->prefix_comm)?"'".$this->db->escape($this->prefix_comm)."'":"null");
 
diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php
index 097bbcc28abf3c1271346ed5ef621ac74559cd33..95b9747ca0b7b45ce58cd6e12d59bf559a3a70e1 100644
--- a/htdocs/societe/list.php
+++ b/htdocs/societe/list.php
@@ -46,6 +46,7 @@ $search_nom_only=trim(GETPOST("search_nom_only"));
 $search_all=trim(GETPOST("search_all"));
 $sbarcode=trim(GETPOST("sbarcode"));
 $search_town=trim(GETPOST("search_town"));
+$search_zip=trim(GETPOST("search_zip"));
 $socname=trim(GETPOST("socname"));
 $search_idprof1=trim(GETPOST('search_idprof1'));
 $search_idprof2=trim(GETPOST('search_idprof2'));
@@ -79,6 +80,10 @@ $contextpage='thirdpartylist';
 $hookmanager->initHooks(array($contextpage));
 $extrafields = new ExtraFields($db);
 
+// fetch optionals attributes and labels
+$extralabels = $extrafields->fetch_name_optionals_label('thirdparty');
+$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
+
 
 /*
  * Actions
@@ -179,6 +184,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
 	$search_nom="";
 	$sbarcode="";
 	$search_town="";
+	$search_zip="";
 	$search_idprof1='';
 	$search_idprof2='';
 	$search_idprof3='';
@@ -187,6 +193,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
 	$search_country='';
 	$search_type_thirdparty='';
 	$search_status='';
+	$search_array_options=array();
 }
 
 if ($search_status=='') $search_status=1; // always display active thirdparty first
@@ -211,7 +218,7 @@ if ($socname)
  */
 $title=$langs->trans("ListOfThirdParties");
 
-$sql = "SELECT s.rowid, s.nom as name, s.barcode, s.town, s.datec, s.code_client, s.code_fournisseur, ";
+$sql = "SELECT s.rowid, s.nom as name, s.barcode, s.town, s.zip, s.datec, s.code_client, s.code_fournisseur, ";
 $sql.= " st.libelle as stcomm, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,";
 $sql.= " s.siren as idprof1, s.siret as idprof2, ape as idprof3, idprof4 as idprof4,";
 $sql.= " s.fk_pays, s.tms as date_update, s.datec as date_creation,";
@@ -220,13 +227,14 @@ $sql.= " typent.code as typent_code";
 if ($search_sale) $sql .= ", sc.fk_soc, sc.fk_user";
 // We'll need these fields in order to filter by categ
 if ($search_categ) $sql .= ", cs.fk_categorie, cs.fk_soc";
-// Add fields for extrafields
+// Add fields from extrafields
 foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
 // Add fields from hooks
 $parameters=array();
 $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters);    // Note that $action and $object may have been modified by hook
 $sql.=$hookmanager->resPrint;
 $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
+if (is_array($extrafields->attribute_list) && count($extrafields->attribute_list)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_extrafields as ef on (s.rowid = ef.fk_object)";
 $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays) ";
 $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent) ";
 $sql.= " ,".MAIN_DB_PREFIX."c_stcomm as st";
@@ -241,18 +249,19 @@ if ($socid)           $sql.= " AND s.rowid = ".$socid;
 if ($search_sale)     $sql.= " AND s.rowid = sc.fk_soc";        // Join for the needed table to filter by sale
 if ($search_categ)    $sql.= " AND s.rowid = cs.fk_soc";   // Join for the needed table to filter by categ
 if (! $user->rights->fournisseur->lire) $sql.=" AND (s.fournisseur <> 1 OR s.client <> 0)";    // client=0, fournisseur=0 must be visible
-if ($search_sale)     $sql .= " AND sc.fk_user = ".$db->escape($search_sale);
-if ($search_categ)    $sql .= " AND cs.fk_categorie = ".$db->escape($search_categ);
+if ($search_sale)     $sql.= " AND sc.fk_user = ".$db->escape($search_sale);
+if ($search_categ)    $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ);
 if ($search_nom_only) $sql.= natural_search("s.nom",$search_nom_only);
 if ($search_all)      $sql.= natural_search(array("s.nom", "s.name_alias", "s.code_client", "s.code_fournisseur", "s.email", "s.url","s.siren","s.siret","s.ape","s.idprof4","s.idprof5","s.idprof6"), $search_all);
 if ($search_nom)      $sql.= natural_search(array("s.nom", "s.name_alias", "s.code_client", "s.code_fournisseur", "s.email", "s.url","s.siren","s.siret","s.ape","s.idprof4","s.idprof5","s.idprof6"), $search_nom);
-if ($search_town)     $sql .= " AND s.town LIKE '%".$db->escape($search_town)."%'";
-if ($search_idprof1)  $sql .= " AND s.siren LIKE '%".$db->escape($search_idprof1)."%'";
-if ($search_idprof2)  $sql .= " AND s.siret LIKE '%".$db->escape($search_idprof2)."%'";
-if ($search_idprof3)  $sql .= " AND s.ape LIKE '%".$db->escape($search_idprof3)."%'";
-if ($search_idprof4)  $sql .= " AND s.idprof4 LIKE '%".$db->escape($search_idprof4)."%'";
-if ($search_idprof5)  $sql .= " AND s.idprof5 LIKE '%".$db->escape($search_idprof5)."%'";
-if ($search_idprof6)  $sql .= " AND s.idprof6 LIKE '%".$db->escape($search_idprof6)."%'";
+if ($search_town)     $sql.= natural_search("s.town",$search_town);
+if ($search_zip)      $sql.= natural_search("s.zip",$search_zip);
+if ($search_idprof1)  $sql.= natural_search("s.siren",$search_idprof1);
+if ($search_idprof2)  $sql.= natural_search("s.siret",$search_idprof2);
+if ($search_idprof3)  $sql.= natural_search("s.ape",$search_idprof3);
+if ($search_idprof4)  $sql.= natural_search("s.idprof4",$search_idprof4);
+if ($search_idprof5)  $sql.= natural_search("s.idprof5",$search_idprof5);
+if ($search_idprof6)  $sql.= natural_search("s.idprof6",$search_idprof6);
 // Filter on type of thirdparty
 if ($search_type > 0 && in_array($search_type,array('1,3','2,3'))) $sql .= " AND s.client IN (".$db->escape($search_type).")";
 if ($search_type > 0 && in_array($search_type,array('4')))         $sql .= " AND s.fournisseur = 1";
@@ -261,6 +270,19 @@ if ($search_status!='') $sql .= " AND s.status = ".$db->escape($search_status);
 if (!empty($conf->barcode->enabled) && $sbarcode) $sql.= " AND s.barcode LIKE '%".$db->escape($sbarcode)."%'";
 if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
 if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
+// Add where from extra fields
+foreach ($search_array_options as $key => $val)
+{
+    $crit=$val;
+    $tmpkey=preg_replace('/search_options_/','',$key);
+    $typ=$extrafields->attribute_type[$tmpkey];
+    $mode=0;
+    if (in_array($typ, array('int'))) $mode=1;    // Search on a numeric
+    if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit))) 
+    {
+        $sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
+    }
+}
 // Add where from hooks
 $parameters=array();
 $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters);    // Note that $action and $object may have been modified by hook
@@ -286,6 +308,7 @@ if ($resql)
 	$param = "&amp;socname=".urlencode($socname);
 	$param.= "&amp;search_nom=".urlencode($search_nom);
 	$param.= "&amp;search_town=".urlencode($search_town);
+	$param.= "&amp;search_zip=".urlencode($search_zip);
 	$param.= ($sbarcode?"&amp;sbarcode=".urlencode($sbarcode):"");
 	$param.= '&amp;search_idprof1='.urlencode($search_idprof1);
 	$param.= '&amp;search_idprof2='.urlencode($search_idprof2);
@@ -295,8 +318,15 @@ if ($resql)
 	if ($search_type_thirdparty != '') $param.='&amp;search_type_thirdparty='.urlencode($search_type_thirdparty);
 	if ($optioncss != '') $param.='&amp;optioncss='.urlencode($optioncss);
     if ($search_status != '') $params.='&amp;search_status='.urlencode($search_status);
-	
-	print_barre_liste($title, $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_companies');
+    // Add $param from extra fields
+    foreach ($search_array_options as $key => $val)
+    {
+        $crit=$val;
+        $tmpkey=preg_replace('/search_options_/','',$key);
+        $param.='&search_options_'.$tmpkey.'='.urlencode($val);
+    } 	
+    
+	print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies');
 
     // Show delete result message
     if (GETPOST('delsoc'))
@@ -321,6 +351,8 @@ if ($resql)
     if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
 	print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
 	print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
+	print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
+	print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
 	
     // Filter on categories
     /* Not possible in this page because list is for ALL third parties type
@@ -354,8 +386,9 @@ if ($resql)
 	// Define list of fields to show into list
     $arrayfields=array(
         's.nom'=>array('label'=>$langs->trans("Company"), 'checked'=>1),
-        's.barcode'=>array('label'=>$langs->trans("BarCode"), 'checked'=>1, 'cond'=>(! empty($conf->barcode->enabled))),
+        's.barcode'=>array('label'=>$langs->trans("BarCode"), 'checked'=>1, 'enabled'=>(! empty($conf->barcode->enabled))),
         's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1),
+        's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1),
         'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>1),
         'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>1),
         's.siren'=>array('label'=>$langs->trans("ProfId1Short"), 'checked'=>1),
@@ -363,81 +396,120 @@ if ($resql)
         's.ape'=>array('label'=>$langs->trans("ProfId3Short"), 'checked'=>1),
         's.idprof4'=>array('label'=>$langs->trans("ProfId4Short"), 'checked'=>1),
         's.status'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>200),
-        's.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
         's.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
+        's.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
     );
-    if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
-    {
-        $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
-        $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage);
-    }
-    
+    $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
+    $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage);
 	print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
 
 	print '<tr class="liste_titre">';
-	print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);
-    if (! empty($conf->barcode->enabled)) print_liste_field_titre($langs->trans("BarCode"), $_SERVER["PHP_SELF"], "s.barcode",$param,'','',$sortfield,$sortorder);
-	print_liste_field_titre($langs->trans("Town"),$_SERVER["PHP_SELF"],"s.town","",$param,'',$sortfield,$sortorder);
-	print_liste_field_titre($langs->trans("Country"),$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
-	print_liste_field_titre($langs->trans("ThirdPartyType"),$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder);
-	print_liste_field_titre($form->textwithpicto($langs->trans("ProfId1Short"),$textprofid[1],1,0),$_SERVER["PHP_SELF"],"s.siren","",$param,'class="nowrap"',$sortfield,$sortorder);
-	print_liste_field_titre($form->textwithpicto($langs->trans("ProfId2Short"),$textprofid[2],1,0),$_SERVER["PHP_SELF"],"s.siret","",$param,'class="nowrap"',$sortfield,$sortorder);
-	print_liste_field_titre($form->textwithpicto($langs->trans("ProfId3Short"),$textprofid[3],1,0),$_SERVER["PHP_SELF"],"s.ape","",$param,'class="nowrap"',$sortfield,$sortorder);
-	print_liste_field_titre($form->textwithpicto($langs->trans("ProfId4Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof4","",$param,'class="nowrap"',$sortfield,$sortorder);
-	print_liste_field_titre('');
-    $parameters=array();
+	if (! empty($arrayfields['s.nom']['checked']))            print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);
+    if (! empty($arrayfields['s.barcode']['checked']))        print_liste_field_titre($langs->trans("BarCode"), $_SERVER["PHP_SELF"], "s.barcode",$param,'','',$sortfield,$sortorder);
+	if (! empty($arrayfields['s.town']['checked']))           print_liste_field_titre($langs->trans("Town"),$_SERVER["PHP_SELF"],"s.town","",$param,'',$sortfield,$sortorder);
+	if (! empty($arrayfields['s.zip']['checked']))            print_liste_field_titre($langs->trans("Zip"),$_SERVER["PHP_SELF"],"s.zip","",$param,'',$sortfield,$sortorder);
+	if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($langs->trans("Country"),$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
+	if (! empty($arrayfields['typent.code']['checked']))      print_liste_field_titre($langs->trans("ThirdPartyType"),$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder);
+	if (! empty($arrayfields['s.siren']['checked']))          print_liste_field_titre($form->textwithpicto($langs->trans("ProfId1Short"),$textprofid[1],1,0),$_SERVER["PHP_SELF"],"s.siren","",$param,'class="nowrap"',$sortfield,$sortorder);
+	if (! empty($arrayfields['s.siret']['checked']))          print_liste_field_titre($form->textwithpicto($langs->trans("ProfId2Short"),$textprofid[2],1,0),$_SERVER["PHP_SELF"],"s.siret","",$param,'class="nowrap"',$sortfield,$sortorder);
+	if (! empty($arrayfields['s.ape']['checked']))            print_liste_field_titre($form->textwithpicto($langs->trans("ProfId3Short"),$textprofid[3],1,0),$_SERVER["PHP_SELF"],"s.ape","",$param,'class="nowrap"',$sortfield,$sortorder);
+	if (! empty($arrayfields['s.idprof4']['checked']))        print_liste_field_titre($form->textwithpicto($langs->trans("ProfId4Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof4","",$param,'class="nowrap"',$sortfield,$sortorder);
+	print_liste_field_titre('');   // type of customer
+    // Extra fields
+	if (is_array($extrafields->attribute_list) && count($extrafields->attribute_list))
+	{
+	   foreach($extrafields->attribute_list as $key => $val) 
+	   {
+	       if ($val)
+	       {
+	           if (! empty($arrayfields["ef.".$key]['checked'])) print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,"",$sortfield,$sortorder);
+	       }
+	   }
+	}
+	// Hook fields
+	$parameters=array('arrayfields'=>$arrayfields);
     $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters);    // Note that $action and $object may have been modified by hook
     print $hookmanager->resPrint;
-	print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="right"',$sortfield,$sortorder);
+	if (! empty($arrayfields['s.status']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="right"',$sortfield,$sortorder);
+	if (! empty($arrayfields['s.datec']['checked']))  print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"s.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
+	if (! empty($arrayfields['s.tms']['checked']))    print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"s.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
 	print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
 	print "</tr>\n";
 
 	// Fields title search
 	print '<tr class="liste_titre">';
-	print '<td class="liste_titre">';
-	print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
-	print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
-	if (! empty($search_nom_only) && empty($search_nom)) $search_nom=$search_nom_only;
-	
-	print '<input class="flat" type="text" name="search_nom" size="8" value="'.dol_escape_htmltag($search_nom).'">';
-	print '</td>';
+    if (! empty($arrayfields['s.nom']['checked']))
+    {
+    	print '<td class="liste_titre">';
+    	if (! empty($search_nom_only) && empty($search_nom)) $search_nom=$search_nom_only;
+    	print '<input class="flat" type="text" name="search_nom" size="8" value="'.dol_escape_htmltag($search_nom).'">';
+    	print '</td>';
+    }
 	// Barcode
-	if (! empty($conf->barcode->enabled))
-	{
+    if (! empty($arrayfields['s.barcode']['checked']))
+    {
 		print '<td class="liste_titre">';
 		print '<input class="flat" type="text" name="sbarcode" size="6" value="'.dol_escape_htmltag($sbarcode).'">';
 		print '</td>';
     }
 	// Town
-	print '<td class="liste_titre">';
-	print '<input class="flat" size="8" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).'">';
-	print '</td>';
-	//Country
-	print '<td class="liste_titre" align="center">';
-	print $form->select_country($search_country,'search_country','',0,'maxwidth100');
-	print '</td>';
-	//Company type
-	print '<td class="liste_titre" align="center">';
-	print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT));
-	print '</td>';
-	// IdProf1
-	print '<td class="liste_titre">';
-	print '<input class="flat" size="4" type="text" name="search_idprof1" value="'.dol_escape_htmltag($search_idprof1).'">';
-	print '</td>';
-	// IdProf2
-	print '<td class="liste_titre">';
-	print '<input class="flat" size="4" type="text" name="search_idprof2" value="'.dol_escape_htmltag($search_idprof2).'">';
-	print '</td>';
-	// IdProf3
-	print '<td class="liste_titre">';
-	print '<input class="flat" size="4" type="text" name="search_idprof3" value="'.dol_escape_htmltag($search_idprof3).'">';
-	print '</td>';
-	// IdProf4
-	print '<td class="liste_titre">';
-	print '<input class="flat" size="4" type="text" name="search_idprof4" value="'.dol_escape_htmltag($search_idprof4).'">';
-	print '</td>';
+    if (! empty($arrayfields['s.town']['checked']))
+    {
+        print '<td class="liste_titre">';
+    	print '<input class="flat" size="8" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).'">';
+    	print '</td>';
+    }
+	// Zip
+    if (! empty($arrayfields['s.zip']['checked']))
+    {
+        print '<td class="liste_titre">';
+    	print '<input class="flat" size="8" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).'">';
+    	print '</td>';
+    }
+    // Country
+    if (! empty($arrayfields['country.code_iso']['checked']))
+    {
+        print '<td class="liste_titre" align="center">';
+    	print $form->select_country($search_country,'search_country','',0,'maxwidth100');
+    	print '</td>';
+    }
+	// Company type
+    if (! empty($arrayfields['typent.code']['checked']))
+    {
+        print '<td class="liste_titre" align="center">';
+    	print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT));
+    	print '</td>';
+    }
+	if (! empty($arrayfields['s.siren']['checked']))
+	{
+	    // IdProf1
+    	print '<td class="liste_titre">';
+    	print '<input class="flat" size="4" type="text" name="search_idprof1" value="'.dol_escape_htmltag($search_idprof1).'">';
+    	print '</td>';
+	}
+    if (! empty($arrayfields['s.siret']['checked']))
+    {
+        // IdProf2
+    	print '<td class="liste_titre">';
+    	print '<input class="flat" size="4" type="text" name="search_idprof2" value="'.dol_escape_htmltag($search_idprof2).'">';
+    	print '</td>';
+    }
+    if (! empty($arrayfields['s.ape']['checked']))
+    {
+        // IdProf3
+    	print '<td class="liste_titre">';
+    	print '<input class="flat" size="4" type="text" name="search_idprof3" value="'.dol_escape_htmltag($search_idprof3).'">';
+    	print '</td>';
+    }
+    if (! empty($arrayfields['s.idprof4']['checked']))
+    {
+        // IdProf4
+    	print '<td class="liste_titre">';
+    	print '<input class="flat" size="4" type="text" name="search_idprof4" value="'.dol_escape_htmltag($search_idprof4).'">';
+    	print '</td>';
+    }
 	// Type (customer/prospect/supplier)
-	print '<td class="liste_titre" align="middle">';
+    print '<td class="liste_titre" align="middle">';
 	print '<select class="flat" name="search_type">';
 	print '<option value="-1"'.($search_type==''?' selected':'').'>&nbsp;</option>';
 	if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print '<option value="1,3"'.($search_type=='1,3'?' selected':'').'>'.$langs->trans('Customer').'</option>';
@@ -446,16 +518,30 @@ if ($resql)
 	print '<option value="4"'.($search_type=='4'?' selected':'').'>'.$langs->trans('Supplier').'</option>';
 	print '<option value="0"'.($search_type=='0'?' selected':'').'>'.$langs->trans('Others').'</option>';
 	print '</select></td>';
-
-	$parameters=array();
+    // Fields from hook
+	$parameters=array('arrayfields'=>$arrayfields);
     $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters);    // Note that $action and $object may have been modified by hook
     print $hookmanager->resPrint;
-
-    // Status
-    print '<td class="liste_titre" align="right">';
-    print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
-    print '</td>';
-
+    if (! empty($arrayfields['s.status']['checked']))
+    {
+        // Status
+        print '<td class="liste_titre" align="right">';
+        print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
+        print '</td>';
+    }
+    if (! empty($arrayfields['s.datec']['checked']))
+    {
+        // Date creation
+        print '<td class="liste_titre">';
+        print '</td>';
+    }
+    if (! empty($arrayfields['s.tms']['checked']))
+    {
+        // Date modification
+        print '<td class="liste_titre">';
+        print '</td>';
+    }
+    // Action column
 	print '<td class="liste_titre" align="right">';
 	print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
 	print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
@@ -470,38 +556,68 @@ if ($resql)
 		$obj = $db->fetch_object($resql);
 		$var=!$var;
 		print "<tr ".$bc[$var].">";
-		print "<td>";
-		$companystatic->id=$obj->rowid;
-		$companystatic->name=$obj->name;
-		$companystatic->canvas=$obj->canvas;
-        $companystatic->client=$obj->client;
-        $companystatic->status=$obj->status;
-        $companystatic->fournisseur=$obj->fournisseur;
-        $companystatic->code_client=$obj->code_client;
-        $companystatic->code_fournisseur=$obj->code_fournisseur;
-		print $companystatic->getNomUrl(1,'',100);
-		print "</td>\n";
+		if (! empty($arrayfields['s.nom']['checked']))
+		{
+    		print "<td>";
+    		$companystatic->id=$obj->rowid;
+    		$companystatic->name=$obj->name;
+    		$companystatic->canvas=$obj->canvas;
+            $companystatic->client=$obj->client;
+            $companystatic->status=$obj->status;
+            $companystatic->fournisseur=$obj->fournisseur;
+            $companystatic->code_client=$obj->code_client;
+            $companystatic->code_fournisseur=$obj->code_fournisseur;
+    		print $companystatic->getNomUrl(1,'',100);
+    		print "</td>\n";
+		}
 		// Barcode
-		if (! empty($conf->barcode->enabled))
+        if (! empty($arrayfields['s.barcode']['checked']))
 		{
 			print '<td>'.$objp->barcode.'</td>';
 		}
-		print "<td>".$obj->town."</td>\n";
-		//Country
-		print '<td align="center">';
-		$tmparray=getCountry($obj->fk_pays,'all');
-		print $tmparray['label'];
-		print '</td>';
-		//Type ent
-		print '<td align="center">';
-		if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1);
-		print $typenArray[$obj->typent_code];
-		print '</td>';
-		print "<td>".$obj->idprof1."</td>\n";
-		print "<td>".$obj->idprof2."</td>\n";
-		print "<td>".$obj->idprof3."</td>\n";
-		print "<td>".$obj->idprof4."</td>\n";
-		print '<td align="center">';
+		// Town
+        if (! empty($arrayfields['s.town']['checked']))
+        {
+            print "<td>".$obj->town."</td>\n";
+        }
+        // Zip
+	    if (! empty($arrayfields['s.zip']['checked']))
+        {
+            print "<td>".$obj->zip."</td>\n";
+        }        
+		// Country
+        if (! empty($arrayfields['country.code_iso']['checked']))
+        {
+            print '<td align="center">';
+    		$tmparray=getCountry($obj->fk_pays,'all');
+    		print $tmparray['label'];
+    		print '</td>';
+        }
+		// Type ent
+        if (! empty($arrayfields['typent.code']['checked']))
+        {
+            print '<td align="center">';
+    		if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1);
+    		print $typenArray[$obj->typent_code];
+    		print '</td>';
+        }
+        if (! empty($arrayfields['s.siren']['checked']))
+        {
+            print "<td>".$obj->idprof1."</td>\n";
+        }
+        if (! empty($arrayfields['s.siret']['checked']))
+        {
+            print "<td>".$obj->idprof2."</td>\n";
+        }
+        if (! empty($arrayfields['s.ape']['checked']))
+        {
+            print "<td>".$obj->idprof3."</td>\n";
+        }
+        if (! empty($arrayfields['s.idprof4']['checked']))
+        {
+            print "<td>".$obj->idprof4."</td>\n";
+        }
+        print '<td align="center">';
 		$s='';
 		if (($obj->client==1 || $obj->client==3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))
 		{
@@ -522,14 +638,30 @@ if ($resql)
 		}
 		print $s;
 		print '</td>';
-
-		$parameters=array('obj' => $obj);
-        $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters);    // Note that $action and $object may have been modified by hook
+        // Fields from hook
+	    $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
+		$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters);    // Note that $action and $object may have been modified by hook
         print $hookmanager->resPrint;
-
         // Status
-        print '<td align="right">'.$companystatic->getLibStatut(5).'</td>';
-
+        if (! empty($arrayfields['s.status']['checked']))
+        {
+            print '<td align="right">'.$companystatic->getLibStatut(5).'</td>';
+        }
+	    if (! empty($arrayfields['s.datec']['checked']))
+        {
+            // Date creation
+            print '<td align="center">';
+            print dol_print_date($obj->date_creation, 'dayhour');
+            print '</td>';
+        }
+        if (! empty($arrayfields['s.tms']['checked']))
+        {
+            // Date modification
+            print '<td align="center">';
+            print dol_print_date($obj->date_update, 'dayhour');
+            print '</td>';
+        }
+        // Action column
         print '<td></td>';
 
 		print '</tr>'."\n";
@@ -538,7 +670,7 @@ if ($resql)
 
 	$db->free($resql);
 
-	$parameters=array('sql' => $sql);
+	$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
 	$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters);    // Note that $action and $object may have been modified by hook
 	print $hookmanager->resPrint;
 
diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php
index 6570a7379670f390d3cb1955086f6f94cfd03d00..24d8d146e964b4505b5b8778b277c6e7e6d6bb0c 100644
--- a/htdocs/societe/soc.php
+++ b/htdocs/societe/soc.php
@@ -781,7 +781,7 @@ else
         $object->fax				= GETPOST('fax', 'alpha');
         $object->email				= GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL);
         $object->url				= GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL);
-        $object->capital			= GETPOST('capital', 'int');
+        $object->capital			= GETPOST('capital', 'alpha');
         $object->barcode			= GETPOST('barcode', 'alpha');
         $object->idprof1			= GETPOST('idprof1', 'alpha');
         $object->idprof2			= GETPOST('idprof2', 'alpha');
@@ -1330,7 +1330,7 @@ else
                 $object->fax					= GETPOST('fax', 'alpha');
                 $object->email					= GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL);
                 $object->url					= GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL);
-                $object->capital				= GETPOST('capital', 'int');
+                $object->capital				= GETPOST('capital', 'alpha');
                 $object->idprof1				= GETPOST('idprof1', 'alpha');
                 $object->idprof2				= GETPOST('idprof2', 'alpha');
                 $object->idprof3				= GETPOST('idprof3', 'alpha');
diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php
index 48b6c0c0a24293311c86c87b616566993fb3bdec..6067b9b4aa88326924e47a4458f63a2fd1884c6d 100644
--- a/htdocs/theme/eldy/style.css.php
+++ b/htdocs/theme/eldy/style.css.php
@@ -90,7 +90,10 @@ $colorbacklinepair1='250,250,250';    // line pair
 $colorbacklinepair2='248,248,248';    // line pair
 $colorbacklinepairhover='238,246,252';    // line pair
 $colorbackbody='255,255,255';
-$colortext='40,40,40';
+//$colortexttitlenotab='40,0,70';
+$colortexttitlenotab='80,80,0';
+$colortexttitle='';
+$colortext='';
 $fontsize='12';
 $fontsizesmaller='11';
 $usegradient=1;
@@ -116,6 +119,8 @@ if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED))
     $conf->global->THEME_ELDY_LINEPAIRHOVER='238,246,252';
     $conf->global->THEME_ELDY_USE_HOVER=='238,246,252';
     $conf->global->THEME_ELDY_BACKBODY='255,255,255';
+    //$conf->global->THEME_ELDY_TEXTTITLE='0,0,0';
+    $conf->global->THEME_ELDY_TEXT='0,0,0';
     
     $conf->global->THEME_ELDY_FONT_SIZE1='12';
     $conf->global->THEME_ELDY_FONT_SIZE2='11';
@@ -135,6 +140,7 @@ $colorbacklinepair1  =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty(
 $colorbacklinepair2  =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEPAIR2)    ?$colorbacklinepair2:$conf->global->THEME_ELDY_LINEPAIR2)    :(empty($user->conf->THEME_ELDY_LINEPAIR2)?$colorbacklinepair2:$user->conf->THEME_ELDY_LINEPAIR2);
 $colorbacklinepairhover=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEPAIRHOVER)    ?$colorbacklinepairhover:$conf->global->THEME_ELDY_LINEPAIRHOVER)    :(empty($user->conf->THEME_ELDY_LINEPAIRHOVER)?$colorbacklinepairhover:$user->conf->THEME_ELDY_LINEPAIRHOVER);
 $colorbackbody       =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKBODY)     ?$colorbackbody:$conf->global->THEME_ELDY_BACKBODY)          :(empty($user->conf->THEME_ELDY_BACKBODY)?$colorbackbody:$user->conf->THEME_ELDY_BACKBODY);
+$colortexttitle      =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXTTITLE)    ?$colortext:$conf->global->THEME_ELDY_TEXTTITLE)             :(empty($user->conf->THEME_ELDY_TEXTTITLE)?$colortexttitle:$user->conf->THEME_ELDY_TEXTTITLE);
 $colortext           =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXT)         ?$colortext:$conf->global->THEME_ELDY_TEXT)                  :(empty($user->conf->THEME_ELDY_TEXT)?$colortext:$user->conf->THEME_ELDY_TEXT);
 $fontsize            =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_FONT_SIZE1)   ?$fontsize:$conf->global->THEME_ELDY_FONT_SIZE1)             :(empty($user->conf->THEME_ELDY_FONT_SIZE1)?$fontsize:$user->conf->THEME_ELDY_FONT_SIZE1);
 $fontsizesmaller     =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_FONT_SIZE2)   ?$fontsize:$conf->global->THEME_ELDY_FONT_SIZE2)             :(empty($user->conf->THEME_ELDY_FONT_SIZE2)?$fontsize:$user->conf->THEME_ELDY_FONT_SIZE2);
@@ -146,6 +152,31 @@ if (! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED))
     $colorbacklinepairhover=((! isset($user->conf->THEME_ELDY_USE_HOVER) || $user->conf->THEME_ELDY_USE_HOVER === '0')?'':($user->conf->THEME_ELDY_USE_HOVER === '1'?'edf4fb':$user->conf->THEME_ELDY_USE_HOVER));
 }
 
+// Set text color to black or white
+$tmppart=explode(',',$colorbackhmenu1);
+$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : '');
+if ($tmpval <= 360) $colortextbackhmenu='FFFFFF';
+else $colortextbackhmenu='000000';
+
+$tmppart=explode(',',$colorbackvmenu1);
+$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : '');
+if ($tmpval <= 360) { $colortextbackvmenu='FFFFFF'; }
+else { $colortextbackvmenu='000000'; }
+
+$tmppart=explode(',',$colorbacktitle1);
+if ($colortexttitle == '')
+{
+    $tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : '');
+    if ($tmpval <= 360) { $colortexttitle='FFFFFF'; $colorshadowtitle='888888'; }
+    else { $colortexttitle='000000'; $colorshadowtitle='FFFFFF'; }
+}
+
+$tmppart=explode(',',$colorbacktabcard1);
+$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : '');
+if ($tmpval <= 340) { $colortextbacktab='FFFFFF'; }
+else { $colortextbacktab='111111'; }
+
+
 // Format color value to match expected format (may be 'FFFFFF' or '255,255,255')
 $colorbackhmenu1=join(',',colorStringToArray($colorbackhmenu1));
 $colorbackvmenu1=join(',',colorStringToArray($colorbackvmenu1));
@@ -158,26 +189,9 @@ $colorbacklinepair1=join(',',colorStringToArray($colorbacklinepair1));
 $colorbacklinepair2=join(',',colorStringToArray($colorbacklinepair2));
 if ($colorbacklinepairhover != '') $colorbacklinepairhover=join(',',colorStringToArray($colorbacklinepairhover));
 $colorbackbody=join(',',colorStringToArray($colorbackbody));
+$colortexttitle=join(',',colorStringToArray($colortexttitle));
 $colortext=join(',',colorStringToArray($colortext));
 
-// Set text color to black or white
-$tmppart=explode(',',$colorbackhmenu1);
-$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : '');
-if ($tmpval <= 360) $colortextbackhmenu='FFF';
-else $colortextbackhmenu='222';
-$tmppart=explode(',',$colorbackvmenu1);
-$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : '');
-if ($tmpval <= 360) { $colortextbackvmenu='FFF'; }
-else { $colortextbackvmenu='222'; }
-$tmppart=explode(',',$colorbacktitle1);
-$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : '');
-if ($tmpval <= 360) { $colortexttitle='FFF'; $colorshadowtitle='888'; }
-else { $colortexttitle='222'; $colorshadowtitle='FFF'; }
-$tmppart=explode(',',$colorbacktabcard1);
-$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : '');
-if ($tmpval <= 340) { $colortextbacktab='FFF'; }
-else { $colortextbacktab='111'; }
-
 print '/*'."\n";
 print 'colorbackbody='.$colorbackbody."\n";
 print 'colorbackvmenu1='.$colorbackvmenu1."\n";
@@ -188,6 +202,8 @@ print 'colorbacklineimpair2='.$colorbacklineimpair2."\n";
 print 'colorbacklinepair1='.$colorbacklinepair1."\n";
 print 'colorbacklinepair2='.$colorbacklinepair2."\n";
 print 'colorbacklinepairhover='.$colorbacklinepairhover."\n";
+print '$colortexttitle='.$colortexttitle."\n";
+print '$colortext='.$colortext."\n";
 print 'dol_hide_topmenu='.$dol_hide_topmenu."\n";
 print 'dol_hide_leftmenu='.$dol_hide_leftmenu."\n";
 print 'dol_optimize_smallscreen='.$dol_optimize_smallscreen."\n";
@@ -2359,7 +2375,7 @@ div.liste_titre, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.list
 	<?php } ?>
 	font-weight: <?php echo $useboldtitle?'bold':'normal'; ?>;
 
-    color: #<?php echo $colortexttitle; ?>;
+    color: rgb(<?php echo $colortexttitle; ?>);
     font-family: <?php print $fontlist ?>;
     border-bottom: 1px solid #FDFFFF;
     text-align: <?php echo $left; ?>;
@@ -2379,7 +2395,7 @@ tr.liste_titre th a, th.liste_titre a, tr.liste_titre td a, td.liste_titre a, fo
 }
 .liste_titre td a {
 	text-shadow: none !important;
-	color: #<?php echo $colortexttitle; ?>;
+	color: rgb(<?php echo $colortexttitle; ?>);
 }
 tr.liste_titre_sel th, th.liste_titre_sel, tr.liste_titre_sel td, td.liste_titre_sel, form.liste_titre_sel div
 {
@@ -2485,7 +2501,7 @@ tr.box_titre {
 	background-image: linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(250,250,250,0.3) 100%);
 	<?php } ?>
 
-	color: #<?php echo $colortexttitle; ?>;
+	color: rgb(<?php echo $colortexttitle; ?>);
     font-family: <?php print $fontlist ?>, sans-serif;
     font-weight: <?php echo $useboldtitle?'bold':'normal'; ?>;
     border-bottom: 1px solid #FDFFFF;
@@ -2647,9 +2663,9 @@ td.legendLabel { padding: 2px 2px 2px 0 !important; }
 div.titre {
 	font-family: <?php print $fontlist ?>;
 	font-weight: bold;
-	color: rgb(<?php print $colortext; ?>);
+	color: rgb(<?php print $colortexttitlenotab; ?>);
 	text-decoration: none;
-	text-shadow: 1px 1px 2px #FFFFFF;
+	/* text-shadow: 1px 1px 2px #FFFFFF; */
 }
 
 #dolpaymenttable { width: 600px; font-size: 13px; }
@@ -3675,7 +3691,7 @@ a.tab span.ui-btn-inner
 	color: rgb(<?php print $colortext; ?>);
 }
 .liste_titre .ui-link {
-	color: #<?php print $colortexttitle; ?> !important;
+	color: rgb(<?php print $colortexttitle; ?>) !important;
 }
 
 a.ui-link {
@@ -3739,10 +3755,10 @@ ul.ulmenu {
 	background-image: linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%);
     font-weight: bold;
 
-    color: #<?php echo $colortexttitle; ?> !important;
+    color: rgb(<?php echo $colortexttitle; ?>) !important;
 }
 .alilevel0 {
-    color: #<?php echo $colortexttitle; ?> !important;
+    color: rgb(<?php echo $colortexttitle; ?>) !important;
 	text-shadow: 1px 0px 1px #<?php echo $colorshadowtitle; ?>;
 }
 .ui-btn-icon-right {
@@ -3780,7 +3796,7 @@ border-top-left-radius: 6px;
 border-top-right-radius: 6px;
 }*/
 .alilevel1 {
-    color: #<?php echo $colortexttitle; ?> !important;
+    color: rgb(<?php echo $colortexttitle; ?>) !important;
 	text-shadow: 1px 0px 1px #<?php echo $colorshadowtitle; ?>;
 }
 .lilevel1 {
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index 1fdcda48742248ad8582cc4a82655518fac77365..a34397c8bfe0c2fca3d2a670bae78699beec5809 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -91,7 +91,10 @@ $colorbacklinepair1='242,242,242';    // line pair
 $colorbacklinepair2='248,248,248';    // line pair
 $colorbacklinepairhover='238,246,252';    // line pair
 $colorbackbody='255,255,255';
-$colortext='50,50,130';
+//$colortexttitlenotab='40,0,70';
+$colortexttitlenotab='80,80,0';
+$colortexttitle='';
+$colortext='';
 $fontsize='13';
 $fontsizesmaller='11';
 $usegradient=1;
@@ -118,8 +121,9 @@ if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED))
     $conf->global->THEME_ELDY_LINEPAIRHOVER='238,246,252';
     $conf->global->THEME_ELDY_USE_HOVER=='238,246,252';
     $conf->global->THEME_ELDY_BACKBODY='255,255,255';
-    
+    //$conf->global->THEME_ELDY_TEXTTITLE='0,0,0';
     $conf->global->THEME_ELDY_TEXT='50,50,130';
+    
     $conf->global->THEME_ELDY_FONT_SIZE1='13';
     $conf->global->THEME_ELDY_FONT_SIZE2='11';
 }
@@ -138,6 +142,7 @@ $colorbacklinepair1  =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty(
 $colorbacklinepair2  =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEPAIR2)    ?$colorbacklinepair2:$conf->global->THEME_ELDY_LINEPAIR2)    :(empty($user->conf->THEME_ELDY_LINEPAIR2)?$colorbacklinepair2:$user->conf->THEME_ELDY_LINEPAIR2);
 $colorbacklinepairhover  =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEPAIRHOVER)    ?$colorbacklinepairhover:$conf->global->THEME_ELDY_LINEPAIRHOVER)    :(empty($user->conf->THEME_ELDY_LINEPAIRHOVER)?$colorbacklinepairhover:$user->conf->THEME_ELDY_LINEPAIRHOVER);
 $colorbackbody       =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKBODY)     ?$colorbackbody:$conf->global->THEME_ELDY_BACKBODY)          :(empty($user->conf->THEME_ELDY_BACKBODY)?$colorbackbody:$user->conf->THEME_ELDY_BACKBODY);
+$colortexttitle      =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXTTITLE)    ?$colortext:$conf->global->THEME_ELDY_TEXTTITLE)             :(empty($user->conf->THEME_ELDY_TEXTTITLE)?$colortexttitle:$user->conf->THEME_ELDY_TEXTTITLE);
 $colortext           =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXT)         ?$colortext:$conf->global->THEME_ELDY_TEXT)                  :(empty($user->conf->THEME_ELDY_TEXT)?$colortext:$user->conf->THEME_ELDY_TEXT);
 $fontsize            =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_FONT_SIZE1)   ?$fontsize:$conf->global->THEME_ELDY_FONT_SIZE1)             :(empty($user->conf->THEME_ELDY_FONT_SIZE1)?$fontsize:$user->conf->THEME_ELDY_FONT_SIZE1);
 $fontsizesmaller     =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_FONT_SIZE2)   ?$fontsize:$conf->global->THEME_ELDY_FONT_SIZE2)             :(empty($user->conf->THEME_ELDY_FONT_SIZE2)?$fontsize:$user->conf->THEME_ELDY_FONT_SIZE2);
@@ -149,6 +154,24 @@ if (! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED))
     $colorbacklinepairhover=((! isset($user->conf->THEME_ELDY_USE_HOVER) || $user->conf->THEME_ELDY_USE_HOVER === '0')?'':($user->conf->THEME_ELDY_USE_HOVER === '1'?'edf4fb':$user->conf->THEME_ELDY_USE_HOVER));
 }
 
+// Set text color to black or white
+$tmppart=explode(',',$colorbackhmenu1);
+$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : '');
+if ($tmpval <= 360) $colortextbackhmenu='FFFFFF';
+else $colortextbackhmenu='111111';
+$tmppart=explode(',',$colorbackvmenu1);
+$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : '');
+if ($tmpval <= 360) { $colortextbackvmenu='FFFFFF'; }
+else { $colortextbackvmenu='111111'; }
+$tmppart=explode(',',$colorbacktitle1);
+$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : '');
+if ($tmpval <= 360) { $colortexttitle='FFFFFF'; $colorshadowtitle='888888'; }
+else { $colortexttitle='111111'; $colorshadowtitle='FFFFFF'; }
+$tmppart=explode(',',$colorbacktabcard1);
+$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : '');
+if ($tmpval <= 340) { $colortextbacktab='FFFFFF'; }
+else { $colortextbacktab='111111'; }
+
 // Format color value to match expected format (may be 'FFFFFF' or '255,255,255')
 $colorbackhmenu1=join(',',colorStringToArray($colorbackhmenu1));
 $colorbackvmenu1=join(',',colorStringToArray($colorbackvmenu1));
@@ -161,27 +184,9 @@ $colorbacklinepair1=join(',',colorStringToArray($colorbacklinepair1));
 $colorbacklinepair2=join(',',colorStringToArray($colorbacklinepair2));
 if ($colorbacklinepairhover != '') $colorbacklinepairhover=join(',',colorStringToArray($colorbacklinepairhover));
 $colorbackbody=join(',',colorStringToArray($colorbackbody));
+$colortexttitle=join(',',colorStringToArray($colortexttitle));
 $colortext=join(',',colorStringToArray($colorbackvmenu1));
 
-// Set text color to black or white
-$tmppart=explode(',',$colorbackhmenu1);
-$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : '');
-if ($tmpval <= 360) $colortextbackhmenu='FFF';
-else $colortextbackhmenu='111';
-$tmppart=explode(',',$colorbackvmenu1);
-$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : '');
-if ($tmpval <= 360) { $colortextbackvmenu='FFF'; }
-else { $colortextbackvmenu='111'; }
-$tmppart=explode(',',$colorbacktitle1);
-$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : '');
-if ($tmpval <= 360) { $colortexttitle='FFF'; $colorshadowtitle='888'; }
-else { $colortexttitle='111'; $colorshadowtitle='FFF'; }
-$tmppart=explode(',',$colorbacktabcard1);
-$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : '');
-if ($tmpval <= 340) { $colortextbacktab='FFF'; }
-else { $colortextbacktab='111'; }
-
-
 print '/*'."\n";
 print 'colorbackbody='.$colorbackbody."\n";
 print 'colorbackvmenu1='.$colorbackvmenu1."\n";
@@ -2211,7 +2216,7 @@ div.liste_titre, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.list
 	font-weight: <?php echo $useboldtitle?'bold':'normal'; ?>;
 	*/
 	
-    color: #<?php echo $colortexttitle; ?>;
+    color: rgb(<?php echo $colortexttitle; ?>);
     font-family: <?php print $fontlist ?>;
     border-bottom: 1px solid #FDFFFF;
     text-align: <?php echo $left; ?>;
@@ -2231,7 +2236,7 @@ tr.liste_titre th a, th.liste_titre a, tr.liste_titre td a, td.liste_titre a, fo
 }
 .liste_titre td a {
 	text-shadow: none !important;
-	color: #<?php echo $colortexttitle; ?>;
+	color: rgb(<?php echo $colortexttitle; ?>);
 }
 div.liste_titre {
 	padding-left: 3px;
@@ -2343,7 +2348,7 @@ tr.box_titre {
 	*/
 	
     background-repeat: repeat-x;
-    color: #<?php echo $colortexttitle; ?>;
+    color: rgb(<?php echo $colortexttitle; ?>);
     font-family: <?php print $fontlist ?>, sans-serif;
     font-weight: <?php echo $useboldtitle?'bold':'normal'; ?>;
     border-bottom: 1px solid #FDFFFF;
@@ -2504,9 +2509,9 @@ td.legendLabel { padding: 2px 2px 2px 0 !important; }
 div.titre {
 	font-family: <?php print $fontlist ?>;
 	font-weight: bold;
-	color: rgb(<?php print $colortext; ?>);
+	color: rgb(<?php print $colortexttitlenotab; ?>);
 	text-decoration: none;
-	text-shadow: 1px 1px 2px #FFFFFF;
+	/* text-shadow: 1px 1px 2px #FFFFFF; */
 	<?php print (empty($conf->dol_optimize_smallscreen)?'':'margin-top: 4px;'); ?>
 }
 
@@ -3534,7 +3539,7 @@ a.tab span.ui-btn-inner
 	color: rgb(<?php print $colortext; ?>);
 }
 .liste_titre .ui-link {
-	color: #<?php print $colortexttitle; ?> !important;
+	color: rgb(<?php echo $colortexttitle; ?>) !important;
 }
 
 a.ui-link {
@@ -3598,10 +3603,10 @@ ul.ulmenu {
 	background-image: linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%);
     font-weight: bold;
 
-    color: #<?php echo $colortexttitle; ?> !important;
+    color: rgb(<?php echo $colortexttitle; ?>) !important;
 }
 .alilevel0 {
-    color: #<?php echo $colortexttitle; ?> !important;
+    color: rgb(<?php echo $colortexttitle; ?>) !important;
 	text-shadow: 1px 0px 1px #<?php echo $colorshadowtitle; ?>;
 }
 .ui-btn-icon-right {
@@ -3631,7 +3636,7 @@ border-top-left-radius: 6px;
 border-top-right-radius: 6px;
 }
 .alilevel1 {
-    color: #<?php echo $colortexttitle; ?> !important;
+    color: rgb(<?php echo $colortexttitle; ?>) !important;
 	text-shadow: 1px 0px 1px #<?php echo $colorshadowtitle; ?>;
 }
 .lilevel1 {
diff --git a/test/phpunit/AllTests.php b/test/phpunit/AllTests.php
index 94e8ba1478efbcd205527417dc54a407d49bed74..d7bd828527f8f86d80cf20571020fa035b0d58ca 100644
--- a/test/phpunit/AllTests.php
+++ b/test/phpunit/AllTests.php
@@ -38,11 +38,16 @@ if ($langs->defaultlang != 'en_US')
     print "Error: Default language for company to run tests must be set to en_US or auto. Current is ".$langs->defaultlang."\n";
     exit;
 }
-if (! empty($conf->adherents->enabled))
+if (empty($conf->adherent->enabled))
 {
 	print "Error: Module member must be enabled to have significatn results.\n";
 	exit;
 }
+if (! empty($conf->ldap->enabled))
+{
+    print "Error: LDAP module should not be enabled.\n";
+    exit;
+}
 if (! empty($conf->google->enabled))
 {
     print "Warning: Google module should not be enabled.\n";
diff --git a/test/phpunit/CMailFileTest.php b/test/phpunit/CMailFileTest.php
index 52a65a8949ed4a36bd625e809bc27ac8b6cbc72b..092d2e1f41c8eca50070a83eb2eb7cbb5e73285b 100755
--- a/test/phpunit/CMailFileTest.php
+++ b/test/phpunit/CMailFileTest.php
@@ -102,6 +102,8 @@ class CMailFileTest extends PHPUnit_Framework_TestCase
         $langs=$this->savlangs;
         $db=$this->savdb;
 
+        $conf->global->MAIN_DISABLE_ALL_MAILS=1;    // If I comment/remove this lien, unit test still works alone but failed when ran from AllTest. Don't know why.
+        
         print __METHOD__."\n";
     }
     /**
diff --git a/test/phpunit/PricesTest.php b/test/phpunit/PricesTest.php
index b8a942d5899fd14eb50304ece1af9f41b749ec97..bb8c90d5f1c63ffa6c92aa373ebf24a59d4cf1ba 100755
--- a/test/phpunit/PricesTest.php
+++ b/test/phpunit/PricesTest.php
@@ -39,6 +39,11 @@ if (empty($user->id))
 }
 $conf->global->MAIN_DISABLE_ALL_MAILS=1;
 
+if (! empty($conf->global->MAIN_ROUNDING_RULE_TOT))
+{
+    print "Parameter MAIN_ROUNDING_RULE_TOT must be set to 0 or not set.\n";
+    exit;
+}
 
 /**
  * Class for PHPUnit tests
@@ -279,11 +284,11 @@ class PricesTest extends PHPUnit_Framework_TestCase
 
 
     /**
-    * Test function addline and update_price
-    *
-    * @return 	boolean
-    * @see		http://wiki.dolibarr.org/index.php/Draft:VAT_calculation_and_rounding#Standard_usage
-    */
+     * Test function addline and update_price
+     *
+     * @return 	boolean
+     * @see		http://wiki.dolibarr.org/index.php/Draft:VAT_calculation_and_rounding#Standard_usage
+     */
     public function testUpdatePrice()
     {
 		//$this->sharedFixture
diff --git a/test/phpunit/WebservicesProductsTest.php b/test/phpunit/WebservicesProductsTest.php
index 77fd81c78f6404f432204c5a1c3ccc199874be2f..a751faddb4bf3de0843e47f51e0dd6c73392a7be 100755
--- a/test/phpunit/WebservicesProductsTest.php
+++ b/test/phpunit/WebservicesProductsTest.php
@@ -40,6 +40,11 @@ if (empty($user->id)) {
 }
 $conf->global->MAIN_DISABLE_ALL_MAILS=1;
 
+if (empty($conf->service->enabled))
+{
+	print "Error: Module service must be enabled.\n";
+	exit;
+}
 
 /**
  * Class for PHPUnit tests