diff --git a/dev/initdata/mysqldump_dolibarr_3.3.0.sql b/dev/initdata/mysqldump_dolibarr_3.3.0.sql
index 9cc783e1b8031784f1213252003a4622682d616d..83f224ddd99d5e89a9a10859a2dab2ae03368175 100644
--- a/dev/initdata/mysqldump_dolibarr_3.3.0.sql
+++ b/dev/initdata/mysqldump_dolibarr_3.3.0.sql
@@ -34,7 +34,7 @@ CREATE TABLE `llx_accountingaccount` (
   PRIMARY KEY (`rowid`),
   KEY `idx_accountingaccount_fk_pcg_version` (`fk_pcg_version`),
   CONSTRAINT `fk_accountingaccount_fk_pcg_version` FOREIGN KEY (`fk_pcg_version`) REFERENCES `llx_accountingsystem` (`pcg_version`)
-) ENGINE=InnoDB AUTO_INCREMENT=439 DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB AUTO_INCREMENT=439 DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -86,7 +86,7 @@ CREATE TABLE `llx_accountingsystem` (
   `active` smallint(6) DEFAULT '0',
   PRIMARY KEY (`rowid`),
   KEY `idx_accountingsystem_pcg_version` (`pcg_version`)
-) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -1075,7 +1075,7 @@ CREATE TABLE `llx_c_currencies` (
   `unicode` varchar(32) DEFAULT NULL,
   `active` tinyint(4) NOT NULL DEFAULT '1',
   PRIMARY KEY (`code_iso`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -2975,7 +2975,7 @@ CREATE TABLE `llx_element_tag` (
   `element` varchar(64) NOT NULL,
   PRIMARY KEY (`rowid`),
   UNIQUE KEY `uk_element_tag` (`entity`,`lang`,`tag`,`fk_element`,`element`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -3796,7 +3796,7 @@ CREATE TABLE `llx_holiday` (
   KEY `idx_holiday_fk_user` (`fk_user`),
   KEY `idx_holiday_date_debut` (`date_debut`),
   KEY `idx_holiday_date_fin` (`date_fin`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -3821,7 +3821,7 @@ CREATE TABLE `llx_holiday_config` (
   `value` text,
   PRIMARY KEY (`rowid`),
   UNIQUE KEY `name` (`name`)
-) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -3848,7 +3848,7 @@ CREATE TABLE `llx_holiday_events` (
   `value` text NOT NULL,
   PRIMARY KEY (`rowid`),
   UNIQUE KEY `uk_holiday_name` (`name`,`entity`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -3876,7 +3876,7 @@ CREATE TABLE `llx_holiday_logs` (
   `prev_solde` varchar(255) NOT NULL,
   `new_solde` varchar(255) NOT NULL,
   PRIMARY KEY (`rowid`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -3899,7 +3899,7 @@ CREATE TABLE `llx_holiday_users` (
   `fk_user` int(11) NOT NULL,
   `nb_holiday` double NOT NULL DEFAULT '0',
   PRIMARY KEY (`fk_user`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -4919,7 +4919,7 @@ CREATE TABLE `llx_product_price_by_qty` (
   UNIQUE KEY `uk_product_price_by_qty_level` (`fk_product_price`,`qty_min`),
   KEY `idx_product_price_by_qty_fk_product_price` (`fk_product_price`),
   CONSTRAINT `fk_product_price_by_qty_fk_product_price` FOREIGN KEY (`fk_product_price`) REFERENCES `llx_product_price` (`rowid`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -5250,7 +5250,7 @@ CREATE TABLE `llx_publi_c_contact_list` (
   `active` tinyint(4) NOT NULL DEFAULT '1',
   PRIMARY KEY (`rowid`),
   UNIQUE KEY `uk_contact_list_code` (`code`,`entity`)
-) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -5279,7 +5279,7 @@ CREATE TABLE `llx_publi_c_dnd_list` (
   `active` tinyint(4) NOT NULL DEFAULT '1',
   PRIMARY KEY (`rowid`),
   UNIQUE KEY `uk_dnd_list_code` (`code`,`entity`)
-) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -5308,7 +5308,7 @@ CREATE TABLE `llx_publi_c_method_list` (
   `active` tinyint(4) NOT NULL DEFAULT '1',
   PRIMARY KEY (`rowid`),
   UNIQUE KEY `uk_method_list_code` (`code`,`entity`)
-) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -5760,7 +5760,7 @@ CREATE TABLE `llx_socpeople_extrafields` (
   `import_key` varchar(14) DEFAULT NULL,
   PRIMARY KEY (`rowid`),
   KEY `idx_socpeople_extrafields` (`fk_object`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -6060,7 +6060,7 @@ CREATE TABLE `llx_user_extrafields` (
   `import_key` varchar(14) DEFAULT NULL,
   PRIMARY KEY (`rowid`),
   KEY `idx_user_extrafields` (`fk_object`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
diff --git a/dev/initdata/mysqldump_dolibarr_3.4.0.sql b/dev/initdata/mysqldump_dolibarr_3.4.0.sql
index eaa2c8f1a8941c33dfd70a7851528f68aa24c3fd..1fa3bfe8791549b3a357a4c8898905e53b608de9 100644
--- a/dev/initdata/mysqldump_dolibarr_3.4.0.sql
+++ b/dev/initdata/mysqldump_dolibarr_3.4.0.sql
@@ -30,7 +30,7 @@ CREATE TABLE `llx_accounting_system` (
   `active` smallint(6) DEFAULT '0',
   PRIMARY KEY (`rowid`),
   UNIQUE KEY `uk_accounting_system_pcg_version` (`pcg_version`)
-) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -62,7 +62,7 @@ CREATE TABLE `llx_accountingaccount` (
   PRIMARY KEY (`rowid`),
   KEY `idx_accountingaccount_fk_pcg_version` (`fk_pcg_version`),
   CONSTRAINT `fk_accountingaccount_fk_pcg_version` FOREIGN KEY (`fk_pcg_version`) REFERENCES `llx_accounting_system` (`pcg_version`)
-) ENGINE=InnoDB AUTO_INCREMENT=439 DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB AUTO_INCREMENT=439 DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -198,7 +198,7 @@ CREATE TABLE `llx_actioncomm_extrafields` (
   `import_key` varchar(14) DEFAULT NULL,
   PRIMARY KEY (`rowid`),
   KEY `idx_actioncomm_extrafields` (`fk_object`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -402,7 +402,7 @@ CREATE TABLE `llx_adherent_type_extrafields` (
   `import_key` varchar(14) DEFAULT NULL,
   PRIMARY KEY (`rowid`),
   KEY `idx_adherent_type_extrafields` (`fk_object`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -826,7 +826,7 @@ CREATE TABLE `llx_c_action_trigger` (
   PRIMARY KEY (`rowid`),
   UNIQUE KEY `uk_action_trigger_code` (`code`),
   KEY `idx_action_trigger_rang` (`rang`)
-) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -996,7 +996,7 @@ CREATE TABLE `llx_c_currencies` (
   `unicode` varchar(32) DEFAULT NULL,
   `active` tinyint(4) NOT NULL DEFAULT '1',
   PRIMARY KEY (`code_iso`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -1470,7 +1470,7 @@ CREATE TABLE `llx_c_revenuestamp` (
   `accountancy_code_sell` varchar(15) DEFAULT NULL,
   `accountancy_code_buy` varchar(15) DEFAULT NULL,
   PRIMARY KEY (`rowid`)
-) ENGINE=InnoDB AUTO_INCREMENT=105 DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB AUTO_INCREMENT=105 DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -2583,7 +2583,7 @@ CREATE TABLE `llx_cronjob` (
   `fk_user_mod` int(11) DEFAULT NULL,
   `note` text,
   PRIMARY KEY (`rowid`)
-) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -2704,7 +2704,7 @@ CREATE TABLE `llx_dolicloud_emailstemplates` (
   `content` text NOT NULL,
   PRIMARY KEY (`rowid`),
   UNIQUE KEY `uk_dolicloud_emailstemplates` (`emailtype`,`lang`)
-) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -3006,7 +3006,7 @@ CREATE TABLE `llx_element_tag` (
   `element` varchar(64) NOT NULL,
   PRIMARY KEY (`rowid`),
   UNIQUE KEY `uk_element_tag` (`entity`,`lang`,`tag`,`fk_element`,`element`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -3418,7 +3418,7 @@ CREATE TABLE `llx_facture_extrafields` (
   `import_key` varchar(14) DEFAULT NULL,
   PRIMARY KEY (`rowid`),
   KEY `idx_facture_extrafields` (`fk_object`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -3864,7 +3864,7 @@ CREATE TABLE `llx_holiday` (
   KEY `idx_holiday_fk_user` (`fk_user`),
   KEY `idx_holiday_date_debut` (`date_debut`),
   KEY `idx_holiday_date_fin` (`date_fin`)
-) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -3890,7 +3890,7 @@ CREATE TABLE `llx_holiday_config` (
   `value` text,
   PRIMARY KEY (`rowid`),
   UNIQUE KEY `name` (`name`)
-) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -3917,7 +3917,7 @@ CREATE TABLE `llx_holiday_events` (
   `value` text NOT NULL,
   PRIMARY KEY (`rowid`),
   UNIQUE KEY `uk_holiday_name` (`name`,`entity`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -3945,7 +3945,7 @@ CREATE TABLE `llx_holiday_logs` (
   `prev_solde` varchar(255) NOT NULL,
   `new_solde` varchar(255) NOT NULL,
   PRIMARY KEY (`rowid`)
-) ENGINE=InnoDB AUTO_INCREMENT=145 DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB AUTO_INCREMENT=145 DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -3969,7 +3969,7 @@ CREATE TABLE `llx_holiday_users` (
   `fk_user` int(11) NOT NULL,
   `nb_holiday` double NOT NULL DEFAULT '0',
   PRIMARY KEY (`fk_user`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -4269,7 +4269,7 @@ CREATE TABLE `llx_milestone` (
   UNIQUE KEY `uk_milestone_fk_element` (`fk_element`,`elementtype`),
   KEY `idx_milestone_fk_user_modif` (`fk_user_modif`),
   CONSTRAINT `fk_milestone_fk_user_modif` FOREIGN KEY (`fk_user_modif`) REFERENCES `llx_user` (`rowid`)
-) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -4391,7 +4391,7 @@ CREATE TABLE `llx_opensurvey_comments` (
   `comment` text NOT NULL,
   `usercomment` text,
   PRIMARY KEY (`id_comment`)
-) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -4425,7 +4425,7 @@ CREATE TABLE `llx_opensurvey_sondage` (
   `origin` varchar(64) DEFAULT NULL,
   `tms` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
   PRIMARY KEY (`id_sondage`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -4448,7 +4448,7 @@ DROP TABLE IF EXISTS `llx_opensurvey_sujet_studs`;
 CREATE TABLE `llx_opensurvey_sujet_studs` (
   `id_sondage` char(16) NOT NULL,
   `sujet` text
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -4477,7 +4477,7 @@ CREATE TABLE `llx_opensurvey_user_studs` (
   KEY `idx_id_users` (`id_users`),
   KEY `idx_nom` (`nom`),
   KEY `idx_id_sondage` (`id_sondage`)
-) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -4679,7 +4679,7 @@ CREATE TABLE `llx_pos_cash` (
   `datea` datetime DEFAULT NULL,
   `is_closed` tinyint(4) DEFAULT '0',
   PRIMARY KEY (`rowid`)
-) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -4714,7 +4714,7 @@ CREATE TABLE `llx_pos_control_cash` (
   `amount_next_day` double(24,8) DEFAULT NULL,
   `comment` text,
   PRIMARY KEY (`rowid`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -4739,7 +4739,7 @@ CREATE TABLE `llx_pos_facture` (
   `fk_facture` int(11) NOT NULL,
   `fk_control_cash` int(11) DEFAULT NULL,
   PRIMARY KEY (`rowid`)
-) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -4769,7 +4769,7 @@ CREATE TABLE `llx_pos_moviments` (
   `type` tinyint(4) DEFAULT NULL,
   `comment` text,
   PRIMARY KEY (`rowid`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -4794,7 +4794,7 @@ CREATE TABLE `llx_pos_paiement_ticket` (
   `fk_ticket` int(11) DEFAULT NULL,
   `amount` double(24,8) DEFAULT '0.00000000',
   PRIMARY KEY (`rowid`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -4852,7 +4852,7 @@ CREATE TABLE `llx_pos_ticket` (
   KEY `idx_ticket_fk_ticket_source` (`fk_ticket_source`),
   CONSTRAINT `fk_ticket_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`),
   CONSTRAINT `fk_ticket_fk_user_author` FOREIGN KEY (`fk_user_author`) REFERENCES `llx_user` (`rowid`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -4903,7 +4903,7 @@ CREATE TABLE `llx_pos_ticketdet` (
   UNIQUE KEY `uk_fk_remise_except` (`fk_remise_except`,`fk_ticket`),
   KEY `idx_ticketdet_fk_ticket` (`fk_ticket`),
   KEY `idx_ticketdet_fk_product` (`fk_product`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -5365,7 +5365,7 @@ CREATE TABLE `llx_product_price_by_qty` (
   UNIQUE KEY `uk_product_price_by_qty_level` (`fk_product_price`,`qty_min`),
   KEY `idx_product_price_by_qty_fk_product_price` (`fk_product_price`),
   CONSTRAINT `fk_product_price_by_qty_fk_product_price` FOREIGN KEY (`fk_product_price`) REFERENCES `llx_product_price` (`rowid`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -5639,7 +5639,7 @@ CREATE TABLE `llx_propal_extrafields` (
   `import_key` varchar(14) DEFAULT NULL,
   PRIMARY KEY (`rowid`),
   KEY `idx_propal_extrafields` (`fk_object`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -6146,7 +6146,7 @@ CREATE TABLE `llx_socpeople_extrafields` (
   `import_key` varchar(14) DEFAULT NULL,
   PRIMARY KEY (`rowid`),
   KEY `idx_socpeople_extrafields` (`fk_object`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -6226,7 +6226,7 @@ CREATE TABLE `llx_submitew_message` (
   `joined_file3` varchar(255) DEFAULT NULL,
   `joined_file4` varchar(255) DEFAULT NULL,
   PRIMARY KEY (`rowid`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -6498,7 +6498,7 @@ CREATE TABLE `llx_user_extrafields` (
   `import_key` varchar(14) DEFAULT NULL,
   PRIMARY KEY (`rowid`),
   KEY `idx_user_extrafields` (`fk_object`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
@@ -6665,7 +6665,7 @@ CREATE TABLE `llx_ventilation_achat` (
   `ventilation` varchar(255) DEFAULT NULL,
   `qty` double DEFAULT NULL,
   PRIMARY KEY (`rowid`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 /*!40101 SET character_set_client = @saved_cs_client */;
 
 --
diff --git a/htdocs/adherents/admin/mailman.php b/htdocs/adherents/admin/mailman.php
index 29b2099ccfcdfba93c57df75d8798d9cfccb28e0..9e0b859db67583007f2aa709b2b36d35fc5d745f 100644
--- a/htdocs/adherents/admin/mailman.php
+++ b/htdocs/adherents/admin/mailman.php
@@ -51,14 +51,17 @@ $testunsubscribeemail = GETPOST("testunsubscribeemail");
 // Action mise a jour ou ajout d'une constante
 if ($action == 'update' || $action == 'add')
 {
-	$constname=GETPOST("constname");
-	$constvalue=GETPOST("constvalue");
-	$consttype=GETPOST("consttype");
-	$constnote=GETPOST("constnote");
-	$res=dolibarr_set_const($db,$constname,$constvalue,$type[$consttype],0,$constnote,$conf->entity);
-
-	if (! $res > 0) $error++;
-
+	foreach($_POST['constname'] as $key => $val)
+	{
+		$constname=$_POST["constname"][$key];
+		$constvalue=$_POST["constvalue"][$key];
+		$consttype=$_POST["consttype"][$key];
+		$constnote=$_POST["constnote"][$key];
+		$res=dolibarr_set_const($db,$constname,$constvalue,$type[$consttype],0,$constnote,$conf->entity);
+	
+		if (! $res > 0) $error++;
+	}
+	
 	if (! $error)
 	{
 		$mesg = '<div class="ok">'.$langs->trans("SetupSaved").'</div>';
@@ -159,9 +162,6 @@ dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user');
 dol_htmloutput_mesg($mesg);
 
 
-/*
- * Mailman
- */
 $var=!$var;
 if (! empty($conf->global->ADHERENT_USE_MAILMAN))
 {
@@ -180,6 +180,8 @@ if (! empty($conf->global->ADHERENT_USE_MAILMAN))
 
     print_fiche_titre($langs->trans('MailmanTitle'), $lien,'');
 
+    print '<br>';
+    
     // JQuery activity
     print '<script type="text/javascript">
     var i1=0;
@@ -196,7 +198,7 @@ if (! empty($conf->global->ADHERENT_USE_MAILMAN))
     });
     </script>';
 
-    form_constantes($constantes);
+    form_constantes($constantes,1);
 
     print '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
     print '%LISTE%, %MAILMAN_ADMINPW%, %EMAIL% <br>';
@@ -217,12 +219,12 @@ if (! empty($conf->global->ADHERENT_USE_MAILMAN))
     print '<form action="'.$_SERVER["PHP_SELF"].'">';
     print '<input type="hidden" name="action" value="testsubscribe">';
     print $langs->trans("TestSubscribe").'<br>';
-    print $langs->trans("EMail").' <input type="email" name="testsubscribeemail" value="'.GETPOST('testsubscribeemail').'"> <input class="button" type="submit" value="'.$langs->trans("Test").'"><br>';
+    print $langs->trans("EMail").' <input type="email" class="flat" name="testsubscribeemail" value="'.GETPOST('testsubscribeemail').'"> <input class="button" type="submit" value="'.$langs->trans("Test").'"><br>';
     print '</form>';
     print '<form action="'.$_SERVER["PHP_SELF"].'">';
     print '<input type="hidden" name="action" value="testunsubscribe">';
     print $langs->trans("TestUnSubscribe").'<br>';
-    print $langs->trans("EMail").' <input type="email" name="testunsubscribeemail" value="'.GETPOST('testunsubscribeemail').'"> <input class="button" type="submit" value="'.$langs->trans("Test").'"><br>';
+    print $langs->trans("EMail").' <input type="email" class="flat" name="testunsubscribeemail" value="'.GETPOST('testunsubscribeemail').'"> <input class="button" type="submit" value="'.$langs->trans("Test").'"><br>';
     print '</form>';
 }
 
diff --git a/htdocs/adherents/admin/spip.php b/htdocs/adherents/admin/spip.php
index abc795bcce2fbfd51618804b4ffb0e47e1743599..9bbb95c2697a7acf8f5b9b35c5e46b1f769a689c 100644
--- a/htdocs/adherents/admin/spip.php
+++ b/htdocs/adherents/admin/spip.php
@@ -139,6 +139,7 @@ if (! empty($conf->global->ADHERENT_USE_SPIP))
 	);
 
     print_fiche_titre($langs->trans('SPIPTitle'), $lien, '');
+	print '<br>';
     form_constantes($constantes);
     print '<br>';
 }
diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php
index 52f2c3fb13ea1cd1747dc1ec565670a34583d1d4..05833bbce109ca563f0a2743fa65c347cb2449e8 100644
--- a/htdocs/adherents/fiche.php
+++ b/htdocs/adherents/fiche.php
@@ -931,9 +931,10 @@ else
 		$adht->fetch($object->typeid);
 
 		// We set country_id, and country_code, country of the chosen country
-		if (isset($_POST["country"]) || $object->country_id)
+		$country=GETPOST('country','int');
+		if (!empty($country) || $object->country_id)
 		{
-			$sql = "SELECT rowid, code, libelle as label from ".MAIN_DB_PREFIX."c_pays where rowid = ".(isset($_POST["country"])?$_POST["country"]:$object->country_id);
+			$sql = "SELECT rowid, code, libelle as label from ".MAIN_DB_PREFIX."c_pays where rowid = ".(!empty($country)?$country:$object->country_id);
 			$resql=$db->query($sql);
 			if ($resql)
 			{
diff --git a/htdocs/categories/fiche.php b/htdocs/categories/fiche.php
index 34a036156a3e914afe50cfbf76f7eadfe33cd608..c97d023f5b8176ea265bc956e2c58aa845eeead7 100644
--- a/htdocs/categories/fiche.php
+++ b/htdocs/categories/fiche.php
@@ -211,7 +211,7 @@ if ($user->rights->categorie->creer)
 
 		// Ref
 		print '<tr>';
-		print '<td width="25%" class="fieldrequired">'.$langs->trans("Ref").'</td><td><input id="label" name="label" size="25" value="'.$label.'">';
+		print '<td width="25%" class="fieldrequired">'.$langs->trans("Ref").'</td><td><input id="label" class="flat" name="label" size="25" value="'.$label.'">';
 		print'</td></tr>';
 
 		// Description
diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php
index 367ab558194b7699776b3e796bfd3eca061e9c44..fbc76d402e158d045130eb158f6711f1630bb22d 100644
--- a/htdocs/comm/index.php
+++ b/htdocs/comm/index.php
@@ -1,6 +1,6 @@
 <?php
 /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
- * Copyright (C) 2004-2011 Laurent Destailleur  <eldy@users.sourceforge.net>
+ * Copyright (C) 2004-2013 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copyright (C) 2005-2012 Regis Houssin        <regis.houssin@capnetworks.com>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -529,4 +529,4 @@ print '</div></div></div>';
 llxFooter();
 
 $db->close();
-?>
\ No newline at end of file
+?>
diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index 9cde868a97ab264299600146876b863167ca5705..09bc17792c09fed84bf95a12473ffe3370221071 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -351,7 +351,7 @@ else if ($action == 'add' && $user->rights->propal->creer)
 		if ($id > 0)
 		{
 			// Insertion contact par defaut si defini
-			if (GETPOST('contactidp'))
+			if (GETPOST('contactidp') > 0)
 			{
 				$result=$object->add_contact(GETPOST('contactidp'),'CUSTOMER','external');
 				if ($result < 0)
@@ -1347,6 +1347,7 @@ if ($action == 'create')
 		$numprojet=select_projects($soc->id,$projectid);
 		if ($numprojet==0)
 		{
+			$langs->load("projects");
 			print ' &nbsp; <a href="../projet/fiche.php?socid='.$soc->id.'&action=create">'.$langs->trans("AddProject").'</a>';
 		}
 		print '</td>';
@@ -1834,33 +1835,58 @@ else
 	$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action);    // Note that $action and $object may have been modified by hook
 	if (empty($reshook) && ! empty($extrafields->attribute_label))
 	{
-
 		if ($action == 'edit_extras')
 		{
-			print '</table>';
 			print '<form enctype="multipart/form-data" action="'.$_SERVER["PHP_SELF"].'" method="post" name="formsoc">';
 			print '<input type="hidden" name="action" value="update_extras">';
 			print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
 			print '<input type="hidden" name="id" value="'.$object->id.'">';
-			print '<table class="border" width="100%">';
 		}
 
-		print $object->showOptionals($extrafields,'edit');
+		foreach($extrafields->attribute_label as $key=>$label)
+		{
+			$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
+			if ($extrafields->attribute_type[$key] == 'separate')
+			{
+				print $extrafields->showSeparator($key);
+			}
+			else
+			{
+				print '<tr><td';
+				if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
+				print '>'.$label.'</td><td colspan="5">';
+				// Convert date into timestamp format
+				if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
+				{
+					$value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$object->array_options['options_'.$key];
+				}
+
+				if ($action == 'edit_extras' && $user->rights->propal->creer)
+				{
+					print $extrafields->showInputField($key,$value);
+				}
+				else
+				{
+					print $extrafields->showOutputField($key,$value);
+				}
+				print '</td></tr>'."\n";
+			}
+		}
 
 		if(count($extrafields->attribute_label) > 0) {
 
 			if ($action == 'edit_extras' && $user->rights->propal->creer)
 			{
-				print '<tr><td width="25%"></td><td>';
+				print '<tr><td></td><td colspan="5">';
 				print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
+				print '</form>';
 				print '</td></tr>';
-				print '</table></form>';
-				print '<table class="border" width="100%">';
+
 			}
 			else {
 				if ($object->statut == 0 && $user->rights->propal->creer)
 				{
-					print '<tr><td width="25%"></td><td><a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit_extras">'.img_picto('','edit').' '.$langs->trans('Modify').'</a></td></tr>';
+					print '<tr><td></td><td><a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit_extras">'.img_picto('','edit').' '.$langs->trans('Modify').'</a></td></tr>';
 				}
 			}
 		}
@@ -1923,6 +1949,7 @@ else
 		include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php';
 	}
 
+
 	/*
 	 * Lines
 	*/
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index dc2c708cbec4f82ea30e5ed6a2b3412b9c42180b..7dc63fdace97f0a7d358cb50775e652403c704ca 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -648,8 +648,7 @@ class Propal extends CommonObject
         dol_syslog(get_class($this)."::create");
 
         // Check parameters
-        $soc = new Societe($this->db);
-        $result=$soc->fetch($this->socid);
+        $result=$this->fetch_thirdparty();
         if ($result < 0)
         {
             $this->error="Failed to fetch company";
@@ -670,8 +669,6 @@ class Propal extends CommonObject
 
         $this->db->begin();
 
-        $this->fetch_thirdparty();
-
         // Insert into database
         $sql = "INSERT INTO ".MAIN_DB_PREFIX."propal (";
         $sql.= "fk_soc";
diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index 99168cdc6a0cf121d48eab75db40661128a36908..a7d04670961933a3f86bd26ac6ac1c883e7f2e06 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -1,34 +1,34 @@
 <?php
 /* Copyright (C) 2003-2006	Rodolphe Quiedeville	<rodolphe@quiedeville.org>
  * Copyright (C) 2004-2013	Laurent Destailleur		<eldy@users.sourceforge.net>
- * Copyright (C) 2005		Marc Barilley / Ocebo	<marc@ocebo.com>
- * Copyright (C) 2005-2013	Regis Houssin			<regis.houssin@capnetworks.com>
- * Copyright (C) 2006		Andre Cianfarani		<acianfa@free.fr>
- * Copyright (C) 2010-2013	Juanjo Menent			<jmenent@2byte.es>
- * Copyright (C) 2011		Philippe Grand			<philippe.grand@atoo-net.com>
- * Copyright (C) 2012		Christophe Battarel		<christophe.battarel@altairis.fr>
- * Copyright (C) 2012		Marcos García			<marcosgdf@gmail.com>
- * Copyright (C) 2013		Florian Henry			<florian.henry@open-concept.pro>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
+* Copyright (C) 2005		Marc Barilley / Ocebo	<marc@ocebo.com>
+* Copyright (C) 2005-2013	Regis Houssin			<regis.houssin@capnetworks.com>
+* Copyright (C) 2006		Andre Cianfarani		<acianfa@free.fr>
+* Copyright (C) 2010-2013	Juanjo Menent			<jmenent@2byte.es>
+* Copyright (C) 2011		Philippe Grand			<philippe.grand@atoo-net.com>
+* Copyright (C) 2012		Christophe Battarel		<christophe.battarel@altairis.fr>
+* Copyright (C) 2012		Marcos García			<marcosgdf@gmail.com>
+* Copyright (C) 2013		Florian Henry			<florian.henry@open-concept.pro>
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
 
 /**
  *	\file       htdocs/commande/fiche.php
- *	\ingroup    commande
- *	\brief      Page to show customer order
- */
+*	\ingroup    commande
+*	\brief      Page to show customer order
+*/
 
 require '../main.inc.php';
 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
@@ -2135,34 +2135,56 @@ else
 		$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action);    // Note that $action and $object may have been modified by hook
 		if (empty($reshook) && ! empty($extrafields->attribute_label))
 		{
-			if(count($extrafields->attribute_label) > 0) {
+			if ($action == 'edit_extras')
+			{
+				print '<form enctype="multipart/form-data" action="'.$_SERVER["PHP_SELF"].'" method="post" name="formsoc">';
+				print '<input type="hidden" name="action" value="update_extras">';
+				print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
+				print '<input type="hidden" name="id" value="'.$object->id.'">';
+			}
 
-				if ($action == 'edit_extras')
+			foreach($extrafields->attribute_label as $key=>$label)
+			{
+				$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
+				if ($extrafields->attribute_type[$key] == 'separate')
 				{
-					print '<form enctype="multipart/form-data" action="'.$_SERVER["PHP_SELF"].'" method="post" name="formsoc">';
-					print '<input type="hidden" name="action" value="update_extras">';
-					print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
-					print '<input type="hidden" name="id" value="'.$object->id.'">';
+					print $extrafields->showSeparator($key);
 				}
+				else
+				{
+					print '<tr><td';
+					if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
+					print '>'.$label.'</td><td colspan="5">';
+					// Convert date into timestamp format
+					if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
+					{
+						$value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$object->array_options['options_'.$key];
+					}
 
-
-				if ($action == 'edit_extras' &&  $user->rights->propal->creer) {
-					print $object->showOptionals($extrafields,'edit');
-				}
-				else {
-					print $object->showOptionals($extrafields);
+					if ($action == 'edit_extras' && $user->rights->commande->creer)
+					{
+						print $extrafields->showInputField($key,$value);
+					}
+					else
+					{
+						print $extrafields->showOutputField($key,$value);
+					}
+					print '</td></tr>'."\n";
 				}
+			}
+
+			if(count($extrafields->attribute_label) > 0) {
 
-				if ($action == 'edit_extras' && $user->rights->propal->creer)
+				if ($action == 'edit_extras' && $user->rights->commande->creer)
 				{
-					print '<tr><td></td><td>';
+					print '<tr><td></td><td colspan="5">';
 					print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
 					print '</form>';
 					print '</td></tr>';
 
 				}
 				else {
-					if ($object->statut == 0 && $user->rights->propal->creer)
+					if ($object->statut == 0 && $user->rights->commande->creer)
 					{
 						print '<tr><td></td><td><a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit_extras">'.img_picto('','edit').' '.$langs->trans('Modify').'</a></td></tr>';
 					}
@@ -2320,7 +2342,7 @@ else
 					if ($object->statut > 0 && $object->statut < 3 && $object->getNbOfProductsLines() > 0)
 					{
 						if (($conf->expedition_bon->enabled && $user->rights->expedition->creer)
-							|| ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->creer))
+						|| ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->creer))
 						{
 							if ($user->rights->expedition->creer)
 							{
diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php
index e740ea0e387de78c51773da3d438dce2966a14be..01ec205564a1dcf6f4699cc3b2990638e07f4c98 100644
--- a/htdocs/compta/bank/class/account.class.php
+++ b/htdocs/compta/bank/class/account.class.php
@@ -4,6 +4,7 @@
  * Copyright (C) 2004-2012 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copyright (C) 2004      Christophe Combelles <ccomb@free.fr>
  * Copyright (C) 2005-2010 Regis Houssin        <regis.houssin@capnetworks.com>
+ * Copytight (C) 2013	   Florian Henry        <florian.henry@open-concept.pro>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -804,7 +805,7 @@ class Account extends CommonObject
         $sql = "SELECT sum(amount) as amount";
         $sql.= " FROM ".MAIN_DB_PREFIX."bank";
         $sql.= " WHERE fk_account = ".$this->id;
-        if ($option == 1) $sql.= " AND dateo <= ".$this->db->idate(time());
+        if ($option == 1) $sql.= " AND dateo <= '".$this->db->idate(dol_now())."'";
 
         $resql = $this->db->query($sql);
         if ($resql)
diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/bons.php
index 218d8fb95237c20e9511e430b33a11d9da76f9d4..ce33322d03a50e6996a0283cacdd0cbe8c5bd9ec 100644
--- a/htdocs/compta/prelevement/bons.php
+++ b/htdocs/compta/prelevement/bons.php
@@ -24,7 +24,7 @@
  * 	\brief      Page liste des bons de prelevements
  */
 
-require('../../../main.inc.php');
+require('../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
 
diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php
index 5be91cb8044af7b302acc41ddc2a5bbdc885ce12..f9d770111a77090457aa8ff228b0044d6b1ee371 100644
--- a/htdocs/compta/prelevement/create.php
+++ b/htdocs/compta/prelevement/create.php
@@ -24,7 +24,7 @@
  *	\brief      Prelevement creation page
  */
 
-require('../../../main.inc.php');
+require('../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
 require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php
index 4d83076c6009960cf8310003c400a14966e3a4dc..3012a70bd55bda0eb42ffd66f7605c23394ae8a8 100644
--- a/htdocs/compta/prelevement/demandes.php
+++ b/htdocs/compta/prelevement/demandes.php
@@ -24,7 +24,7 @@
  *  \brief      Page to list withdraw requests
  */
 
-require('../../../main.inc.php');
+require('../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/core/modules/modPrelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
 require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php
index 94f96b04f9d9920f3fbaf60a057b89f44017540f..ec8eaa51479774da36a300e6d8447eca6b106f7f 100644
--- a/htdocs/compta/prelevement/factures.php
+++ b/htdocs/compta/prelevement/factures.php
@@ -24,7 +24,7 @@
  *     \brief      Page liste des factures prelevees
  */
 
-require('../../../main.inc.php');
+require('../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/rejetprelevement.class.php';
diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php
index e89a5fa2fcdab1f399d2928c4a0ca830ae0f6438..c77a0ab66825f7f900f39864d599eeb393a20b4d 100644
--- a/htdocs/compta/prelevement/fiche-rejet.php
+++ b/htdocs/compta/prelevement/fiche-rejet.php
@@ -24,7 +24,7 @@
  *		\brief      Withdraw reject
  */
 
-require('../../../main.inc.php');
+require('../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/rejetprelevement.class.php';
diff --git a/htdocs/compta/prelevement/fiche-stat.php b/htdocs/compta/prelevement/fiche-stat.php
index 9cb29ad8d2665a709c77e3e28aa22d67875d0262..161df078aae6184797de3214e122a00605894d20 100644
--- a/htdocs/compta/prelevement/fiche-stat.php
+++ b/htdocs/compta/prelevement/fiche-stat.php
@@ -23,7 +23,7 @@
  *	\brief      Prelevement statistics
  */
 
-require('../../../main.inc.php');
+require('../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php';
diff --git a/htdocs/compta/prelevement/fiche.php b/htdocs/compta/prelevement/fiche.php
index fee2f1ecc24901d5d82bd27dd4bf32dea356398e..a7ebf00c9509a6ce647033ffeafea6f80c6df3e8 100644
--- a/htdocs/compta/prelevement/fiche.php
+++ b/htdocs/compta/prelevement/fiche.php
@@ -23,7 +23,7 @@
  *	\brief      Fiche prelevement
  */
 
-require('../../../main.inc.php');
+require('../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php
index c1d0a0aaa3fe0a298b114bbc3fff48fd6aca16e3..d3823cc130ecad0f99d9b5d20679386ec0a27706 100644
--- a/htdocs/compta/prelevement/index.php
+++ b/htdocs/compta/prelevement/index.php
@@ -3,6 +3,7 @@
  * Copyright (C) 2005-2012 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copyright (C) 2005-2009 Regis Houssin        <regis.houssin@capnetworks.com>
  * Copyright (C) 2011      Juanjo Menent		<jmenent@2byte.es>
+ * Copyright (C) 2013      Florian Henry		<florian.henry@open-concept.pro>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -24,7 +25,8 @@
  *	\brief      Prelevement index page
  */
 
-require('../../../main.inc.php');
+
+require('../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
 require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
diff --git a/htdocs/compta/prelevement/ligne.php b/htdocs/compta/prelevement/ligne.php
index 5f7e17fb6799e914c07db6f06a0fed4f170f8d65..45dc325f5c11807c91fce44a58455beb83e8e7a6 100644
--- a/htdocs/compta/prelevement/ligne.php
+++ b/htdocs/compta/prelevement/ligne.php
@@ -24,7 +24,7 @@
  *	\brief      card of withdraw line
  */
 
-require('../../../main.inc.php');
+require('../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/rejetprelevement.class.php';
diff --git a/htdocs/compta/prelevement/lignes.php b/htdocs/compta/prelevement/lignes.php
index 055574a2c065c06e409c3b6c6c4b9940ab1c1aa1..445f1e667550d96d1f5f2ca969861da8d9712dfb 100644
--- a/htdocs/compta/prelevement/lignes.php
+++ b/htdocs/compta/prelevement/lignes.php
@@ -24,7 +24,7 @@
  *	\brief      Prelevement lines
  */
 
-require('../../../main.inc.php');
+require('../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php';
diff --git a/htdocs/compta/prelevement/liste.php b/htdocs/compta/prelevement/liste.php
index 1410b177ff2feaef3727cefa8553332aa0aae0fc..d3d8634d64afe68b6ff5afdc9a7cfc68bc60821a 100644
--- a/htdocs/compta/prelevement/liste.php
+++ b/htdocs/compta/prelevement/liste.php
@@ -23,7 +23,7 @@
  *      \ingroup    prelevement
  *      \brief      Page liste des prelevements
  */
-require('../../../main.inc.php');
+require('../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
diff --git a/htdocs/compta/prelevement/rejets.php b/htdocs/compta/prelevement/rejets.php
index 274e55084f42e5b97095aa141b7bcb52265c5bc5..27a2ab59f38bbba6547ce7a953b6105f34bbf704 100644
--- a/htdocs/compta/prelevement/rejets.php
+++ b/htdocs/compta/prelevement/rejets.php
@@ -24,7 +24,7 @@
  *      \brief      Reject page
  */
 
-require('../../../main.inc.php');
+require('../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/rejetprelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
diff --git a/htdocs/compta/prelevement/stats.php b/htdocs/compta/prelevement/stats.php
index 419fb7eb3e877b140a7266c85ab1ea114455314d..34ffdb168b5653987c45579c8ae95fecf06765a3 100644
--- a/htdocs/compta/prelevement/stats.php
+++ b/htdocs/compta/prelevement/stats.php
@@ -24,7 +24,7 @@
  *      \brief      Page de stats des prelevements
  */
 
-require('../../../main.inc.php');
+require('../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
 
diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php
index 64d80dbdbf25bd4b84d09192a472f6813861fa70..e956f40a3e31514d98d8c132b7cadd98c0545ba7 100644
--- a/htdocs/contact/class/contact.class.php
+++ b/htdocs/contact/class/contact.class.php
@@ -242,12 +242,12 @@ class Contact extends CommonObject
 		$sql .= ", poste='".$this->db->escape($this->poste)."'";
 		$sql .= ", fax='".$this->db->escape($this->fax)."'";
 		$sql .= ", email='".$this->db->escape($this->email)."'";
-		$sql .= ", note_private='".$this->db->escape($this->note_private)."'";
-		$sql .= ", note_public='".$this->db->escape($this->note_public)."'";
-		$sql .= ", phone = '".$this->db->escape($this->phone_pro)."'";
-		$sql .= ", phone_perso = '".$this->db->escape($this->phone_perso)."'";
-		$sql .= ", phone_mobile = '".$this->db->escape($this->phone_mobile)."'";
-		$sql .= ", jabberid = '".$this->db->escape($this->jabberid)."'";
+		$sql .= ", note_private = ".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null");
+		$sql .= ", note_public = ".(isset($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null");
+		$sql .= ", phone = ".(isset($this->phone_pro)?"'".$this->db->escape($this->phone_pro)."'":"null");
+		$sql .= ", phone_perso = ".(isset($this->phone_perso)?"'".$this->db->escape($this->phone_perso)."'":"null");
+		$sql .= ", phone_mobile = ".(isset($this->phone_mobile)?"'".$this->db->escape($this->phone_mobile)."'":"null");
+		$sql .= ", jabberid = ".(isset($this->jabberid)?"'".$this->db->escape($this->jabberid)."'":"null");
 		$sql .= ", priv = '".$this->priv."'";
 		$sql .= ", fk_user_modif=".($user->id > 0 ? "'".$user->id."'":"NULL");
 		$sql .= ", default_lang=".($this->default_lang?"'".$this->default_lang."'":"NULL");
diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php
index 505992341dea5f6108a6eee7dee2e915482677c3..aa7923926e0493b138c434d029a6cb2e6a371c8e 100755
--- a/htdocs/contact/list.php
+++ b/htdocs/contact/list.php
@@ -262,7 +262,7 @@ if ($result)
     print_liste_field_titre($langs->trans("PostOrFunction"),$_SERVER["PHP_SELF"],"p.poste", $begin, $param, '', $sortfield,$sortorder);
     if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom", $begin, $param, '', $sortfield,$sortorder);
     print_liste_field_titre($langs->trans("Phone"),$_SERVER["PHP_SELF"],"p.phone", $begin, $param, '', $sortfield,$sortorder);
-    print_liste_field_titre($langs->trans("Mobile"),$_SERVER["PHP_SELF"],"p.phone_mob", $begin, $param, '', $sortfield,$sortorder);
+    print_liste_field_titre($langs->trans("PhoneMobile"),$_SERVER["PHP_SELF"],"p.phone_mob", $begin, $param, '', $sortfield,$sortorder);
     print_liste_field_titre($langs->trans("Fax"),$_SERVER["PHP_SELF"],"p.fax", $begin, $param, '', $sortfield,$sortorder);
     print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"p.email", $begin, $param, '', $sortfield,$sortorder);
     print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"p.tms", $begin, $param, 'align="center"', $sortfield,$sortorder);
diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php
index c4f65889fbea175f0a5bb6c5142dbe1ccafaba49..a7a8fe049031aabddd5ac08b9f57286bc5ed5f1e 100644
--- a/htdocs/core/class/conf.class.php
+++ b/htdocs/core/class/conf.class.php
@@ -400,7 +400,7 @@ class Conf
 		$this->maxfilesize = (empty($this->global->MAIN_UPLOAD_DOC) ? 0 : $this->global->MAIN_UPLOAD_DOC * 1024);
 
 		// Define list of limited modules
-		if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='facture,commande,fournisseur,contact,propal,projet,contrat,societe,ficheinter,expedition,agenda';	// '' means 'all'. Note that contact is added here as it should be a module later.
+		if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,facture,commande,fournisseur,contact,propal,projet,contrat,societe,ficheinter,expedition,agenda';	// '' means 'all'. Note that contact is added here as it should be a module later.
 
 		// Timeouts
         if (empty($this->global->MAIN_USE_CONNECT_TIMEOUT)) $this->global->MAIN_USE_CONNECT_TIMEOUT=10;
diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php
index c87f2df36dd627ff18110c135ca7a07cd7e0082a..c3157c071247e272578aa95a736af9017b2fe859 100644
--- a/htdocs/core/class/html.formother.class.php
+++ b/htdocs/core/class/html.formother.class.php
@@ -1004,11 +1004,13 @@ class FormOther
                 }
             }
 
-            $emptybox->box_id='A';
-            $emptybox->info_box_head=array();
-            $emptybox->info_box_contents=array();
-            $emptybox->showBox(array(),array());
-
+            if (empty($conf->browser->phone))
+            {	
+            	$emptybox->box_id='A';
+            	$emptybox->info_box_head=array();
+            	$emptybox->info_box_contents=array();
+            	$emptybox->showBox(array(),array());
+            }
             print "</div>\n";
             print "<!-- End box container -->\n";
 
@@ -1033,11 +1035,13 @@ class FormOther
                 }
             }
 
-            $emptybox->box_id='B';
-            $emptybox->info_box_head=array();
-            $emptybox->info_box_contents=array();
-            $emptybox->showBox(array(),array());
-
+            if (empty($conf->browser->phone))
+            {	
+            	$emptybox->box_id='B';
+            	$emptybox->info_box_head=array();
+            	$emptybox->info_box_contents=array();
+            	$emptybox->showBox(array(),array());
+            }
             print "</div>\n";
             print "<!-- End box container -->\n";
 
diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php
index 0d4bbcf6d7a15d3faf9c4520ecf650e26f805710..434ffc7d7fba74ab46a2b62f202bab3506f17579 100644
--- a/htdocs/core/lib/admin.lib.php
+++ b/htdocs/core/lib/admin.lib.php
@@ -1001,20 +1001,22 @@ function complete_dictionnary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsq
  *	Show array with constants to edit
  *
  *	@param	array	$tableau		Array of constants
+ *	@param	int		$strictw3c		Respect W3C (no form into table)
  *	@return	void
  */
-function form_constantes($tableau)
+function form_constantes($tableau,$strictw3c=0)
 {
     global $db,$bc,$langs,$conf,$_Avery_Labels;
 
     $form = new Form($db);
 
+    if (! empty($strictw3c)) print "\n".'<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
+    	
     print '<table class="noborder" width="100%">';
     print '<tr class="liste_titre">';
     print '<td>'.$langs->trans("Description").'</td>';
     print '<td>'.$langs->trans("Value").'*</td>';
-    print '<td>&nbsp;</td>';
-    print '<td align="center" width="80">'.$langs->trans("Action").'</td>';
+    if (empty($strictw3c)) print '<td align="center" width="80">'.$langs->trans("Action").'</td>';
     print "</tr>\n";
     $var=true;
 
@@ -1044,17 +1046,17 @@ function form_constantes($tableau)
             	$obj = (object) array('rowid'=>'','name'=>'','value'=>'','type'=>'','note'=>'');
             }
 
-            print "\n".'<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
+            if (empty($strictw3c)) print "\n".'<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
 
             print "<tr ".$bc[$var].">";
 
-            // Affiche nom constante
+            // Show constant
             print '<td>';
             print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
             print '<input type="hidden" name="action" value="update">';
-            print '<input type="hidden" name="rowid" value="'.$obj->rowid.'">';
-            print '<input type="hidden" name="constname" value="'.$const.'">';
-            print '<input type="hidden" name="constnote" value="'.nl2br(dol_escape_htmltag($obj->note)).'">';
+            print '<input type="hidden" name="rowid'.(empty($strictw3c)?'':'[]').'" value="'.$obj->rowid.'">';
+            print '<input type="hidden" name="constname'.(empty($strictw3c)?'':'[]').'" value="'.$const.'">';
+            print '<input type="hidden" name="constnote'.(empty($strictw3c)?'':'[]').'" value="'.nl2br(dol_escape_htmltag($obj->note)).'">';
 
             print $langs->trans('Desc'.$const);
 
@@ -1077,6 +1079,7 @@ function form_constantes($tableau)
 
             print "</td>\n";
 
+            // Value
             if ($const == 'ADHERENT_CARD_TYPE' || $const == 'ADHERENT_ETIQUETTE_TYPE')
             {
                 print '<td>';
@@ -1087,55 +1090,57 @@ function form_constantes($tableau)
                 {
                     $arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name'];
                 }
-                print $form->selectarray('constvalue',$arrayoflabels,($obj->value?$obj->value:'CARD'),1,0,0);
-                print '</td><td>';
+                print $form->selectarray('constvalue'.(empty($strictw3c)?'':'[]'),$arrayoflabels,($obj->value?$obj->value:'CARD'),1,0,0);
                 print '<input type="hidden" name="consttype" value="yesno">';
                 print '</td>';
             }
             else
             {
                 print '<td>';
-                //print 'aa'.$const;
                 if (in_array($const,array('ADHERENT_CARD_TEXT','ADHERENT_CARD_TEXT_RIGHT','ADHERENT_ETIQUETTE_TEXT')))
                 {
-                    print '<textarea class="flat" name="constvalue" cols="50" rows="5" wrap="soft">'."\n";
+                    print '<textarea class="flat" name="constvalue'.(empty($strictw3c)?'':'[]').'" cols="50" rows="5" wrap="soft">'."\n";
                     print $obj->value;
                     print "</textarea>\n";
-                    print '</td><td>';
                     print '<input type="hidden" name="consttype" value="texte">';
                 }
                 else if (in_array($const,array('ADHERENT_AUTOREGISTER_NOTIF_MAIL','ADHERENT_AUTOREGISTER_MAIL','ADHERENT_MAIL_VALID','ADHERENT_MAIL_COTIS','ADHERENT_MAIL_RESIL')))
                 {
                     require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
-                    $doleditor=new DolEditor('constvalue_'.$const,$obj->value,'',160,'dolibarr_notes','',false,false,$conf->fckeditor->enabled,5,60);
+                    $doleditor=new DolEditor('constvalue_'.$const.(empty($strictw3c)?'':'[]'),$obj->value,'',160,'dolibarr_notes','',false,false,$conf->fckeditor->enabled,5,60);
                     $doleditor->Create();
-
-                    print '</td><td>';
-                    print '<input type="hidden" name="consttype" value="texte">';
+                    print '<input type="hidden" name="consttype'.(empty($strictw3c)?'':'[]').'" value="texte">';
                 }
                 else if ($obj->type == 'yesno')
                 {
-                    print $form->selectyesno('constvalue',$obj->value,1);
-                    print '</td><td>';
-                    print '<input type="hidden" name="consttype" value="yesno">';
+                    print $form->selectyesno('constvalue'.(empty($strictw3c)?'':'[]'),$obj->value,1);
+                    print '<input type="hidden" name="consttype'.(empty($strictw3c)?'':'[]').'" value="yesno">';
                 }
                 else
                 {
-                    print '<input type="text" class="flat" size="48" name="constvalue" value="'.dol_escape_htmltag($obj->value).'">';
-                    print '</td><td>';
-                    print '<input type="hidden" name="consttype" value="chaine">';
+                    print '<input type="text" class="flat" size="48" name="constvalue'.(empty($strictw3c)?'':'[]').'" value="'.dol_escape_htmltag($obj->value).'">';
+                    print '<input type="hidden" name="consttype'.(empty($strictw3c)?'':'[]').'" value="chaine">';
                 }
                 print '</td>';
             }
-            print '<td align="center">';
-            print '<input type="submit" class="button" value="'.$langs->trans("Update").'" name="Button"> &nbsp;';
-            // print '<a href="adherent.php?name='.$const.'&action=unset">'.img_delete().'</a>';
-            print "</td>";
-            print "</tr>\n";
-            print "</form>\n";
+            // Submit
+            if (empty($strictw3c))
+            {
+            	print '<td align="center">';
+            	print '<input type="submit" class="button" value="'.$langs->trans("Update").'" name="Button">';
+	            print "</td>";
+            }    
+    	    print "</tr>\n";
+            if (empty($strictw3c)) print "</form>\n";
         }
     }
     print '</table>';
+
+    if (! empty($strictw3c)) 
+    {
+    	print '<div align="center"><input type="submit" class="button" value="'.$langs->trans("Update").'" name="update"></div>';
+    	print "</form>\n";
+    }
 }
 
 
diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php
index 2e2d764b8610a0264fa73216ea8027998ad7539b..f7b189a5c9a75e1767cf3b586c83439cbc979825 100644
--- a/htdocs/core/lib/agenda.lib.php
+++ b/htdocs/core/lib/agenda.lib.php
@@ -184,13 +184,12 @@ function show_array_actions_to_do($max=5)
 	$sql = "SELECT a.id, a.label, a.datep as dp, a.datep2 as dp2, a.fk_user_author, a.percent,";
 	$sql.= " c.code, c.libelle,";
 	$sql.= " s.nom as sname, s.rowid, s.client";
-	$sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c,";
-	$sql.= " ".MAIN_DB_PREFIX."actioncomm as a";
+	$sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c LEFT JOIN ";
+	$sql.= " ".MAIN_DB_PREFIX."actioncomm as a ON c.id = a.fk_action";
+    $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
 	if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
 	$sql.= ")";
-    $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
-	$sql.= " WHERE c.id = a.fk_action";
-	$sql.= " AND a.entity = ".$conf->entity;
+	$sql.= " WHERE a.entity = ".$conf->entity;
     $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))";
 	if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
 	if ($socid) $sql.= " AND s.rowid = ".$socid;
@@ -283,13 +282,12 @@ function show_array_last_actions_done($max=5)
 	$sql = "SELECT a.id, a.percent, a.datep as da, a.datep2 as da2, a.fk_user_author, a.label,";
 	$sql.= " c.code, c.libelle,";
 	$sql.= " s.rowid, s.nom as sname, s.client";
-	$sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c,";
-	$sql.= " ".MAIN_DB_PREFIX."actioncomm as a";
+	$sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c LEFT JOIN ";
+	$sql.= " ".MAIN_DB_PREFIX."actioncomm as a ON c.id = a.fk_action ";
+    $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
 	if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
 	$sql.=")";
-    $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
-	$sql.= " WHERE c.id = a.fk_action";
-	$sql.= " AND a.entity = ".$conf->entity;
+	$sql.= " WHERE a.entity = ".$conf->entity;
     $sql.= " AND (a.percent >= 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))";
 	if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
     if ($socid) $sql.= " AND s.rowid = ".$socid;
@@ -473,4 +471,4 @@ function calendars_prepare_head($param)
     return $head;
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/htdocs/core/lib/barcode.lib.php b/htdocs/core/lib/barcode.lib.php
index f83ea5f433c31a9a65b694560b3d6a92e6796210..67b51748d3e6801e9d7320978ca9fc2ab00c8a37 100644
--- a/htdocs/core/lib/barcode.lib.php
+++ b/htdocs/core/lib/barcode.lib.php
@@ -74,11 +74,11 @@ function barcode_print($code, $encoding="ANY", $scale = 2 ,$mode = "png")
     dol_syslog("barcode.lib.php::barcode_print $code $encoding $scale $mode");
 
     $bars=barcode_encode($code,$encoding);
-
-    if (! $bars)
+    if (! $bars || ! empty($bars['error']))
     {
         // DOLCHANGE LDR Return error message instead of array
-        $error='Bad Value '.$code.' for encoding '.$encoding;
+        if (empty($bars['error'])) $error='Bad Value '.$code.' for encoding '.$encoding;
+        else $error=$bars['error'];
         dol_syslog('barcode.lib.php::barcode_print '.$error, LOG_ERR);
         return $error;
     }
@@ -133,7 +133,7 @@ function barcode_encode($code,$encoding)
         dol_syslog("barcode.lib.php::barcode_encode Use barcode_encode_ean");
         $bars=barcode_encode_ean($code, $encoding);
     }
-    else if (file_exists($genbarcode_loc))
+    else if (file_exists($genbarcode_loc))	// For example C39
     {
         /* use genbarcode */
         dol_syslog("barcode.lib.php::barcode_encode Use genbarcode ".$genbarcode_loc." code=".$code." encoding=".$encoding);
@@ -252,10 +252,11 @@ function barcode_encode_genbarcode($code,$encoding)
     $code=preg_replace("/[\\\|]/", "_", $code);
 
     $command=escapeshellarg($genbarcode_loc);
-    $paramclear=" \"".str_replace("\"", "\\\"",$code)."\" \"".str_replace("\"", "\\\"",strtoupper($encoding))."\"";
-
+    //$paramclear=" \"".str_replace("\"", "\\\"",$code)."\" \"".str_replace("\"", "\\\"",strtoupper($encoding))."\"";
+    $paramclear=" ".escapeshellarg($code)." ".escapeshellarg(strtoupper($encoding));
+    
     $fullcommandclear=$command." ".$paramclear." 2>&1";
-    //print $fullcommandclear."<br>\n";
+    //print $fullcommandclear."<br>\n";exit;
 
     dol_syslog("Run command ".$fullcommandclear);
     $fp=popen($fullcommandclear, "r");
@@ -273,14 +274,20 @@ function barcode_encode_genbarcode($code,$encoding)
     }
     //var_dump($bars);
     $ret=array(
-		"encoding" => trim($encoding),
 		"bars" => trim($bars),
-		"text" => trim($text)
+		"text" => trim($text),
+		"encoding" => trim($encoding),
+    	"error" => ""
     );
     //var_dump($ret);
-    if (!$ret['encoding']) return false;
+    if (preg_match('/permission denied/i',$ret['bars'])) 
+    { 
+    	$ret['error']=$ret['bars']; $ret['bars']='';
+    	return $ret;
+    }
     if (!$ret['bars']) return false;
     if (!$ret['text']) return false;
+    if (!$ret['encoding']) return false;
     return $ret;
 }
 
diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php
index 83af9f60871317a328000d496ba5c06b9520b398..cad4d4c3d522cde7e38953ff69144d5556d8c18b 100644
--- a/htdocs/core/lib/files.lib.php
+++ b/htdocs/core/lib/files.lib.php
@@ -1244,7 +1244,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity)
 
 	if (empty($modulepart)) return 'ErrorBadParameter';
 	if (empty($entity)) $entity=0;
-
+	dol_syslog('$modulepart='.$modulepart.' $original_file= '.$original_file);
 	// We define $accessallowed and $sqlprotectagainstexternals
 	$accessallowed=0;
 	$sqlprotectagainstexternals='';
@@ -1364,9 +1364,12 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity)
 	}
 	// Wrapping pour les prelevements
 	elseif ($modulepart == 'prelevement')
-	{
-		if ($user->rights->prelevement->bons->lire) $accessallowed=1;
-		$original_file=$conf->prelevement->dir_output.'/receipts/'.$original_file;
+	{
+		if ($user->rights->prelevement->bons->lire || preg_match('/^specimen/i',$original_file))
+		{
+			$accessallowed=1;
+		}
+		$original_file=$conf->prelevement->dir_output.'/'.$original_file;
 	}
 	// Wrapping pour les graph energie
 	elseif ($modulepart == 'graph_stock')
@@ -1466,17 +1469,6 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity)
 		$original_file=$conf->deplacement->dir_output.'/'.$original_file;
 		//$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$refname."' AND entity=".$conf->entity;
 	}
-
-	// Wrapping pour les prelevements
-	else if ($modulepart == 'prelevement')
-	{
-		if ($user->rights->prelevement->bons->lire || preg_match('/^specimen/i',$original_file))
-		{
-			$accessallowed=1;
-		}
-		$original_file=$conf->prelevement->dir_output.'/'.$original_file;
-	}
-
 	// Wrapping pour les propales
 	else if ($modulepart == 'propal')
 	{
@@ -1767,7 +1759,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity)
 			eval('$sqlprotectagainstexternals = "'.$conf->global->$sqlProtectConstName.'";');
 		}
 	}
-
+	
 	$ret = array(
 		'accessallowed' => $accessallowed,
 		'sqlprotectagainstexternals'=>$sqlprotectagainstexternals,
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 784762907d30d30cbc7211c6adb20491fc615aef..2fc960428951600690d31ce80f7fe01946f5ee4f 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -2194,10 +2194,10 @@ function dol_print_error($db='',$error='')
 			$out.="<b>".$langs->trans("PHP").":</b> ".phpversion()."<br>\n";
 			//phpinfo();       // This is to show location of php.ini file
 		}
-		$out.="<b>".$langs->trans("Server").":</b> ".$_SERVER["SERVER_SOFTWARE"]."<br>\n";;
+		$out.="<b>".$langs->trans("Server").":</b> ".$_SERVER["SERVER_SOFTWARE"]."<br>\n";
 		$out.="<br>\n";
-		$out.="<b>".$langs->trans("RequestedUrl").":</b> ".$_SERVER["REQUEST_URI"]."<br>\n";;
-		$out.="<b>".$langs->trans("Referer").":</b> ".(isset($_SERVER["HTTP_REFERER"])?$_SERVER["HTTP_REFERER"]:'')."<br>\n";;
+		$out.="<b>".$langs->trans("RequestedUrl").":</b> ".dol_htmlentities($_SERVER["REQUEST_URI"],ENT_COMPAT,'UTF-8')."<br>\n";
+		$out.="<b>".$langs->trans("Referer").":</b> ".(isset($_SERVER["HTTP_REFERER"])?dol_htmlentities($_SERVER["HTTP_REFERER"],ENT_COMPAT,'UTF-8'):'')."<br>\n";
 		$out.="<b>".$langs->trans("MenuManager").":</b> ".(isset($conf->standard_menu)?$conf->standard_menu:'')."<br>\n";
 		$out.="<br>\n";
 		$syslog.="url=".$_SERVER["REQUEST_URI"];
diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php
index 76323b4eb404ddef8c2afc11b333a9e9ddce5f03..3a8bd016e210f0701d47e1da29db8eccdffe4dc8 100644
--- a/htdocs/core/lib/project.lib.php
+++ b/htdocs/core/lib/project.lib.php
@@ -721,7 +721,7 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0)
 	print '<table class="noborder" width="100%">';
 	print '<tr class="liste_titre">';
 	print_liste_field_titre($langs->trans("Project"),"index.php","","","","",$sortfield,$sortorder);
-	print_liste_field_titre($langs->trans("NbOpenTasks"),"","","","",'align="right"',$sortfield,$sortorder);
+	print_liste_field_titre($langs->trans("Tasks"),"","","","",'align="right"',$sortfield,$sortorder);
 	print_liste_field_titre($langs->trans("Status"),"","","","",'align="right"',$sortfield,$sortorder);
 	print "</tr>\n";
 
@@ -775,7 +775,7 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0)
 				print '<td class="nowrap">';
 				$projectstatic->ref=$objp->ref;
 				print $projectstatic->getNomUrl(1);
-				print ' - '.$objp->title.'</td>';
+				print ' - '.dol_trunc($objp->title,24).'</td>';
 				print '<td align="right">'.$objp->nb.'</td>';
 				$projectstatic->statut = $objp->fk_statut;
 				print '<td align="right">'.$projectstatic->getLibStatut(3).'</td>';
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index 17d6189e1b0fe1007f187536ce9140963ad97a35..3bcbe1a3bbac0a3fd9b08ca5355cce1c0267d8c6 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -484,16 +484,16 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
 					if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY))
 					{
 						$langs->load("errors");
-						$warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete"));
+						$warnpicto =' '.img_warning($langs->trans("WarningMandatorySetupNotComplete"));
 					}
-					$newmenu->add("/admin/company.php?mainmenu=home", $langs->trans("MenuCompanySetup").' '.$warnpicto,1);
+					$newmenu->add("/admin/company.php?mainmenu=home", $langs->trans("MenuCompanySetup").$warnpicto,1);
 					$warnpicto='';
 					if (count($conf->modules) <= 1)	// If only user module enabled
 					{
 						$langs->load("errors");
-						$warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete"));
+						$warnpicto = ' '.img_warning($langs->trans("WarningMandatorySetupNotComplete"));
 					}
-					$newmenu->add("/admin/modules.php?mainmenu=home", $langs->trans("Modules").' '.$warnpicto,1);
+					$newmenu->add("/admin/modules.php?mainmenu=home", $langs->trans("Modules").$warnpicto,1);
 					$newmenu->add("/admin/menus.php?mainmenu=home", $langs->trans("Menus"),1);
 					$newmenu->add("/admin/ihm.php?mainmenu=home", $langs->trans("GUISetup"),1);
 					if (! in_array($langs->defaultlang,array('en_US','en_GB','en_NZ','en_AU','fr_FR','fr_BE','es_ES','ca_ES')))
@@ -1387,4 +1387,4 @@ function dol_eldy_showmenu($type_user, &$menuentry, &$listofmodulesforexternal)
 	return 1;
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php
index f79ff5766b0a55894b9cf787ef128b02668ee981..794ebda1428c49a5da291de99821825f61855eeb 100644
--- a/htdocs/core/modules/DolibarrModules.class.php
+++ b/htdocs/core/modules/DolibarrModules.class.php
@@ -919,7 +919,9 @@ abstract class DolibarrModules
                                 dol_syslog(get_class($this)."::insert_permissions Add permission to user id=".$obj2->rowid);
                                 $tmpuser=new User($this->db);
                                 $tmpuser->fetch($obj2->rowid);
-                                $tmpuser->addrights($r_id);
+                                if (!empty($tmpuser->id)) {
+                                	$tmpuser->addrights($r_id);
+                                }
                                 $i++;
                             }
                             if (! empty($user->admin))  // Reload permission for current user if defined
diff --git a/htdocs/core/modules/syslog/mod_syslog_file.php b/htdocs/core/modules/syslog/mod_syslog_file.php
index e6bbefb7295367ac1e65bc830e6367c10e5b0cce..e98bb96b8eb23087fdc9ffd86798c29d3337a7aa 100644
--- a/htdocs/core/modules/syslog/mod_syslog_file.php
+++ b/htdocs/core/modules/syslog/mod_syslog_file.php
@@ -147,7 +147,7 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
 
 			fwrite($filefd, $message."\n");
 			fclose($filefd);
-			@chmod($logfile, octdec($conf->global->MAIN_UMASK));
+			@chmod($logfile, octdec(empty($conf->global->MAIN_UMASK)?'0664':$conf->global->MAIN_UMASK));
 		}
 	}
 }
diff --git a/htdocs/core/search_page.php b/htdocs/core/search_page.php
index cf44cccce2b72c982e4dbcc354acae9706ef0ff5..1ea6138873ec0eb890709845aaf089a4fcc0bde1 100644
--- a/htdocs/core/search_page.php
+++ b/htdocs/core/search_page.php
@@ -102,7 +102,7 @@ else $searchform=$hookmanager->resPrint;
 
 print "\n";
 print "<!-- Begin SearchForm -->\n";
-print '<div class="center" data-role="page">';
+print '<div class="center" data-role="page" style="padding-left: 2px;">';
 print '<style>.menu_titre { padding-top: 6px; }</style>';
 //print '<div id="distance"></div><div id="container" class="center">';
 print '<div id="blockvmenusearch">'."\n";
diff --git a/htdocs/core/tpl/freeproductline_create.tpl.php b/htdocs/core/tpl/freeproductline_create.tpl.php
index ad0b0eeb426c395572c140c0f661f52b5fa451d0..328b8d9a69b1036daf595e1451231ab38bccda14 100644
--- a/htdocs/core/tpl/freeproductline_create.tpl.php
+++ b/htdocs/core/tpl/freeproductline_create.tpl.php
@@ -30,6 +30,13 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob
 ?>
 
 <!-- BEGIN PHP TEMPLATE freeproductline_create.tpl.php -->
+
+<form name="addproduct" id="addproduct"	action="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id; ?>#add" method="POST">
+<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
+<input type="hidden" name="action" value="addline">
+<input type="hidden" name="mode" value="libre">
+<input type="hidden" name="id" value="<?php echo $this->id; ?>">
+
 <tr class="liste_titre nodrag nodrop">
 	<td
 	<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>><div
@@ -60,15 +67,9 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob
 	<td colspan="<?php echo $colspan; ?>">&nbsp;</td>
 </tr>
 
-<form name="addproduct" id="addproduct"	action="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id; ?>#add" method="POST">
-<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
-<input type="hidden" name="action" value="addline">
-<input type="hidden" name="mode" value="libre">
-<input type="hidden" name="id" value="<?php echo $this->id; ?>">
-
-	<tr <?php echo $bcnd[$var]; ?>>
-		<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
-			<?php
+<tr <?php echo $bcnd[$var]; ?>>
+	<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
+		<?php
 
 			echo '<span>';
 			echo $form->select_type_of_lines(isset($_POST["type"])?$_POST["type"]:-1,'type',1);
@@ -90,66 +91,69 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob
 			$doleditor=new DolEditor('dp_desc',GETPOST('dp_desc'),'',100,'dolibarr_details','',false,true,$enabled,$nbrows,70);
 			$doleditor->Create();
 			?>
-		</td>
+	</td>
 
-		<td align="right"><?php
-		if ($seller->tva_assuj == "0") echo '<input type="hidden" name="np_tva_tx" value="0">0';
-		else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"])?$_POST["tva_tx"]:-1), $seller, $buyer);
+	<td align="right"><?php
+	if ($seller->tva_assuj == "0") echo '<input type="hidden" name="np_tva_tx" value="0">0';
+	else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"])?$_POST["tva_tx"]:-1), $seller, $buyer);
+	?>
+	</td>
+	<td align="right"><input type="text" size="5" name="price_ht" class="flat" value="<?php echo (isset($_POST["price_ht"])?$_POST["price_ht"]:''); ?>">
+	</td>
+	<td align="right"><input type="text" size="2" name="qty" class="flat" value="<?php echo (isset($_POST["qty"])?$_POST["qty"]:1); ?>"></td>
+	<td align="right" class="nowrap"><input type="text" size="1" class="flat" value="<?php echo $buyer->remise_client; ?>" name="remise_percent"><span class="hideonsmartphone">%</span></td>
+	<?php
+	$colspan = 4;
+	if (! empty($usemargins))
+	{
 		?>
+		<td align="right"><input type="text" size="5" name="buying_price" class="flat"
+			value="<?php echo (isset($_POST["buying_price"])?$_POST["buying_price"]:''); ?>">
 		</td>
-		<td align="right"><input type="text" size="5" name="price_ht" value="<?php echo (isset($_POST["price_ht"])?$_POST["price_ht"]:''); ?>">
-		</td>
-		<td align="right"><input type="text" size="2" name="qty" value="<?php echo (isset($_POST["qty"])?$_POST["qty"]:1); ?>"></td>
-		<td align="right" class="nowrap"><input type="text" size="1" value="<?php echo $buyer->remise_client; ?>" name="remise_percent"><span class="hideonsmartphone">%</span></td>
 		<?php
-		$colspan = 4;
-		if (! empty($usemargins))
-		{
-			?>
-			<td align="right"><input type="text" size="5" name="buying_price"
-				value="<?php echo (isset($_POST["buying_price"])?$_POST["buying_price"]:''); ?>">
-			</td>
-			<?php
-			if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
-			if (! empty($conf->global->DISPLAY_MARK_RATES))   $colspan++;
-		}
-		?>
-		<td align="center" valign="middle" colspan="<?php echo $colspan; ?>"><input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline"></td>
-	</tr>
+		if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
+		if (! empty($conf->global->DISPLAY_MARK_RATES))   $colspan++;
+	}
+	?>
+	<td align="center" valign="middle" colspan="<?php echo $colspan; ?>"><input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline"></td>
+</tr>
+
+<?php 
+if (! empty($conf->service->enabled) && $dateSelector) 
+{
+	if(! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) $colspan = 10;
+	else $colspan = 9;
+	
+	if (! empty($usemargins)) 
+	{
+		$colspan++; // For the buying price
+		if($conf->global->DISPLAY_MARGIN_RATES)	$colspan++;
+		if($conf->global->DISPLAY_MARK_RATES)	$colspan++;
+	}
+?>
 
-	<?php 
-	if (! empty($conf->service->enabled) && $dateSelector) 
+<tr <?php echo $bcnd[$var]; ?>>
+	<td colspan="<?php echo $colspan; ?>"><?php
+	if (! empty($object->element) && $object->element == 'contrat')
 	{
-		if(! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) $colspan = 10;
-		else $colspan = 9;
-		
-		if (! empty($usemargins)) 
-		{
-			$colspan++; // For the buying price
-			if($conf->global->DISPLAY_MARGIN_RATES)	$colspan++;
-			if($conf->global->DISPLAY_MARK_RATES)	$colspan++;
-		}
+		print $langs->trans("DateStartPlanned").' ';
+		$form->select_date('',"date_start_sl",$usehm,$usehm,1,"addline_sl");
+		print ' &nbsp; '.$langs->trans("DateEndPlanned").' ';
+		$form->select_date('',"date_end_sl",$usehm,$usehm,1,"addline_sl");
+	}
+	else
+	{			
+		echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
+		echo $form->select_date('','date_start',empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,1,"addproduct");
+		echo ' '.$langs->trans('to').' ';
+		echo $form->select_date('','date_end',empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,1,"addproduct");
+	}
 	?>
-	<tr <?php echo $bcnd[$var]; ?>>
-		<td colspan="<?php echo $colspan; ?>"><?php
-		if (! empty($object->element) && $object->element == 'contrat')
-		{
-			print $langs->trans("DateStartPlanned").' ';
-			$form->select_date('',"date_start_sl",$usehm,$usehm,1,"addline_sl");
-			print ' &nbsp; '.$langs->trans("DateEndPlanned").' ';
-			$form->select_date('',"date_end_sl",$usehm,$usehm,1,"addline_sl");
-		}
-		else
-		{			
-			echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
-			echo $form->select_date('','date_start',empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,1,"addproduct");
-			echo ' '.$langs->trans('to').' ';
-			echo $form->select_date('','date_end',empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,1,"addproduct");
-		}
-		?>
-		</td>
-	</tr>
-	<?php } ?>
+	</td>
+</tr>
+<?php 
+}
+?>
 
 </form>
 <!-- END PHP TEMPLATE freeproductline_create.tpl.php -->
\ No newline at end of file
diff --git a/htdocs/core/tpl/predefinedproductline_create.tpl.php b/htdocs/core/tpl/predefinedproductline_create.tpl.php
index ae8491784e6b91a39e04d571d9a3251e46f41adf..b435d40be644eb9c9a465cea2c535049f5c4ae19 100644
--- a/htdocs/core/tpl/predefinedproductline_create.tpl.php
+++ b/htdocs/core/tpl/predefinedproductline_create.tpl.php
@@ -32,6 +32,21 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob
 
 <!-- BEGIN PHP TEMPLATE predefinedproductline_create.tpl.php -->
 
+<form name="addpredefinedproduct" id="addpredefinedproduct" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id; ?>#add" method="POST">
+<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
+<input type="hidden" name="action" value="addline">
+<input type="hidden" name="mode" value="predefined">
+<input type="hidden" name="id" value="<?php echo $this->id; ?>">
+
+<script type="text/javascript">
+jQuery(document).ready(function() {
+	jQuery('#idprod').change(function() {
+		  if (jQuery('#idprod').val() > 0) jQuery('#np_desc').focus();
+	});
+});
+</script>
+
+
 <tr class="liste_titre nodrag nodrop">
 	<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="4"' : ' colspan="3"'); ?>>
 	<?php
@@ -64,20 +79,6 @@ if (! empty($usemargins))
 	<td colspan="<?php echo $colspan; ?>">&nbsp;</td>
 </tr>
 
-<form name="addpredefinedproduct" id="addpredefinedproduct" action="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id; ?>#add" method="POST">
-<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
-<input type="hidden" name="action" value="addline">
-<input type="hidden" name="mode" value="predefined">
-<input type="hidden" name="id" value="<?php echo $this->id; ?>">
-
-<script type="text/javascript">
-jQuery(document).ready(function() {
-	jQuery('#idprod').change(function() {
-		  if (jQuery('#idprod').val() > 0) jQuery('#np_desc').focus();
-	});
-});
-</script>
-
 <tr <?php echo $bcnd[$var]; ?>>
 	<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="4"' : ' colspan="3"'); ?>>
 	<?php
@@ -105,8 +106,8 @@ jQuery(document).ready(function() {
 	$doleditor->Create();
 	?>
 	</td>
-	<td align="right"><input type="text" size="2" name="qty" value="1"></td>
-	<td align="right" nowrap><input type="text" size="1" name="remise_percent" value="<?php echo $buyer->remise_client; ?>"><span class="hideonsmartphone">%</span></td>
+	<td align="right"><input type="text" size="2" name="qty" class="flat" value="1"></td>
+	<td align="right" nowrap><input type="text" size="1" class="flat" name="remise_percent" value="<?php echo $buyer->remise_client; ?>"><span class="hideonsmartphone">%</span></td>
 	<?php
 	$colspan = 4;
 	if (! empty($usemargins)) 
@@ -115,8 +116,8 @@ jQuery(document).ready(function() {
 		if (! empty($conf->global->DISPLAY_MARK_RATES))   $colspan++;
 		?>
 		<td align="right">
-			<select id="fournprice" name="fournprice" style="display: none;"></select>
-			<input type="text" size="5" id="buying_price" name="buying_price" value="<?php echo (isset($_POST["buying_price"])?$_POST["buying_price"]:''); ?>">
+			<select id="fournprice" name="fournprice" class="flat" style="display: none;"></select>
+			<input type="text" size="5" id="buying_price" name="buying_price" class="flat" value="<?php echo (isset($_POST["buying_price"])?$_POST["buying_price"]:''); ?>">
 		</td>
 		<?php
 	}
@@ -138,6 +139,7 @@ if (! empty($conf->service->enabled) && $dateSelector)
 		if (! empty($conf->global->DISPLAY_MARK_RATES))   $colspan++;
 	}
 ?>
+
 <tr <?php echo $bcnd[$var]; ?>>
 	<td colspan="<?php echo $colspan; ?>">
 	<?php
diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php
index 60dbbef1ee5337dea6029070e3b4118856927ea4..b2c4884cf3e3f7f5f4677c96eacc40cde91de9bf 100644
--- a/htdocs/fichinter/class/fichinter.class.php
+++ b/htdocs/fichinter/class/fichinter.class.php
@@ -176,7 +176,9 @@ class Fichinter extends CommonObject
 			// Appel des triggers
 			include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
 			$interface=new Interfaces($this->db);
-			$result=$interface->run_triggers('FICHINTER_CREATE',$this,$user,$langs,$conf);
+			$tmpuser=new User($this->db);
+			$tmpuser->fetch($this->author);
+			$result=$interface->run_triggers('FICHINTER_CREATE',$this,$tmpuser,$langs,$conf);
 			if ($result < 0) {
 				$error++; $this->errors=$interface->errors;
 			}
diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php
index f6b25d254ed878dd69a882713639fd17529872ab..d1526e04984abb56a8d5bdeb131499a21a70bb22 100755
--- a/htdocs/filefunc.inc.php
+++ b/htdocs/filefunc.inc.php
@@ -152,11 +152,11 @@ if (! empty($dolibarr_main_document_root_alt))
 // Define DOL_MAIN_URL_ROOT and DOL_URL_ROOT
 $tmp='';
 $found=0;
-$real_dolibarr_main_document_root=str_replace('\\','/',realpath($dolibarr_main_document_root));
-$pathroot=$_SERVER["DOCUMENT_ROOT"];
-$paths=explode('/',str_replace('\\','/',$_SERVER["SCRIPT_NAME"]));
+$real_dolibarr_main_document_root=str_replace('\\','/',realpath($dolibarr_main_document_root));	// A) Ex: C:/xxx/dolibarr/htdocs
+$pathroot=$_SERVER["DOCUMENT_ROOT"];															// B) Ex: C:/Program Files/wamp/www/
+$paths=explode('/',str_replace('\\','/',$_SERVER["SCRIPT_NAME"]));								// C) Ex: /dolibarr/htdocs/admin/system/phpinfo.php
 $concatpath='';
-foreach($paths as $tmppath)
+foreach($paths as $tmppath)	// We check to find (B+start of C)=A
 {
     if ($tmppath) $concatpath.='/'.$tmppath;
     //print $_SERVER["SCRIPT_NAME"].'-'.$pathroot.'-'.$concatpath.'-'.$real_dolibarr_main_document_root.'-'.realpath($pathroot.$concatpath).'<br>';
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index 5b3c9d6c8d3b900d106c30da0132584d80d48cdd..dbd23b2f46512039f72801ab9dd99784b7539dd7 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -947,7 +947,7 @@ class CommandeFournisseur extends CommonOrder
         $sql.= ", '".$this->note_public."'";
         $sql.= ", ".$conf->entity;
         $sql.= ", ".$this->socid;
-        $sql.= ", ".$this->db->idate($now);
+        $sql.= ", '".$this->db->idate($now)."'";
 		//$sql.= ", ".$this->db->idate($now);
         $sql.= ", ".$user->id;
         $sql.= ", 0";
diff --git a/htdocs/holiday/fiche.php b/htdocs/holiday/fiche.php
index 624287d9bb455d016905f9122fbaa310c07652eb..db27fb1116ac97412760efe571bc228558b308ee 100644
--- a/htdocs/holiday/fiche.php
+++ b/htdocs/holiday/fiche.php
@@ -380,10 +380,10 @@ if($action == 'confirm_valid')
             $newSolde = $soldeActuel - ($nbJour*$cp->getConfCP('nbHolidayDeducted'));
 
             // On ajoute la modification dans le LOG
-            $cp->addLogCP($user->id,$cp->fk_user, $langs->transnoentitiesnoconv("Holidays"),$newSolde);
+            $cp->addLogCP($user->id, $cp->fk_user, $langs->transnoentitiesnoconv("Holidays"), $newSolde);
 
             // Mise à jour du solde
-            $cp->updateSoldeCP($cp->fk_user,$newSolde);
+            $cp->updateSoldeCP($cp->fk_user, $newSolde);
 
             // To
             $destinataire = new User($db);
diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql
index 9a3f073f40dbf76f073fbcbf082ae2cbfd10b011..46affb6327ac4cea8efbae9052b0a38300e23573 100755
--- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql
+++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql
@@ -346,9 +346,9 @@ ALTER TABLE llx_opensurvey_comments ADD INDEX idx_id_comment (id_comment);
 ALTER TABLE llx_opensurvey_comments ADD INDEX idx_id_sondage (id_sondage);
 ALTER TABLE llx_opensurvey_sondage ADD INDEX idx_id_sondage_admin (id_sondage_admin);
 ALTER TABLE llx_opensurvey_sondage ADD INDEX idx_date_fin (date_fin);
-ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_id_users (id_users);
-ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_nom (nom);
-ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_id_sondage (id_sondage);
+ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_opensurvey_user_studs_id_users (id_users);
+ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_opensurvey_user_studs_nom (nom);
+ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_opensurvey_user_studs_id_sondage (id_sondage);
 
 ALTER TABLE llx_boxes ADD COLUMN params varchar(255);
 
@@ -374,3 +374,5 @@ create table llx_facture_fourn_extrafields
   import_key                varchar(14)                          		-- import key
 ) ENGINE=innodb;
 ALTER TABLE llx_facture_fourn_extrafields ADD INDEX idx_facture_fourn_extrafields (fk_object);
+
+ALTER TABLE llx_user_clicktodial ADD COLUMN url varchar(255) AFTER fk_user;
diff --git a/htdocs/install/mysql/tables/llx_opensurvey_user_studs.key.sql b/htdocs/install/mysql/tables/llx_opensurvey_user_studs.key.sql
index 041b2d0593d458580b714531705ca4f3aaa56cd4..810080e3466394c51f4829c6f73b93975b1d8c97 100755
--- a/htdocs/install/mysql/tables/llx_opensurvey_user_studs.key.sql
+++ b/htdocs/install/mysql/tables/llx_opensurvey_user_studs.key.sql
@@ -15,6 +15,6 @@
 -- along with this program. If not, see <http://www.gnu.org/licenses/>.
 -- ============================================================================
 
-ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_id_users (id_users);
-ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_nom (nom);
-ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_id_sondage (id_sondage);
+ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_opensurvey_user_studs_id_users (id_users);
+ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_opensurvey_user_studs_nom (nom);
+ALTER TABLE llx_opensurvey_user_studs ADD INDEX idx_opensurvey_user_studs_id_sondage (id_sondage);
diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php
index 3448e3a196c52455ec5b7394885353e131555ff8..e477ec3b6a5b1533be05921274b6a7c347569d09 100644
--- a/htdocs/install/upgrade2.php
+++ b/htdocs/install/upgrade2.php
@@ -329,12 +329,17 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
         if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0)
         {
         	migrate_categorie_association($db,$langs,$conf);
+        }
 
-        	// Reload modules
-        	migrate_reload_modules($db,$langs,$conf);
-
-        	// Reload menus
-        	migrate_reload_menu($db,$langs,$conf,$versionto);
+        $afterversionarray=explode('.','3.3.9');
+        $beforeversionarray=explode('.','3.4.9');
+        if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0)
+        {
+        	// Reload modules (this must be always and only into last targeted version)
+        	migrate_reload_modules($db,$langs,$conf);
+
+        	// Reload menus (this must be always and only into last targeted version)
+        	migrate_reload_menu($db,$langs,$conf,$versionto);
         }
 
         print '<tr><td colspan="4"><br>'.$langs->trans("MigrationFinished").'</td></tr>';
@@ -3521,6 +3526,10 @@ function migrate_delete_old_files($db,$langs,$conf)
     DOL_DOCUMENT_ROOT.'/core/menus/smartphone/iphone.lib.php',
     DOL_DOCUMENT_ROOT.'/core/menus/smartphone/iphone_backoffice.php',
     DOL_DOCUMENT_ROOT.'/core/menus/smartphone/iphone_frontoffice.php',
+    DOL_DOCUMENT_ROOT.'/core/menus/standard/auguria_backoffice.php',
+    DOL_DOCUMENT_ROOT.'/core/menus/standard/auguria_frontoffice.php',
+    DOL_DOCUMENT_ROOT.'/core/menus/standard/eldy_backoffice.php',
+    DOL_DOCUMENT_ROOT.'/core/menus/standard/eldy_frontoffice.php',
     DOL_DOCUMENT_ROOT.'/core/modules/mailings/dolibarr_services_expired.modules.php',
     DOL_DOCUMENT_ROOT.'/core/modules/mailings/peche.modules.php',
     DOL_DOCUMENT_ROOT.'/core/modules/mailings/poire.modules.php',
diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang
index 3677392d64c2c525d02e7718101318047a9b64b2..1f02fc11f5f2cf9e127c519999438ad3e2b9e227 100644
--- a/htdocs/langs/en_US/errors.lang
+++ b/htdocs/langs/en_US/errors.lang
@@ -122,6 +122,7 @@ ErrorFailedToRemoveToMailmanList=Failed to remove record %s to Mailman list %s o
 ErrorNewValueCantMatchOldValue=New value can't be equal to old one
 ErrorFailedToValidatePasswordReset=Failed to reinit password. May be the reinit was already done (this link can be used only one time). If not, try to restart the reinit process.
 ErrorToConnectToMysqlCheckInstance=Connect to database fails. Check Mysql server is running (in most cases, you can launch it from command line with 'sudo /etc/init.d/mysql start').
+ErrorFailedToAddContact=Failed to add contact
 
 # Warnings
 WarningMandatorySetupNotComplete=Mandatory setup parameters are not yet defined
diff --git a/htdocs/langs/es_ES/admin.lang b/htdocs/langs/es_ES/admin.lang
index 1305286306852c853614bbc989d3b85ee8d11921..18f58bd0daeb19deebf4d0f981372d51ca5d4746 100644
--- a/htdocs/langs/es_ES/admin.lang
+++ b/htdocs/langs/es_ES/admin.lang
@@ -480,6 +480,8 @@ Module2650Name=Ultimatepdf
 Module2650Desc=Gestión de la presentación de las plantillas pdf (presupuestos, facturas, pedidos, etc.)
 Module2700Name=Gravatar
 Module2700Desc=Utiliza el servicio en línea de Gravatar (www.gravatar.com) para mostrar fotos de los usuarios/miembros (que se encuentran en sus mensajes de correo electrónico). Necesita un acceso a Internet
+Module2800Name=FTP
+Module2800Desc=Cliente FTP
 Module2900Name=GeoIPMaxmind
 Module2900Desc=Capacidades de conversión GeoIP Maxmind
 Module5000Name=Multi-empresa
diff --git a/htdocs/langs/fr_FR/dict.lang b/htdocs/langs/fr_FR/dict.lang
index 649397eb3c81518a57873e7f30dfee42deedcc22..e0a8fd6f2ef8f8e3e1d041b7c6d265110b2c606d 100644
--- a/htdocs/langs/fr_FR/dict.lang
+++ b/htdocs/langs/fr_FR/dict.lang
@@ -274,8 +274,8 @@ CurrencyMAD=Dirham
 CurrencySingMAD=Dirham
 CurrencyMGA=Ariary
 CurrencySingMGA=Ariary
-CurrencyMUR=Roupies mauritiennes
-CurrencySingMUR=Roupie mauritienne
+CurrencyMUR=Roupies mauriciennes
+CurrencySingMUR=Roupie mauriciennes
 CurrencyNOK=Couronnes norvégiennes
 CurrencySingNOK=Couronne norvégienne
 CurrencySUR=Roubles
diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang
index 2c06d31126b444c8f1d92261ee5aba1b09716540..28be39d651fd57dc35c9fba41837283bd5a110f7 100644
--- a/htdocs/langs/fr_FR/errors.lang
+++ b/htdocs/langs/fr_FR/errors.lang
@@ -123,6 +123,7 @@ ErrorFailedToRemoveToMailmanList=Echec de la suppression de %s de la liste Mailm
 ErrorNewValueCantMatchOldValue=La nouvelle valeur ne peut être égale à l'ancienne
 ErrorFailedToValidatePasswordReset=Echec de la réinitialisation du mot de passe. Il est possible que ce lien ait déjà été utilisé (l'utilisation de ce lien ne fonctionne qu'une fois). Si ce n'est pas le cas, essayer de recommencer le processus de réinit de mot de passe depuis le début.
 ErrorToConnectToMysqlCheckInstance=Echec de la connection au serveur de base de donnée. Vérifier que Mysql est bien lancé (dans la plupart des cas, vous pouvez le lancer depuis la ligne de commande par la commande 'sudo /etc/init.d/mysql start').
+ErrorFailedToAddContact=Echec à l'ajout du contact
 
 # Warnings
 WarningMandatorySetupNotComplete=Les informations de configuration obligatoire doivent être renseignées
diff --git a/htdocs/langs/fr_FR/mailmanspip.lang b/htdocs/langs/fr_FR/mailmanspip.lang
index 3f27ae0d9c916ab72b00e1055d3bc51624d1c1df..1118fbbff9052699c8d5703dad9c12d90ec66bab 100644
--- a/htdocs/langs/fr_FR/mailmanspip.lang
+++ b/htdocs/langs/fr_FR/mailmanspip.lang
@@ -1,6 +1,6 @@
 # Dolibarr language file - fr_FR - mailmanspip
 CHARSET=UTF-8
-MailmanTitle=Système de listes de diffusion Mailman
+MailmanTitle=Interfacer avec le système de listes de diffusion Mailman
 MailmanSpipSetup=Configuration du module Mailman et SPIP
 TestSubscribe=Pour tester l'inscription aux listes mailman
 TestUnSubscribe=Pour tester la désincritpion aux listes mailman
@@ -11,7 +11,7 @@ SynchroSpipEnabled=Une alimentation de Spip sera réalisée
 DescADHERENT_MAILMAN_ADMINPW=Mot de passe administrateur Mailman
 DescADHERENT_MAILMAN_URL=URL d'inscription aux listes Mailman
 DescADHERENT_MAILMAN_UNSUB_URL=URL de désinscription aux listes Mailman
-SPIPTitle=Gestion de contenu SPIP
+SPIPTitle=Interfacer avec le sytème de gestion de contenu SPIP
 DescADHERENT_SPIP_SERVEUR=Serveur SPIP
 DescADHERENT_SPIP_DB=Nom base SPIP
 DescADHERENT_SPIP_USER=Login connexion base SPIP
diff --git a/htdocs/langs/fr_FR/members.lang b/htdocs/langs/fr_FR/members.lang
index 5cd7890df1eb605ef0af1026a443d5eb92ef1b32..7f30ddd3fd5772fbfcb069a60bdb500862e4f367 100644
--- a/htdocs/langs/fr_FR/members.lang
+++ b/htdocs/langs/fr_FR/members.lang
@@ -153,7 +153,7 @@ DescADHERENT_CARD_HEADER_TEXT=Texte imprimé sur le haut des cartes d'adhérent
 DescADHERENT_CARD_TEXT=Texte imprimé sur les cartes d'adhérent (Aligné à gauche)
 DescADHERENT_CARD_TEXT_RIGHT=Texte imprimé sur les cartes d'adhérent (Aligné à droite)
 DescADHERENT_CARD_FOOTER_TEXT=Texte imprimé sur le bas des cartes d'adhérent
-DescADHERENT_MAILMAN_LISTS=Liste(s) à la quelle (auxquelles) inscrire les nouveaux adhérents (séparés par une virgule)
+DescADHERENT_MAILMAN_LISTS=Liste(s) à la quelle (auxquelles) inscrire automatiquement les adhérents validés (séparés par une virgule)
 GlobalConfigUsedIfNotDefined=Le texte défini dans la configuration du module Adhérent sera utilisé si cette valeur est non définie ici.
 MayBeOverwrited=Cette valeur peut être écrasée par le texte défini au niveau du type d'adhérent
 ShowTypeCard=Voir type '%s'
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 6e03a9ac2ce12751cc3e16e5da1704ccc15a0fe4..6bee9a606ca420e3b73853390d59394399f96229 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -984,7 +984,10 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
             if (! empty($conf->global->MAIN_USE_JQUERY_JMOBILE) || defined('REQUIRE_JQUERY_JMOBILE') || ! empty($conf->dol_use_jmobile))
             {
             	print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/mobile/jquery.mobile-latest.min.css" />'."\n";
-            }
+            	//$arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css');
+            	print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/jquerytreeview/jquery.treeview.css" />'."\n";
+            }
+            
         }
 
         print '<!-- Includes CSS for Dolibarr theme -->'."\n";
@@ -1148,6 +1151,9 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
             if (! empty($conf->global->MAIN_USE_JQUERY_JMOBILE) || defined('REQUIRE_JQUERY_JMOBILE') || (! empty($conf->dol_use_jmobile) && $conf->dol_use_jmobile > 0))
             {
             	print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/mobile/jquery.mobile-latest.min.js"></script>'."\n";
+            	//$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');
+            	print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jquerytreeview/jquery.treeview.js"></script>'."\n";
+            	print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js"></script>'."\n";
             }
         }
 
diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php
index 3b5b2d46ec51f0ae0fceb2922060a2d22fa6fd50..718dea6f6d661ee1287341d74cec69037cdd1da6 100644
--- a/htdocs/margin/agentMargins.php
+++ b/htdocs/margin/agentMargins.php
@@ -278,4 +278,4 @@ $(document).ready(function() {
 	$("#markRate").html("<?php echo (($markRate === '')?'n/a':price($markRate)."%"); ?>");
 
 });
-</script>
\ No newline at end of file
+</script>
diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php
index 6af526492fe0789fc793545ed32973c532aa7347..e92192c0d715479e0294b15beb0008b8918fd2a6 100644
--- a/htdocs/margin/customerMargins.php
+++ b/htdocs/margin/customerMargins.php
@@ -183,6 +183,7 @@ $sql.= " ORDER BY $sortfield $sortorder ";
 // TODO: calculate total to display then restore pagination
 //$sql.= $db->plimit($conf->liste_limit +1, $offset);
 
+dol_syslog('margin::customerMargins.php sql='.$sql,LOG_DEBUG);
 $result = $db->query($sql);
 if ($result)
 {
@@ -303,4 +304,4 @@ $(document).ready(function() {
 	$("#markRate").html("<?php echo (($markRate === '')?'n/a':price($markRate)."%"); ?>");
 
 });
-</script>
\ No newline at end of file
+</script>
diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php
index 6fc92f9486044b495097e303f5efc98bf301cf9f..55a13e8309419d71ee64479899324c8f39bb2c86 100644
--- a/htdocs/margin/tabs/productMargins.php
+++ b/htdocs/margin/tabs/productMargins.php
@@ -264,4 +264,4 @@ $(document).ready(function() {
 	$("#marginRate").html("<?php echo (($marginRate === '')?'n/a':price($marginRate)."%"); ?>");
 	$("#markRate").html("<?php echo (($markRate === '')?'n/a':price($markRate)."%"); ?>");
 });
-</script>
\ No newline at end of file
+</script>
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index e6376bbe7ebc85ad6f47ca4f415e755a9b40b27f..dc438d2b929a66fab0c959d193cf595f64777653 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -1292,9 +1292,11 @@ class Project extends CommonObject
 		switch ($Tablename)
 		{
 			case "facture":
-			case "facture_fourn":
 				$sql = "SELECT rowid, facnumber as ref";
 				break;
+			case "facture_fourn":
+				$sql = "SELECT rowid, ref";
+				break;
 			case "facture_rec":
 				$sql = "SELECT rowid, titre as ref";
 				break;
@@ -1309,7 +1311,9 @@ class Project extends CommonObject
 
 		$sql.= " FROM ".MAIN_DB_PREFIX.$Tablename;
 		$sql.= " WHERE ".$projectkey." is null";
-		$sql.= " AND fk_soc=".$this->societe->id; 
+		if (!empty($this->societe->id)) {
+			$sql.= " AND fk_soc=".$this->societe->id;
+		} 
 		$sql.= " ORDER BY ref DESC";
 
 		dol_syslog("Project.Lib::select_element sql=".$sql);
diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php
index fecd918a29f7b600fb3d7f6f302eecea3afa4f49..c8dcbb5d7f2bf7600eb64ff2737cf74c23fca7d9 100644
--- a/htdocs/societe/admin/societe.php
+++ b/htdocs/societe/admin/societe.php
@@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
 
 $langs->load("admin");
+$langs->load('other');
 
 $action=GETPOST('action','alpha');
 $value=GETPOST('value','alpha');
diff --git a/htdocs/theme/cameleo/style.css.php b/htdocs/theme/cameleo/style.css.php
index 3203e556e8210f580ea3c1e9f622b633867f976c..568e81f13f2a629c0d67543312b5ba6aa0e3c319 100644
--- a/htdocs/theme/cameleo/style.css.php
+++ b/htdocs/theme/cameleo/style.css.php
@@ -1432,7 +1432,7 @@ table.liste td {
 
 tr.liste_titre, tr.liste_titre_sel
 {
-    height: 20px;
+    height: 20px !important;
 }
 div.liste_titre, tr.liste_titre {
     color: #842F00;
@@ -1440,24 +1440,23 @@ div.liste_titre, tr.liste_titre {
     font-family: "Trebuchet MS",Arial,Helvetica,sans-serif;
     /*border-bottom: 1px solid #FDFFFF;*/
     border-radius: 8px;
-    line-height: 18px;
     padding-left: 10px;
     padding-right: 10px;
-    white-space: nowrap;
+    white-space: <?php echo $dol_optimize_smallscreen?'normal':'nowrap'; ?>;
     text-align: <?php echo $left; ?>;
 }
 th.liste_titre, td.liste_titre
 {
 	padding-left: 6px;
 	padding-right: 6px;
-    	/*vertical-align: text-top;*/
+    white-space: <?php echo $dol_optimize_smallscreen?'normal':'nowrap'; ?>;
 }
 th.liste_titre_sel, td.liste_titre_sel
 {
     background-position: top right;
     color: #A51B00;
     font-weight: bold;
-    white-space: nowrap;
+    white-space: <?php echo $dol_optimize_smallscreen?'normal':'nowrap'; ?>;
 }
 
 input.liste_titre {
diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php
index 39a9292531cf3e20990c97690b051f939ffaabb8..1fbca3e51a05414076214305e9ae2b682e8e773f 100644
--- a/htdocs/theme/eldy/style.css.php
+++ b/htdocs/theme/eldy/style.css.php
@@ -238,7 +238,7 @@ input, input.flat, textarea, textarea.flat, form.flat select, select.flat {
 	background: #FDFDFD;
     border: 1px solid #C0C0C0;
     <?php if (empty($dol_use_jmobile)) { ?>
-    padding: 1px 1px 1px 1px;
+    /*padding: 1px 1px 1px 1px; */
     margin: 0px 0px 0px 0px;
     <?php } ?>
 }
@@ -514,6 +514,7 @@ a.tmenudisabled:link, a.tmenudisabled:visited, a.tmenudisabled:hover, a.tmenudis
 	cursor: not-allowed;
     font-weight: normal;
 	white-space: nowrap;
+	text-decoration: none;
 }
 
 a.tmenu:link, a.tmenu:visited, a.tmenu:hover, a.tmenu:active {
diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index f26aa4c527c7717517910300755c7ec774aa0e76..54aff2226a6606513e55d4a047c5f8392ea3cf18 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -219,6 +219,15 @@ class User extends CommonObject
 				$this->contact_id           = $obj->fk_socpeople;
 				$this->fk_member            = $obj->fk_member;
 				$this->fk_user        		= $obj->fk_user;
+				
+				// Retreive all extrafield for thirdparty
+				// fetch optionals attributes and labels
+				require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
+				$extrafields=new ExtraFields($this->db);
+				$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
+				if (count($extralabels)>0) {
+					$this->fetch_optionals($this->id,$extralabels);
+				}
 
 				$this->db->free($result);
 			}
diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php
index 7769a9da06cc7542d9e2fa3669e9af9f65873884..53de51df268d392c7afcbcadd974c13358c62b14 100644
--- a/htdocs/user/fiche.php
+++ b/htdocs/user/fiche.php
@@ -7,6 +7,7 @@
  * Copyright (C) 2005      Lionel Cousteix      <etm_ltd@tiscali.co.uk>
  * Copyright (C) 2011      Herve Prot           <herve.prot@symeos.com>
  * Copyright (C) 2012      Juanjo Menent        <jmenent@2byte.es>
+ * Copyright (C) 2013      Florian Henry        <florian.henry@open-concept.pro>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -85,6 +86,9 @@ $form = new Form($db);
 $object = new User($db);
 $extrafields = new ExtraFields($db);
 
+// fetch optionals attributes and labels
+$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
+
 // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
 $hookmanager->initHooks(array('usercard'));
 
@@ -560,9 +564,6 @@ if ($action == 'adduserldap')
  * View
  */
 
-// fetch optionals attributes and labels
-$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
-
 llxHeader('',$langs->trans("UserCard"));
 
 $form = new Form($db);
diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php
index 3554af45ffdc7652ff4ee45496b8d03a8ee8454e..616b0609f7a0166000a9130e68989faaa9ade847 100644
--- a/htdocs/user/perms.php
+++ b/htdocs/user/perms.php
@@ -63,6 +63,7 @@ if ($user->id == $id && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user-
 	$feature2='';
 	$canreaduser=1;
 }
+
 $result = restrictedArea($user, 'user', $id, '&user', $feature2);
 if ($user->id <> $id && ! $canreaduser) accessforbidden();
 
@@ -271,9 +272,8 @@ print '</tr>'."\n";
 print '</table><br>';
 
 if ($user->admin) print info_admin($langs->trans("WarningOnlyPermissionOfActivatedModules"), 0, 1).'<br>';
-// Show warning about external users
-print showModulesExludedForExternal($modules).'<br>'."\n";
-print "<br>\n";
+// Show warning about external users
+if (empty($user->societe_id)) print showModulesExludedForExternal($modules).'<br><br>'."\n";
 
 // For multicompany transversal mode
 if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode))