diff --git a/.tx/config b/.tx/config
index fcd276390ee8b8df286fef134e2350e19d60d396..a89b56c101315dfd88d14e6fe70ffa4d4afffa96 100644
--- a/.tx/config
+++ b/.tx/config
@@ -2,6 +2,12 @@
 host = https://www.transifex.com
 lang_map = uz: uz_UZ
 
+[dolibarr.accountancy]
+file_filter = htdocs/langs/<lang>/accountancy.lang
+source_file = htdocs/langs/en_US/accountancy.lang
+source_lang = en_US
+type = MOZILLAPROPERTIES
+
 [dolibarr.admin]
 file_filter = htdocs/langs/<lang>/admin.lang
 source_file = htdocs/langs/en_US/admin.lang
diff --git a/ChangeLog b/ChangeLog
index 2c0a5353f60126d4961b93f813dca88903320827..cf0f0b2f922ea982426f00e2f181a32a90254d40 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -143,6 +143,7 @@ For users:
 - Fix: Extrafield feature select from table should try to translate multiple column when not needed 
 - Fix: cents for indian ruppes are calle paisa and paise.
 - Fix: Invoices payments may be older than invoices.
+- Fix: [ bug #1593 ] Spanish Localtax IRPF not being calculated since 3.6.0 in supplier invoices when adding a line
 
 ***** ChangeLog for 3.6 compared to 3.5.* *****
 For users:
diff --git a/build/debian/control b/build/debian/control
index f4f9e12aa58c2303230efd76e2a16214c7a0a070..fc0cee303193738a897d4858c3ce8bc9d02a679e 100755
--- a/build/debian/control
+++ b/build/debian/control
@@ -68,4 +68,4 @@ Description: Web based software to manage a company or foundation
  PDF exports,
  And a lot more modules...
  .
- You can also add third parties external modules or develop yours.
+ You can also add external modules from third parties or develop yours.
diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php
index c8b8c8a7d97fdb47b21cfc2aa96dbc31be03814f..ca7e5f84e074ed2f8f77c4a6556c5e43be2b9742 100644
--- a/htdocs/accountancy/admin/export.php
+++ b/htdocs/accountancy/admin/export.php
@@ -3,6 +3,7 @@
  * Copyright (C) 2013-2014 Alexandre Spangaro	<alexandre.spangaro@gmail.com>
  * Copyright (C) 2014	   Florian Henry		<florian.henry@open-concept.pro>
  * Copyright (C) 2014      Marcos García        <marcosgdf@gmail.com>
+ * Copyright (C) 2014	   Juanjo Menent		<jmenent@2byte.es>
  *
  * 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
@@ -130,9 +131,6 @@ print "<br>\n";
  *  Params
  *
  */
-$list = array (
-		'ACCOUNTING_SEPARATORCSV' 
-);
 
 $num = count($list);
 if ($num) {
diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php
index 66f5efef04d542b142cfb0b79e326b1898ae3bb9..02cb262b209864b907a5b98c01407be9d8c0df63 100644
--- a/htdocs/accountancy/admin/index.php
+++ b/htdocs/accountancy/admin/index.php
@@ -3,7 +3,8 @@
  * Copyright (C) 2013-2014 Florian Henry		<florian.henry@open-concept.pro>
  * Copyright (C) 2013-2014 Alexandre Spangaro	<alexandre.spangaro@gmail.com>
  * Copyright (C) 2014      Ari Elbaz (elarifr)	<github@accedinfo.com>
- * Copyright (C) 2014      Marcos García        <marcosgdf@gmail.com> 
+ * Copyright (C) 2014      Marcos García        <marcosgdf@gmail.com>
+ * Copyright (C) 2014	   Juanjo Menent		<jmenent@2byte.es>
  *
  * 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
diff --git a/htdocs/accountancy/admin/journaux.php b/htdocs/accountancy/admin/journaux.php
index 77b7d15e1c346dded28c9754851456bc5a3df167..f7507cda234216ba3390e9b4dc187fc515a752e1 100644
--- a/htdocs/accountancy/admin/journaux.php
+++ b/htdocs/accountancy/admin/journaux.php
@@ -3,6 +3,7 @@
  * Copyright (C) 2013-2014 Alexandre Spangaro	<alexandre.spangaro@gmail.com>
  * Copyright (C) 2014 	   Florian Henry		<florian.henry@open-concept.pro>
  * Copyright (C) 2014      Marcos García        <marcosgdf@gmail.com>
+ * Copyright (C) 2014	   Juanjo Menent		<jmenent@2byte.es>
  *
  * 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
diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php
index 82c3ec3ca10d3a41c1cea0588853174d07ec00f7..e6ada14a7dbbe1703472338b3b6933a1d3263db2 100644
--- a/htdocs/accountancy/class/accountingaccount.class.php
+++ b/htdocs/accountancy/class/accountingaccount.class.php
@@ -18,7 +18,7 @@
  */
 
 /**
- * \file		htdocs/accountancy/class/Accountingaccount.class.php
+ * \file		htdocs/accountancy/class/accountingaccount.class.php
  * \ingroup		Accounting Expert
  * \brief		Fichier de la classe des comptes comptable
  */
@@ -29,8 +29,11 @@
 class AccountingAccount
 {
 	var $db;
+	var $error;
+
 	var $id;
 	var $rowid;
+
 	var $datec; // Creation date
 	var $fk_pcg_version;
 	var $pcg_type;
@@ -62,8 +65,10 @@ class AccountingAccount
 	 */
 	function fetch($rowid = null, $account_number = null)
 	{
-		if ($rowid || $account_number) {
-			$sql = "SELECT * FROM " . MAIN_DB_PREFIX . "accountingaccount WHERE ";
+		if ($rowid || $account_number)
+		{
+			$sql = "SELECT rowid, datec, tms, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, labe, fk_user_author, fk_user_modifn active";
+			$sql.= " FROM " . MAIN_DB_PREFIX . "accountingaccount WHERE";
 			if ($rowid) {
 				$sql .= " rowid = '" . $rowid . "'";
 			} elseif ($account_number) {
@@ -72,28 +77,40 @@ class AccountingAccount
 
 			dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
 			$result = $this->db->query($sql);
-			if ($result) {
+			if ($result)
+			{
 				$obj = $this->db->fetch_object($result);
-			} else {
-				return null;
+
+				if ($obj)
+				{
+					$this->id = $obj->rowid;
+					$this->rowid = $obj->rowid;
+					$this->datec = $obj->datec;
+					$this->tms = $obj->tms;
+					$this->fk_pcg_version = $obj->fk_pcg_version;
+					$this->pcg_type = $obj->pcg_type;
+					$this->pcg_subtype = $obj->pcg_subtype;
+					$this->account_number = $obj->account_number;
+					$this->account_parent = $obj->account_parent;
+					$this->label = $obj->label;
+					$this->fk_user_author = $obj->fk_user_author;
+					$this->fk_user_modif = $obj->fk_user_modif;
+					$this->active = $obj->active;
+
+					return $this->id;
+				}
+				else
+				{
+					return 0;
+				}
+			}
+			else
+			{
+				dol_print_error($this->db);
 			}
 		}
 
-		$this->id = $obj->rowid;
-		$this->rowid = $obj->rowid;
-		$this->datec = $obj->datec;
-		$this->tms = $obj->tms;
-		$this->fk_pcg_version = $obj->fk_pcg_version;
-		$this->pcg_type = $obj->pcg_type;
-		$this->pcg_subtype = $obj->pcg_subtype;
-		$this->account_number = $obj->account_number;
-		$this->account_parent = $obj->account_parent;
-		$this->label = $obj->label;
-		$this->fk_user_author = $obj->fk_user_author;
-		$this->fk_user_modif = $obj->fk_user_modif;
-		$this->active = $obj->active;
-
-		return $obj->rowid;
+		return -1;
 	}
 
 	/**
diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php
index 2df4d675b20e00ff138cbc3fab9ecdc8b67badde..9ae070c25e02e1be3a94d1fc6dfa2245b064db32 100644
--- a/htdocs/accountancy/customer/index.php
+++ b/htdocs/accountancy/customer/index.php
@@ -1,7 +1,8 @@
 <?php
 /* Copyright (C) 2013      Olivier Geffroy		<jeff@jeffinfo.com>
  * Copyright (C) 2013-2014 Florian Henry		<florian.henry@open-concept.pro>
- * Copyright (C) 2013-2014 Alexandre Spangaro	<alexandre.spangaro@gmail.com> 
+ * Copyright (C) 2013-2014 Alexandre Spangaro	<alexandre.spangaro@gmail.com>
+ * Copyright (C) 2014	   Juanjo Menent		<jmenent@2byte.es> 
  *
  * 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
@@ -40,7 +41,7 @@ $langs->load("accountancy");
 // Security check
 if ($user->societe_id > 0)
 	accessforbidden();
-if (! $user->rights->accounting->access)
+if (! $user->rights->accounting->ventilation->read)
 	accessforbidden();
 	
 // Filter
diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php
index aff9f7aa3a765c2aa96341c7fbd588c730471eb8..9215d5a9d9890b40a3b3e9fd4364094634513d1f 100644
--- a/htdocs/accountancy/customer/lines.php
+++ b/htdocs/accountancy/customer/lines.php
@@ -2,7 +2,8 @@
 /* Copyright (C) 2013-2014 Olivier Geffroy		<jeff@jeffinfo.com>
  * Copyright (C) 2013-2014 Alexandre Spangaro	<alexandre.spangaro@gmail.com>
  * Copyright (C) 2014      Ari Elbaz (elarifr)	<github@accedinfo.com>
- * Copyright (C) 2014      Florian Henry		<florian.henry@open-concept.pro>   
+ * Copyright (C) 2014      Florian Henry		<florian.henry@open-concept.pro>
+ * Copyright (C) 2014	   Juanjo Menent		<jmenent@2byte.es>   
  *
  * 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
@@ -43,7 +44,7 @@ $account_parent = GETPOST('account_parent');
 // Security check
 if ($user->societe_id > 0)
 	accessforbidden();
-if (! $user->rights->accounting->access)
+if (! $user->rights->accounting->ventilation->dispatch)
 	accessforbidden();
 
 $formventilation = new FormVentilation($db);
diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php
index 02602262e2c73abad3350aae7b3eb81ff5dc1182..fefed4206211a02c25806a292e52d95fcbce0b8f 100644
--- a/htdocs/accountancy/customer/list.php
+++ b/htdocs/accountancy/customer/list.php
@@ -3,6 +3,7 @@
  * Copyright (C) 2013-2014 Alexandre Spangaro	<alexandre.spangaro@gmail.com>
  * Copyright (C) 2014      Ari Elbaz (elarifr)	<github@accedinfo.com>
  * Copyright (C) 2013-2014 Florian Henry		<florian.henry@open-concept.pro>
+ * Copyright (C) 2014	   Juanjo Menent		<jmenent@2byte.es> 
  *
  * 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
@@ -44,7 +45,7 @@ $mesCasesCochees = GETPOST('mesCasesCochees', 'array');
 // Security check
 if ($user->societe_id > 0)
 	accessforbidden();
-if (! $user->rights->accounting->access)
+if (! $user->rights->accounting->ventilation->dispatch)
 	accessforbidden();
 
 $formventilation = new FormVentilation($db);
diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php
index e0c2ceb8e36536355e27d37db1667d2d4335eb98..c9d21f5d9bed12b9d9042f21dcb9228f69dcb2b4 100644
--- a/htdocs/accountancy/journal/purchasesjournal.php
+++ b/htdocs/accountancy/journal/purchasesjournal.php
@@ -28,7 +28,7 @@
  */
 
 require '../../main.inc.php';
-	
+
 // Class
 require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
@@ -88,12 +88,12 @@ $sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.libelle,";
 $sql .= " fd.rowid as fdid, fd.description, fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_type,";
 $sql .= " s.rowid as socid, s.nom as name, s.code_compta_fournisseur, s.fournisseur,";
 $sql .= " s.code_compta_fournisseur, p.accountancy_code_buy , ct.accountancy_code_buy as account_tva, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
-$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det fd";
-$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'";
-$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product p ON p.rowid = fd.fk_product";
-$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount aa ON aa.rowid = fd.fk_code_ventilation";
-$sql .= " JOIN " . MAIN_DB_PREFIX . "facture_fourn f ON f.rowid = fd.fk_facture_fourn";
-$sql .= " JOIN " . MAIN_DB_PREFIX . "societe s ON s.rowid = f.fk_soc";
+$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
+$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'";
+$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_product";
+$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON aa.rowid = fd.fk_code_ventilation";
+$sql .= " JOIN " . MAIN_DB_PREFIX . "facture_fourn as f ON f.rowid = fd.fk_facture_fourn";
+$sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
 $sql .= " WHERE f.fk_statut > 0 ";
 if (! empty($conf->multicompany->enabled)) {
 	$sql .= " AND f.entity = " . $conf->entity;
@@ -113,13 +113,13 @@ if ($result) {
 	// les variables
 	$cptfour = (! empty($conf->global->COMPTA_ACCOUNT_SUPPLIER)) ? $conf->global->COMPTA_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef");
 	$cpttva = (! empty($conf->global->COMPTA_VAT_ACCOUNT)) ? $conf->global->COMPTA_VAT_ACCOUNT : $langs->trans("CodeNotDef");
-	
+
 	$tabfac = array ();
 	$tabht = array ();
 	$tabtva = array ();
 	$tabttc = array ();
 	$tabcompany = array ();
-	
+
 	$i = 0;
 	while ( $i < $num ) {
 		$obj = $db->fetch_object($result);
@@ -133,7 +133,7 @@ if ($result) {
 				$compta_prod = (! empty($conf->global->COMPTA_SERVICE_BUY_ACCOUNT)) ? $conf->global->COMPTA_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef");
 		}
 		$compta_tva = (! empty($obj->account_tva) ? $obj->account_tva : $cpttva);
-		
+
 		$tabfac[$obj->rowid]["date"] = $obj->df;
 		$tabfac[$obj->rowid]["ref"] = $obj->ref;
 		$tabfac[$obj->rowid]["type"] = $obj->type;
@@ -145,9 +145,9 @@ if ($result) {
 		$tabcompany[$obj->rowid] = array (
 				'id' => $obj->socid,
 				'name' => $obj->name,
-				'code_fournisseur' => $obj->code_compta_fournisseur 
+				'code_fournisseur' => $obj->code_compta_fournisseur
 		);
-		
+
 		$i ++;
 	}
 } else {
@@ -160,11 +160,11 @@ if ($result) {
 // Bookkeeping Write
 if ($action == 'writebookkeeping') {
 	$now = dol_now();
-	
+
 	foreach ( $tabfac as $key => $val ) {
 		foreach ( $tabttc[$key] as $k => $mt ) {
 			// get compte id and label
-			
+
 			$bookkeeping = new BookKeeping($db);
 			$bookkeeping->doc_date = $val["date"];
 			$bookkeeping->doc_ref = $val["ref"];
@@ -180,10 +180,10 @@ if ($action == 'writebookkeeping') {
 			$bookkeeping->debit = ($mt <= 0) ? $mt : 0;
 			$bookkeeping->credit = ($mt > 0) ? $mt : 0;
 			$bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
-			
+
 			$bookkeeping->create();
 		}
-		
+
 		// Product / Service
 		foreach ( $tabht[$key] as $k => $mt ) {
 			if ($mt) {
@@ -205,18 +205,18 @@ if ($action == 'writebookkeeping') {
 					$bookkeeping->debit = ($mt > 0) ? $mt : 0;
 					$bookkeeping->credit = ($mt <= 0) ? $mt : 0;
 					$bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
-					
+
 					$bookkeeping->create();
 				}
 			}
 		}
-		
+
 		// VAT
 		// var_dump($tabtva);
 		foreach ( $tabtva[$key] as $k => $mt ) {
 			if ($mt) {
 				// get compte id and label
-				
+
 				$bookkeeping = new BookKeeping($db);
 				$bookkeeping->doc_date = $val["date"];
 				$bookkeeping->doc_ref = $val["ref"];
@@ -232,7 +232,7 @@ if ($action == 'writebookkeeping') {
 				$bookkeeping->debit = ($mt > 0) ? $mt : 0;
 				$bookkeeping->credit = ($mt <= 0) ? $mt : 0;
 				$bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
-				
+
 				$bookkeeping->create();
 			}
 		}
@@ -243,21 +243,21 @@ if ($action == 'writebookkeeping') {
 
 if ($action == 'export_csv') {
 	$sep = $conf->global->ACCOUNTING_SEPARATORCSV;
-	
+
 	header('Content-Type: text/csv');
 	header('Content-Disposition: attachment;filename=journal_achats.csv');
-	
+
 	if ($conf->global->ACCOUNTING_MODELCSV == 1) 	// Modèle Export Cegid Expert
 	{
 		foreach ( $tabfac as $key => $val ) {
 			$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
-			
+
 			// Product / Service
 			foreach ( $tabht[$key] as $k => $mt ) {
 				$companystatic->id = $tabcompany[$key]['id'];
 				$companystatic->name = $tabcompany[$key]['name'];
 				$companystatic->client = $tabcompany[$key]['code_client'];
-				
+
 				if ($mt) {
 					print $date . $sep;
 					print $conf->global->ACCOUNTING_PURCHASE_JOURNAL . $sep;
@@ -270,7 +270,7 @@ if ($action == 'export_csv') {
 					print "\n";
 				}
 			}
-			
+
 			// VAT
 			// var_dump($tabtva);
 			foreach ( $tabtva[$key] as $k => $mt ) {
@@ -289,7 +289,7 @@ if ($action == 'export_csv') {
 			print $date . $sep;
 			print $conf->global->ACCOUNTING_PURCHASE_JOURNAL . $sep;
 			print length_accountg($conf->global->COMPTA_ACCOUNT_SUPPLIER) . $sep;
-			
+
 			foreach ( $tabttc[$key] as $k => $mt ) {
 				print length_accounta(html_entity_decode($k)) . $sep;
 				print ($mt < 0 ? 'D' : 'C') . $sep;
@@ -303,11 +303,11 @@ if ($action == 'export_csv') {
 	{
 		foreach ( $tabfac as $key => $val ) {
 			$date = dol_print_date($db->jdate($val["date"]), 'day');
-			
+
 			$companystatic->id = $tabcompany[$key]['id'];
 			$companystatic->name = $tabcompany[$key]['name'];
 			$companystatic->client = $tabcompany[$key]['code_client'];
-			
+
 			// Product / Service
 			foreach ( $tabht[$key] as $k => $mt ) {
 				if ($mt) {
@@ -333,7 +333,7 @@ if ($action == 'export_csv') {
 					print "\n";
 				}
 			}
-			
+
 			// Third party
 			print '"' . $date . '"' . $sep;
 			print '"' . $val["ref"] . '"' . $sep;
@@ -347,11 +347,11 @@ if ($action == 'export_csv') {
 		}
 	}
 } else {
-	
+
 	llxHeader('', '', '');
-	
+
 	$form = new Form($db);
-	
+
 	$nom = $langs->trans("PurchasesJournal");
 	$nomlink = '';
 	$periodlink = '';
@@ -364,11 +364,11 @@ if ($action == 'export_csv') {
 		$description .= $langs->trans("DepositsAreIncluded");
 	$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
 	report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''));
-	
+
 	print '<input type="button" class="button" style="float: right;" value="Export CSV" onclick="launch_export();" />';
-	
+
 	print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
-	
+
 	print '
 	<script type="text/javascript">
 		function launch_export() {
@@ -382,12 +382,12 @@ if ($action == 'export_csv') {
 		    $("div.fiche div.tabBar form input[name=\"action\"]").val("");
 		}
 	</script>';
-	
+
 	/*
 	 * Show result array
 	 */
 	print '<br><br>';
-	
+
 	$i = 0;
 	print "<table class=\"noborder\" width=\"100%\">";
 	print "<tr class=\"liste_titre\">";
@@ -397,21 +397,21 @@ if ($action == 'export_csv') {
 	print "<td>" . $langs->trans("Account") . "</td>";
 	print "<t><td>" . $langs->trans("Type") . "</td><td align='right'>" . $langs->trans("Debit") . "</td><td align='right'>" . $langs->trans("Credit") . "</td>";
 	print "</tr>\n";
-	
+
 	$var = true;
 	$r = '';
-	
+
 	$invoicestatic = new FactureFournisseur($db);
 	$companystatic = new Fournisseur($db);
-	
+
 	foreach ( $tabfac as $key => $val ) {
 		$invoicestatic->id = $key;
 		$invoicestatic->ref = $val["ref"];
 		$invoicestatic->type = $val["type"];
 		$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
-		
+
 		$date = dol_print_date($db->jdate($val["date"]), 'day');
-		
+
 		// Product / Service
 		foreach ( $tabht[$key] as $k => $mt ) {
 			if ($mt) {
@@ -441,16 +441,16 @@ if ($action == 'export_csv') {
 			}
 		}
 		print "<tr " . $bc[$var] . ">";
-		
+
 		// Third party
 		// print "<td>".$conf->global->COMPTA_JOURNAL_BUY."</td>";
 		print "<td>" . $date . "</td>";
 		print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
-		
+
 		foreach ( $tabttc[$key] as $k => $mt ) {
 			$companystatic->id = $tabcompany[$key]['id'];
 			$companystatic->name = $tabcompany[$key]['name'];
-			
+
 			print "<td>" . length_accounta($k);
 			print "</td><td>" . $langs->trans("ThirdParty");
 			print ' (' . $companystatic->getNomUrl(0, 'supplier', 16) . ')';
@@ -459,12 +459,12 @@ if ($action == 'export_csv') {
 			print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
 		}
 		print "</tr>";
-		
+
 		$var = ! $var;
 	}
-	
+
 	print "</table>";
-	
+
 	// End of page
 	llxFooter();
 }
diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php
index 587a0d387a4529c9cee177e371c0821132a10014..79444fbca604d35c5b3dd9f16e1a98dc582a433d 100644
--- a/htdocs/accountancy/journal/sellsjournal.php
+++ b/htdocs/accountancy/journal/sellsjournal.php
@@ -90,11 +90,11 @@ $sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tot
 $sql .= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,";
 $sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte, ";
 $sql .= " ct.accountancy_code_sell as account_tva";
-$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet fd";
-$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product p ON p.rowid = fd.fk_product";
-$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount aa ON aa.rowid = fd.fk_code_ventilation";
-$sql .= " JOIN " . MAIN_DB_PREFIX . "facture f ON f.rowid = fd.fk_facture";
-$sql .= " JOIN " . MAIN_DB_PREFIX . "societe s ON s.rowid = f.fk_soc";
+$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
+$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_product";
+$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON aa.rowid = fd.fk_code_ventilation";
+$sql .= " JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
+$sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'";
 $sql .= " WHERE fd.fk_code_ventilation > 0 ";
 if (! empty($conf->multicompany->enabled)) {
diff --git a/htdocs/accountancy/supplier/card.php b/htdocs/accountancy/supplier/card.php
index 3ff70b4e670e67b5e056b5ed8beac83bb048a4ec..b0078839b55a1b8e767e5d7b455bac995e818be5 100644
--- a/htdocs/accountancy/supplier/card.php
+++ b/htdocs/accountancy/supplier/card.php
@@ -4,6 +4,7 @@
  * Copyright (C) 2013-2014  Alexandre Spangaro    <alexandre.spangaro@gmail.com>
  * Copyright (C) 2013-2014  Olivier Geffroy       <jeff@jeffinfo.com>
  * Copyright (C) 2013-2014	Florian Henry	      <florian.henry@open-concept.pro>
+ * Copyright (C) 2014	    Juanjo Menent		s<jmenent@2byte.es>
  *
  * 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
@@ -45,7 +46,7 @@ $codeventil = GETPOST('codeventil');
 // Security check
 if ($user->societe_id > 0)
 	accessforbidden();
-if (! $user->rights->accounting->access)
+if (! $user->rights->accounting->ventilation->dispatch)
 	accessforbidden();
 
 if ($action == 'ventil' && $user->rights->accounting->access) {
diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php
index cd6ef6bcb53c7d450a011bb038b888da56d1b37f..7d633c575f14137e83b608b3afc779b14306a0ff 100644
--- a/htdocs/accountancy/supplier/index.php
+++ b/htdocs/accountancy/supplier/index.php
@@ -2,6 +2,7 @@
 /* Copyright (C) 2013-2014 Olivier Geffroy		<jeff@jeffinfo.com>
  * Copyright (C) 2013-2014 Florian Henry		<florian.henry@open-concept.pro>
  * Copyright (C) 2013-2014 Alexandre Spangaro	<alexandre.spangaro@gmail.com>
+ * Copyright (C) 2014	   Juanjo Menent		<jmenent@2byte.es>
  *
  * 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
@@ -39,7 +40,7 @@ $langs->load("accountancy");
 // Security check
 if ($user->societe_id > 0)
 	accessforbidden();
-if (! $user->rights->accounting->access)
+if (! $user->rights->accounting->ventilation->read)
 	accessforbidden();
 	
 // Filter
diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php
index 41ab92aa7652f1e454d45bc32254bd02b7d92557..8b2a870220de7586cdfa346d6bcd7508c34c323f 100644
--- a/htdocs/accountancy/supplier/lines.php
+++ b/htdocs/accountancy/supplier/lines.php
@@ -4,7 +4,8 @@
  * Copyright (C) 2013-2014 Olivier Geffroy		<jeff@jeffinfo.com>
  * Copyright (C) 2013-2014 Alexandre Spangaro	<alexandre.spangaro@gmail.com>
  * Copyright (C) 2014      Ari Elbaz (elarifr)	<github@accedinfo.com>  
- * Copyright (C) 2013-2014 Florian Henry		<florian.henry@open-concept.pro>a
+ * Copyright (C) 2013-2014 Florian Henry		<florian.henry@open-concept.pro>
+ * Copyright (C) 2014	   Juanjo Menent		<jmenent@2byte.es>
  *   
  * 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
@@ -44,7 +45,7 @@ $langs->load("accountancy");
 // Security check
 if ($user->societe_id > 0)
 	accessforbidden();
-if (! $user->rights->accounting->access)
+if (! $user->rights->accounting->ventilation->dispatch)
 	accessforbidden();
 
 $formventilation = new FormVentilation($db);
diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php
index 7cb53a99a8397346b5ac73ec661cc55b72c7818d..4bdf28672c19dc5d2d88686f185e319de1b7622a 100644
--- a/htdocs/accountancy/supplier/list.php
+++ b/htdocs/accountancy/supplier/list.php
@@ -3,6 +3,7 @@
  * Copyright (C) 2013-2014	Alexandre Spangaro		<alexandre.spangaro@gmail.com>
  * Copyright (C) 2014		Ari Elbaz (elarifr)		<github@accedinfo.com>  
  * Copyright (C) 2013-2014	Florian Henry			<florian.henry@open-concept.pro>
+ * Copyright (C) 2014		Juanjo Menent			<jmenent@2byte.es>s
  *
  * 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
@@ -45,7 +46,7 @@ $mesCasesCochees = GETPOST('mesCasesCochees', 'array');
 // Security check
 if ($user->societe_id > 0)
 	accessforbidden();
-if (! $user->rights->accounting->access)
+if (! $user->rights->accounting->ventilation->dispatch)
 	accessforbidden();
 
 $formventilation = new FormVentilation($db);
diff --git a/htdocs/adherents/canvas/actions_adherentcard_common.class.php b/htdocs/adherents/canvas/actions_adherentcard_common.class.php
index 9bd164a9b325dacb4e60f46ed11ea6bfc7975c64..79ba8597672a11454416f93d8d2738127232b3c8 100644
--- a/htdocs/adherents/canvas/actions_adherentcard_common.class.php
+++ b/htdocs/adherents/canvas/actions_adherentcard_common.class.php
@@ -130,7 +130,7 @@ abstract class ActionsAdherentCardCommon
                 }
                 else
                 {
-                    $this->errors=$nuser->error;
+                    $this->errors[]=$nuser->error;
 
                     $this->db->rollback();
                 }
diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php
index eade23f7a3a78e5365de35b458b1e71f5e874294..5b3dc089880a5ca708c2e5db00008fed5dda65db 100644
--- a/htdocs/adherents/card_subscriptions.php
+++ b/htdocs/adherents/card_subscriptions.php
@@ -276,7 +276,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
         $db->begin();
 
         // Create subscription
-        $crowid=$object->cotisation($datecotisation, $cotisation, $accountid, $operation, $label, $num_chq, $emetteur_nom, $emetteur_banque, $datesubend, $option);
+        $crowid=$object->cotisation($datecotisation, $cotisation, $accountid, $operation, $label, $num_chq, $emetteur_nom, $emetteur_banque, $datesubend);
         if ($crowid <= 0)
         {
             $error++;
diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php
index a866ecd9a70f261a81158cb1c6834ee5b5a3b54c..215f2eae069dfa928175eb685fa686df42b5dcb7 100644
--- a/htdocs/admin/menus/index.php
+++ b/htdocs/admin/menus/index.php
@@ -324,8 +324,8 @@ if ($conf->use_javascript_ajax)
 						'<strong> &nbsp; <a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">'.$titre.'</a></strong>'.
 						'</td><td align="right">'.
 						'<a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">'.img_edit('default',0,'class="menuEdit" id="edit'.$menu['rowid'].'"').'</a> '.
-						'<a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=create&menuId='.$menu['rowid'].'">'.img_edit_add('default',0,'class="menuNew" id="new'.$menu['rowid'].'"').'</a> '.
-						'<a href="index.php?menu_handler='.$menu_handler_to_search.'&action=delete&menuId='.$menu['rowid'].'">'.img_delete('default',0,'class="menuDel" id="del'.$menu['rowid'].'"').'</a> '.
+						'<a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=create&menuId='.$menu['rowid'].'">'.img_edit_add('default').'</a> '.
+						'<a href="index.php?menu_handler='.$menu_handler_to_search.'&action=delete&menuId='.$menu['rowid'].'">'.img_delete('default').'</a> '.
 						'<a href="index.php?menu_handler='.$menu_handler_to_search.'&action=up&menuId='.$menu['rowid'].'">'.img_picto("Monter","1uparrow").'</a><a href="index.php?menu_handler='.$menu_handler_to_search.'&action=down&menuId='.$menu['rowid'].'">'.img_picto("Descendre","1downarrow").'</a>'.
 						'</td></tr></table>'
 			);
diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php
index 2247df9493ee67c284ca53cfae331a68c6ab5bea..6094bb7e4f128682ada02a5e099caf6104542d6f 100644
--- a/htdocs/admin/prelevement.php
+++ b/htdocs/admin/prelevement.php
@@ -55,7 +55,7 @@ if ($action == "set")
     if (! $res > 0) $error++;
 
     $id=GETPOST('PRELEVEMENT_ID_BANKACCOUNT','int');
-    $account = new Account($db, $id);
+    $account = new Account($db);
 
     if($account->fetch($id)>0)
     {
diff --git a/htdocs/admin/triggers.php b/htdocs/admin/triggers.php
index fc9d0489e9ab2c4311b3f9a9f3f51fbadbbf2de7..85139b56ba92b52555f95d56c640956aec06de3d 100644
--- a/htdocs/admin/triggers.php
+++ b/htdocs/admin/triggers.php
@@ -50,7 +50,7 @@ print "<br>\n";
 $template_dir = DOL_DOCUMENT_ROOT.'/core/tpl/';
 
 $interfaces = new Interfaces($db);
-$triggers = $interfaces->getTriggersList(0,'priority');
+$triggers = $interfaces->getTriggersList();
 
 print '<table class="noborder">
 <tr class="liste_titre">
diff --git a/htdocs/categories/admin/categorie_extrafields.php b/htdocs/categories/admin/categorie_extrafields.php
index 2da54e77712dfa91993fe921fd9ebe842bd89de8..712f60f25cd2d13e1f4a30f7c3dea0835b9fa3b2 100644
--- a/htdocs/categories/admin/categorie_extrafields.php
+++ b/htdocs/categories/admin/categorie_extrafields.php
@@ -65,7 +65,7 @@ llxHeader('',$langs->trans("Categories"),$help_url);
 $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
 print_fiche_titre($langs->trans("CategoriesSetup"),$linkback,'setup');
 
-$head = categoriesadmin_prepare_head(null);
+$head = categoriesadmin_prepare_head();
 
 dol_fiche_head($head, 'attributes_categories', $langs->trans("Categories"), 0, 'category');
 
diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php
index 9ff2ce11871c9def1a9db4961a268f894931e714..a21f7a53699184ddc57daadec9284d50ff540a6c 100644
--- a/htdocs/categories/categorie.php
+++ b/htdocs/categories/categorie.php
@@ -396,7 +396,7 @@ else if ($id || $ref)
 		llxHeader("","",$langs->trans("Member"));
 
 
-		$head=member_prepare_head($member, $user);
+		$head=member_prepare_head($member);
 		$titre=$langs->trans("Member");
 		$picto='user';
 		dol_fiche_head($head, 'category', $titre,0,$picto);
@@ -471,7 +471,7 @@ else if ($id || $ref)
 		llxHeader("","",$langs->trans("Contact"));
 
 
-		$head=contact_prepare_head($object, $user);
+		$head=contact_prepare_head($object);
 		$titre=$langs->trans("ContactsAddresses");
 		$picto='contact';
 		dol_fiche_head($head, 'category', $titre,0,$picto);
diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index 426faf46297fa1ab87933c4b442a104880c09b83..d8619e696af6fd77812bf46d020fd09506e5a94a 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -1,6 +1,6 @@
 <?php
 /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
- * Copyright (C) 2004-2013 Laurent Destailleur  <eldy@users.sourceforge.net>
+ * Copyright (C) 2004-2014 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copyright (C) 2005      Simon TOSSER         <simon@kornog-computing.com>
  * Copyright (C) 2005-2012 Regis Houssin        <regis.houssin@capnetworks.com>
  * Copyright (C) 2010-2013 Juanjo Menent        <jmenent@2byte.es>
@@ -87,20 +87,37 @@ $hookmanager->initHooks(array('actioncard'));
  * Actions
  */
 
-if (GETPOST('addassignedtouser'))
+// Remove user to assigned list
+if (! empty($_POST['removedassigned']))
+{
+	$idtoremove=$_POST['removedassigned'];
+	if (! empty($_SESSION['assignedtouser'])) $tmpassigneduserids=dol_json_decode($_SESSION['assignedtouser'],1);
+	else $tmpassigneduserids=array();
+	unset($tmpassigneduserids[$idtoremove]);
+	//var_dump($_POST['removedassigned']);exit;
+	$_SESSION['assignedtouser']=dol_json_encode($tmpassigneduserids);
+	$donotclearsession=1;
+	if ($action == 'add') $action = 'create';
+	if ($action == 'update') $action = 'edit';
+}
+
+// Add user to assigned list
+if (GETPOST('addassignedtouser') || GETPOST('updateassignedtouser'))
 {
 	// Add a new user
 	if (GETPOST('affectedto') > 0)
 	{
 		$assignedtouser=array();
-		if (!empty($_SESSION['assignedtouser'])) $assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true);
+		if (! empty($_SESSION['assignedtouser'])) $assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true);
 		$assignedtouser[GETPOST('affectedto')]=array('transparency'=>GETPOST('transparency'),'mandatory'=>1);
 		$_SESSION['assignedtouser']=dol_json_encode($assignedtouser);
 	}
 	$donotclearsession=1;
-	$action='create';
+	if ($action == 'add') $action = 'create';
+	if ($action == 'update') $action = 'edit';
 }
-// Add action
+
+// Add event
 if ($action == 'add')
 {
 	$error=0;
@@ -131,22 +148,22 @@ if ($action == 'add')
 	// Check parameters
 	if (! $datef && $percentage == 100)
 	{
-		$error++;
+		$error++; $donotclearsession=1;
 		$action = 'create';
 		setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")), 'errors');
 	}
 
 	if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && ! GETPOST('label'))
 	{
-		$error++;
+		$error++; $donotclearsession=1;
 		$action = 'create';
 		setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Title")), 'errors');
 	}
 
 	// Initialisation objet cactioncomm
-	if (! GETPOST('actioncode'))
+	if (! GETPOST('actioncode') > 0)
 	{
-		$error++;
+		$error++; $donotclearsession=1;
 		$action = 'create';
 		setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors');
 	}
@@ -161,7 +178,6 @@ if ($action == 'add')
 	$object->priority = GETPOST("priority")?GETPOST("priority"):0;
 	$object->fulldayevent = (! empty($fulldayevent)?1:0);
 	$object->location = GETPOST("location");
-	$object->transparency = (GETPOST("transparency")=='on'?1:0);
 	$object->label = trim(GETPOST('label'));
 	$object->fk_element = GETPOST("fk_element");
 	$object->elementtype = GETPOST("elementtype");
@@ -186,18 +202,35 @@ if ($action == 'add')
 	$object->percentage = $percentage;
 	$object->duree=((float) (GETPOST('dureehour') * 60) + (float) GETPOST('dureemin')) * 60;
 
-	$usertodo=new User($db);
-	if ($_POST["affectedto"] > 0)
+	$listofuserid=dol_json_decode($_SESSION['assignedtouser']);
+	$i=0;
+	foreach($listofuserid as $key => $value)
 	{
-		$usertodo->fetch($_POST["affectedto"]);
+		if ($i == 0)	// First entry
+		{
+			$usertodo=new User($db);
+			if ($key > 0)
+			{
+				$usertodo->fetch($key);
+			}
+			$object->usertodo = $usertodo;
+			$object->transparency = (GETPOST("transparency")=='on'?1:0);
+		}
+
+		$object->userassigned[$key]=array('id'=>$key, 'transparency'=>(GETPOST("transparency")=='on'?1:0));
+
+		$i++;
 	}
-	$object->usertodo = $usertodo;
-	$userdone=new User($db);
-	if ($_POST["doneby"] > 0)
+
+	if (! empty($conf->global->AGENDA_ENABLE_DONEBY))
 	{
-		$userdone->fetch($_POST["doneby"]);
+		$userdone=new User($db);
+		if ($_POST["doneby"] > 0)
+		{
+			$userdone->fetch($_POST["doneby"]);
+		}
+		$object->userdone = $userdone;
 	}
-	$object->userdone = $userdone;
 
 	$object->note = trim($_POST["note"]);
 	if (isset($_POST["contactid"])) $object->contact = $contact;
@@ -214,16 +247,22 @@ if ($action == 'add')
 	if (! empty($conf->phenix->enabled) && GETPOST('add_phenix') == 'on') $object->use_phenix=1;
 
 	// Check parameters
+	if (empty($object->usertodo))
+	{
+		$error++; $donotclearsession=1;
+		$action = 'create';
+		setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ActionAffectedTo")), 'errors');
+	}
 	if ($object->type_code == 'AC_RDV' && ($datep == '' || ($datef == '' && empty($fulldayevent))))
 	{
-		$error++;
+		$error++; $donotclearsession=1;
 		$action = 'create';
 		setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")), 'errors');
 	}
 
 	if (! GETPOST('apyear') && ! GETPOST('adyear'))
 	{
-		$error++;
+		$error++; $donotclearsession=1;
 		$action = 'create';
 		setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")), 'errors');
 	}
@@ -265,42 +304,14 @@ if ($action == 'add')
 				$langs->load("errors");
 				$error=$langs->trans($object->error);
 				setEventMessage($error,'errors');
-				$action = 'create';
+				$action = 'create'; $donotclearsession=1;
 			}
 		}
 		else
 		{
 			$db->rollback();
-			$langs->load("errors");
-
-			if (! empty($object->error)) setEventMessage($langs->trans($object->error), 'errors');
-			if (count($object->errors)) setEventMessage($object->errors, 'errors');
-
-			$action = 'create';
-		}
-	}
-}
-
-/*
- * Action suppression de l'action
- */
-if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes')
-{
-	$object->fetch($id);
-
-	if ($user->rights->agenda->myactions->delete
-		|| $user->rights->agenda->allactions->delete)
-	{
-		$result=$object->delete();
-
-		if ($result >= 0)
-		{
-			header("Location: index.php");
-			exit;
-		}
-		else
-		{
-			setEventMessage($object->error,'errors');
+			setEventMessages($object->error, $object->errors, 'errors');
+			$action = 'create'; $donotclearsession=1;
 		}
 	}
 }
@@ -348,25 +359,59 @@ if ($action == 'update')
 
 		if (! $datef && $percentage == 100)
 		{
-			$error=$langs->trans("ErrorFieldRequired",$langs->trans("DateEnd"));
+			$error++; $donotclearsession=1;
+			setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")),$object->errors,'errors');
 			$action = 'edit';
 		}
 
 		// Users
-		$usertodo=new User($db);
-		if ($_POST["affectedto"])
+		$listofuserid=dol_json_decode($_SESSION['assignedtouser']);
+		$i=0;
+		foreach($listofuserid as $key => $value)
+		{
+			if ($i == 0)	// First entry
+			{
+				$usertodo=new User($db);
+				if ($key > 0)
+				{
+					$usertodo->fetch($key);
+				}
+				$object->usertodo = $usertodo;
+				$object->transparency=(GETPOST("transparency")=='on'?1:0);
+			}
+
+			$object->userassigned[$key]=array('id'=>$key, 'transparency'=>(GETPOST("transparency")=='on'?1:0));
+
+			$i++;
+		}
+
+		if (! empty($conf->global->AGENDA_ENABLE_DONEBY))
 		{
-			$usertodo->fetch($_POST["affectedto"]);
+			$userdone=new User($db);
+			if ($_POST["doneby"])
+			{
+				$userdone->fetch($_POST["doneby"]);
+			}
+			$object->userdone = $userdone;
 		}
-		$object->usertodo = $usertodo;
-		$object->transparency=(GETPOST("transparency")=='on'?1:0);
 
-		$userdone=new User($db);
-		if ($_POST["doneby"])
+		// Check parameters
+		if (! GETPOST('actioncode') > 0)
 		{
-			$userdone->fetch($_POST["doneby"]);
+			$error++; $donotclearsession=1;
+			$action = 'edit';
+			setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors');
+		}
+		else
+		{
+			$result=$cactioncomm->fetch(GETPOST('actioncode'));
+		}
+		if (empty($object->usertodo))
+		{
+			$error++; $donotclearsession=1;
+			$action = 'edit';
+			setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ActionAffectedTo")), 'errors');
 		}
-		$object->userdone = $userdone;
 
 		// Fill array 'array_options' with data from add form
 		$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
@@ -383,17 +428,13 @@ if ($action == 'update')
 			}
 			else
 			{
+				setEventMessages($object->error,$object->errors,'errors');
 				$db->rollback();
 			}
 		}
 	}
 
-	if ($result < 0)
-	{
-		setEventMessage($object->error,'errors');
-		setEventMessage($object->errors,'errors');
-	}
-	else
+	if (! $error)
 	{
         if (! empty($backtopage))
         {
@@ -403,6 +444,30 @@ if ($action == 'update')
 	}
 }
 
+/*
+ * delete event
+ */
+if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes')
+{
+	$object->fetch($id);
+
+	if ($user->rights->agenda->myactions->delete
+		|| $user->rights->agenda->allactions->delete)
+	{
+		$result=$object->delete();
+
+		if ($result >= 0)
+		{
+			header("Location: index.php");
+			exit;
+		}
+		else
+		{
+			setEventMessages($object->error,$object->errors,'errors');
+		}
+	}
+}
+
 /*
  * Action move update, used when user move an event in calendar by drag'n drop
  */
@@ -576,15 +641,14 @@ if ($action == 'create')
     print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" size="50" value="'.(GETPOST('location')?GETPOST('location'):$object->location).'"></td></tr>';
 
 	// Assigned to
-	$var=false;
 	print '<tr><td class="nowrap">'.$langs->trans("ActionAffectedTo").'</td><td>';
 	if (empty($donotclearsession))
 	{
 		$assignedtouser=GETPOST("affectedtouser")?GETPOST("affectedtouser"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : $user->id);
 		$_SESSION['assignedtouser']=dol_json_encode(array($assignedtouser=>array('transparency'=>1,'mandatory'=>1)));
 	}
-	//print $form->select_dolusers_forevent('affectedto',1);
-	print $form->select_dolusers(GETPOST("affectedto")?GETPOST("affectedto"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : $user->id),'affectedto',1);
+	print $form->select_dolusers_forevent(($action=='create'?'add':'update'),'affectedto',1);
+	//print $form->select_dolusers(GETPOST("affectedto")?GETPOST("affectedto"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : $user->id),'affectedto',1);
 	print '</td></tr>';
 
 	print '</table>';
@@ -599,7 +663,7 @@ if ($action == 'create')
 	print '</td></tr>';
 
 	// Realised by
-	if ($conf->global->AGENDA_ENABLE_DONEBY)
+	if (! empty($conf->global->AGENDA_ENABLE_DONEBY))
 	{
 		print '<tr><td class="nowrap">'.$langs->trans("ActionDoneBy").'</td><td>';
 		print $form->select_dolusers(GETPOST("doneby")?GETPOST("doneby"):(! empty($object->userdone->id) && $percent==100?$object->userdone->id:0),'doneby',1);
@@ -704,11 +768,6 @@ if ($action == 'create')
 // View or edit
 if ($id > 0)
 {
-	if ($error)
-	{
-		dol_htmloutput_errors($error);
-	}
-
 	$result=$object->fetch($id);
 	$object->fetch_optionals($id,$extralabels);
 
@@ -833,7 +892,14 @@ if ($id > 0)
 
 		// Assigned to
 		print '<tr><td class="nowrap">'.$langs->trans("ActionAffectedTo").'</td><td colspan="3">';
-		print $form->select_dolusers($object->usertodo->id>0?$object->usertodo->id:-1,'affectedto',1);
+		$listofuserid=array();
+		if (empty($donotclearsession))
+		{
+			if (is_object($object->usertodo)) $listofuserid[$object->usertodo->id]=array('id'=>$object->usertodo->id,'transparency'=>$object->transparency);
+			$_SESSION['assignedtouser']=dol_json_encode($listofuserid);
+		}
+		print $form->select_dolusers_forevent(($action=='create'?'add':'update'),'affectedto',1);
+		//print $form->select_dolusers($object->usertodo->id>0?$object->usertodo->id:-1,'affectedto',1);
 		print '</td></tr>';
 
         print '</table><br><br><table class="border" width="100%">';
@@ -844,7 +910,7 @@ if ($id > 0)
 		print '</td></tr>';
 
 		// Realised by
-		if ($conf->global->AGENDA_ENABLE_DONEBY)
+		if (! empty($conf->global->AGENDA_ENABLE_DONEBY))
 		{
 			print '<tr><td class="nowrap">'.$langs->trans("ActionDoneBy").'</td><td colspan="3">';
 			print $form->select_dolusers($object->userdone->id> 0?$object->userdone->id:-1,'doneby',1);
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index 8bf2a1036bf25e4e04b2c19d9ffce5b6823660f3..adc3e8d5aee0cccde614281a38d5c87767ffb9bb 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -57,12 +57,14 @@ class ActionComm extends CommonObject
     var $punctual = 1;        // Milestone
     var $percentage;    // Percentage
     var $location;      // Location
+
 	var $transparency;	// Transparency (ical standard). Used to say if people assigned to event are busy or not by event. 0=available, 1=busy, 2=busy (refused events)
     var $priority;      // Small int (0 By default)
     var $note;          // Description
 
-    var $usertodo;		// Object user that must do action
-    var $userdone;	 	// Object user that did action
+	var $userassigned;	// Array of user ids
+    var $usertodo;		// Object user of owner
+    var $userdone;	 	// Object user that did action (deprecated)
 
     var $societe;		// Company linked to action (optional)
     var $contact;		// Contact linked to action (optional)
@@ -89,10 +91,10 @@ class ActionComm extends CommonObject
     {
         $this->db = $db;
 
-        $this->author = new stdClass();
-        $this->usermod = new stdClass();
-        $this->usertodo = new stdClass();
-        $this->userdone = new stdClass();
+        //$this->author = new stdClass();
+        //$this->usermod = new stdClass();
+        //$this->usertodo = new stdClass();
+        //$this->userdone = new stdClass();
         $this->societe = new stdClass();
         $this->contact = new stdClass();
     }
@@ -258,9 +260,10 @@ class ActionComm extends CommonObject
      *    Load object from database
      *
      *    @param	int		$id     Id of action to get
+     *    @param	string	$ref    Ref of action to get
      *    @return	int				<0 if KO, >0 if OK
      */
-    function fetch($id)
+    function fetch($id, $ref='')
     {
         global $langs;
 
@@ -286,7 +289,9 @@ class ActionComm extends CommonObject
         $sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a)";
         $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author";
         $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc";
-        $sql.= " WHERE a.id=".$id." AND a.fk_action=c.id";
+        $sql.= " WHERE a.fk_action=c.id";
+        if ($ref) $sql.= " AND a.id=".$ref;		// No field ref, we use id
+        else $sql.= " AND a.id=".$id;
 
         dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
         $resql=$this->db->query($sql);
diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php
index c3f28a36ed626ab36b69c2ef7957292ded049e16..5ad90cd24de671ec47175aaca4dab5609fd5e9ed 100644
--- a/htdocs/comm/card.php
+++ b/htdocs/comm/card.php
@@ -327,11 +327,11 @@ if ($id > 0)
 	print '</td><td colspan="3">';
 	if ($action == 'editconditions')
 	{
-		$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->cond_reglement_id,'cond_reglement_id',-1,1);
+		$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id',1);
 	}
 	else
 	{
-		$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->cond_reglement_id,'none');
+		$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_id, 'none');
 	}
 	print "</td>";
 	print '</tr>';
diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php
index e511a163c7902889ccdbfb08f7e762b7efa41479..81596540489d49aae5f20b4a8f0debebb7ed2f53 100644
--- a/htdocs/compta/bank/card.php
+++ b/htdocs/compta/bank/card.php
@@ -102,7 +102,7 @@ if ($_POST["action"] == 'add')
 
     if (! $error)
     {
-        $id = $account->create($user->id);
+        $id = $account->create($user);
         if ($id > 0)
         {
             $_GET["id"]=$id;            // Force chargement page en mode visu
@@ -306,7 +306,7 @@ if ($action == 'create')
 	$doleditor=new DolEditor('account_comment',$account->comment,'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,70);
 	$doleditor->Create();
 	print '</td></tr>';
-	
+
 	print '</table>';
 
 	print '<br>';
@@ -510,7 +510,7 @@ else
         $account->fetch(GETPOST('id','int'));
 
         print_fiche_titre($langs->trans("EditFinancialAccount"));
-        
+
         if ($conf->use_javascript_ajax)
         {
             print "\n".'<script type="text/javascript" language="javascript">';
@@ -614,7 +614,7 @@ else
 		$doleditor=new DolEditor('account_comment',(isset($_POST["account_comment"])?$_POST["account_comment"]:$account->comment),'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,70);
 		$doleditor->Create();
 		print '</td></tr>';
-		
+
 		print '</table>';
 
 		print '<br>';
@@ -635,7 +635,7 @@ else
 		// Accountancy journal
         print '<tr><td valign="top">'.$langs->trans("AccountancyJournal").'</td>';
         print '<td colspan="3"><input type="text" name="accountancy_journal" value="'.(isset($_POST["accountancy_journal"])?$_POST["accountancy_journal"]:$account->accountancy_journal).'"></td></tr>';
-		
+
 		print '</table>';
 
 		print '<center><br><input value="'.$langs->trans("Modify").'" type="submit" class="button">';
diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php
index 96ab643623bafa4876af9c7707c53a7fdcb54be0..e2a039cf2d8121071e08fce1a54e68bdf3fa5d74 100644
--- a/htdocs/compta/bank/class/account.class.php
+++ b/htdocs/compta/bank/class/account.class.php
@@ -338,9 +338,10 @@ class Account extends CommonObject
     /**
      *  Create bank account into database
      *
+     *  @param	User	$user		Object user making creation
      *  @return int        			< 0 if KO, > 0 if OK
      */
-    function create()
+    function create($user='')
     {
         global $langs,$conf;
 
@@ -665,10 +666,9 @@ class Account extends CommonObject
                 return 1;
             }
             else
-            {
+			{
                 return 0;
             }
-            $this->db->free($result);
         }
         else
         {
diff --git a/htdocs/compta/bank/rappro.php b/htdocs/compta/bank/rappro.php
index c926c0414f63a7acfb832636c1d174c1273554f1..70e2be1cfd4500f12b328835c0eab294e52ca406 100644
--- a/htdocs/compta/bank/rappro.php
+++ b/htdocs/compta/bank/rappro.php
@@ -263,11 +263,13 @@ if ($resql)
 		{
 			print '<td align="center" class="nowrap">';
 			print '<span id="datevalue_'.$objp->rowid.'">'.dol_print_date($db->jdate($objp->dv),"day")."</span>";
-			print ' <span>&nbsp; ';
+			print ' &nbsp';
+			print '<span>';
 			print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=dvprev&amp;account='.$acct->id.'&amp;rowid='.$objp->rowid.'">';
 			print img_edit_remove() . "</a> ";
 			print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=dvnext&amp;account='.$acct->id.'&amp;rowid='.$objp->rowid.'">';
-			print img_edit_add() ."</a></span>";
+			print img_edit_add() ."</a>";
+			print '</span>';
 			print '</td>';
 		}
 		else
diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php
index d4402b03a55e9beaf9c2de5a465b37cd79936a42..48d8c05ff0c2e8107b1859727072111795c7666e 100644
--- a/htdocs/compta/deplacement/class/deplacement.class.php
+++ b/htdocs/compta/deplacement/class/deplacement.class.php
@@ -222,13 +222,16 @@ class Deplacement extends CommonObject
 	* Load an object from database
 	*
 	* @param	int		$id		Id of record to load
+	* @param	string	$ref	Ref of record
 	* @return	int				<0 if KO, >0 if OK
 	*/
-	function fetch($id)
+	function fetch($id, $ref='')
 	{
 		$sql = "SELECT rowid, fk_user, type, fk_statut, km, fk_soc, dated, note_private, note_public, fk_projet, extraparams";
 		$sql.= " FROM ".MAIN_DB_PREFIX."deplacement";
-		$sql.= " WHERE rowid = ".$id;
+		$sql.= " WHERE entity IN (".getEntity('deplacement').")";
+		if ($ref) $sql.= " AND ref ='".$this->db->escape($ref)."'";
+		else $sql.= " AND id = ".$id;
 
 		dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
 		$result = $this->db->query($sql);
diff --git a/htdocs/compta/deplacement/document.php b/htdocs/compta/deplacement/document.php
index 163242ed08ab815a61f3d5f5a91172a93ba0dcb0..b6b1cbfa277dfbdec7eeda7372d9c3c08b453c49 100644
--- a/htdocs/compta/deplacement/document.php
+++ b/htdocs/compta/deplacement/document.php
@@ -88,7 +88,7 @@ if ($object->id)
 {
 	$object->fetch_thirdparty();
 
-	$head=trip_prepare_head($object, $user);
+	$head=trip_prepare_head($object);
 
 	dol_fiche_head($head, 'documents',  $langs->trans("TripCard"), 0, 'trip');
 
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 3c73a6610e503408ad25bedc7f56e08de434b250..f1c2f526b96f5acef938611d1c1d2b889f731340 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -171,11 +171,12 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fact
 }
 
 // Delete line
-else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->facture->creer) {
+else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->facture->creer)
+{
 	$object->fetch($id);
 	$object->fetch_thirdparty();
 
-	$result = $object->deleteline($_GET ['lineid'], $user);
+	$result = $object->deleteline(GETPOST('lineid'));
 	if ($result > 0) {
 		// Define output language
 		$outputlangs = $langs;
@@ -203,14 +204,16 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->
 }
 
 // Delete link of credit note to invoice
-else if ($action == 'unlinkdiscount' && $user->rights->facture->creer) {
+else if ($action == 'unlinkdiscount' && $user->rights->facture->creer)
+{
 	$discount = new DiscountAbsolute($db);
-	$result = $discount->fetch($_GET ["discountid"]);
+	$result = $discount->fetch(GETPOST("discountid"));
 	$discount->unlink_invoice();
 }
 
 // Validation
-else if ($action == 'valid' && $user->rights->facture->creer) {
+else if ($action == 'valid' && $user->rights->facture->creer)
+{
 	$object->fetch($id);
 
 	// On verifie signe facture
@@ -229,7 +232,8 @@ else if ($action == 'valid' && $user->rights->facture->creer) {
 	}
 }
 
-else if ($action == 'set_thirdparty' && $user->rights->facture->creer) {
+else if ($action == 'set_thirdparty' && $user->rights->facture->creer)
+{
 	$object->fetch($id);
 	$object->setValueFrom('fk_soc', $socid);
 
@@ -237,12 +241,14 @@ else if ($action == 'set_thirdparty' && $user->rights->facture->creer) {
 	exit();
 }
 
-else if ($action == 'classin' && $user->rights->facture->creer) {
+else if ($action == 'classin' && $user->rights->facture->creer)
+{
 	$object->fetch($id);
 	$object->setProject($_POST['projectid']);
 }
 
-else if ($action == 'setmode' && $user->rights->facture->creer) {
+else if ($action == 'setmode' && $user->rights->facture->creer)
+{
 	$object->fetch($id);
 	$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
 	if ($result < 0)
@@ -268,7 +274,8 @@ else if ($action == 'setinvoicedate' && $user->rights->facture->creer)
 	if ($result < 0) dol_print_error($db, $object->error);
 }
 
-else if ($action == 'setconditions' && $user->rights->facture->creer) {
+else if ($action == 'setconditions' && $user->rights->facture->creer)
+{
 	$object->fetch($id);
 	$object->cond_reglement_code = 0; // To clean property
 	$object->cond_reglement_id = 0; // To clean property
@@ -283,7 +290,8 @@ else if ($action == 'setconditions' && $user->rights->facture->creer) {
 	if ($result < 0) dol_print_error($db, $object->error);
 }
 
-else if ($action == 'setpaymentterm' && $user->rights->facture->creer) {
+else if ($action == 'setpaymentterm' && $user->rights->facture->creer)
+{
 	$object->fetch($id);
 	$object->date_lim_reglement = dol_mktime(12, 0, 0, $_POST['paymenttermmonth'], $_POST['paymenttermday'], $_POST['paymenttermyear']);
 	if ($object->date_lim_reglement < $object->date) {
@@ -295,7 +303,8 @@ else if ($action == 'setpaymentterm' && $user->rights->facture->creer) {
 		dol_print_error($db, $object->error);
 }
 
-else if ($action == 'setrevenuestamp' && $user->rights->facture->creer) {
+else if ($action == 'setrevenuestamp' && $user->rights->facture->creer)
+{
 	$object->fetch($id);
 	$object->revenuestamp = GETPOST('revenuestamp');
 	$result = $object->update($user);
@@ -305,16 +314,19 @@ else if ($action == 'setrevenuestamp' && $user->rights->facture->creer) {
 }
 
 // bank account
-else if ($action == 'setbankaccount' && $user->rights->facture->creer) {
+else if ($action == 'setbankaccount' && $user->rights->facture->creer)
+{
     $result=$object->setBankAccount(GETPOST('fk_account', 'int'));
 }
 
-else if ($action == 'setremisepercent' && $user->rights->facture->creer) {
+else if ($action == 'setremisepercent' && $user->rights->facture->creer)
+{
 	$object->fetch($id);
 	$result = $object->set_remise($user, $_POST['remise_percent']);
 }
 
-else if ($action == "setabsolutediscount" && $user->rights->facture->creer) {
+else if ($action == "setabsolutediscount" && $user->rights->facture->creer)
+{
 	// POST[remise_id] ou POST[remise_id_for_payment]
 	if (! empty($_POST["remise_id"])) {
 		$ret = $object->fetch($id);
@@ -339,7 +351,8 @@ else if ($action == "setabsolutediscount" && $user->rights->facture->creer) {
 	}
 }
 
-else if ($action == 'set_ref_client' && $user->rights->facture->creer) {
+else if ($action == 'set_ref_client' && $user->rights->facture->creer)
+{
 	$object->fetch($id);
 	$object->set_ref_client($_POST['ref_client']);
 }
@@ -359,7 +372,8 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu
 	{
 		$idprof_mandatory = 'SOCIETE_IDPROF' . ($i) . '_INVOICE_MANDATORY';
 		$idprof = 'idprof' . $i;
-		if (! $object->thirdparty->$idprof && ! empty($conf->global->$idprof_mandatory)) {
+		if (! $object->thirdparty->$idprof && ! empty($conf->global->$idprof_mandatory))
+		{
 			if (! $error)
 				$langs->load("errors");
 			$error ++;
@@ -376,7 +390,8 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu
 	}
 
 	// Check for warehouse
-	if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change) {
+	if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change)
+	{
 		if (! $idwarehouse || $idwarehouse == - 1) {
 			$error ++;
 			setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), 'errors');
@@ -412,7 +427,8 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu
 }
 
 // Go back to draft status (unvalidate)
-else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->facture->valider) || $user->rights->facture->invoice_advance->unvalidate)) {
+else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->facture->valider) || $user->rights->facture->invoice_advance->unvalidate))
+{
 	$idwarehouse = GETPOST('idwarehouse');
 
 	$object->fetch($id);
@@ -426,7 +442,8 @@ else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_
 	}
 
 	// Check parameters
-	if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change) {
+	if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change)
+	{
 		if (! $idwarehouse || $idwarehouse == - 1) {
 			$error ++;
 			setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), 'errors');
@@ -460,7 +477,8 @@ else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_
 		$ventilExportCompta = $object->getVentilExportCompta();
 
 		// On verifie si aucun paiement n'a ete effectue
-		if ($resteapayer == $object->total_ttc && $object->paye == 0 && $ventilExportCompta == 0) {
+		if ($resteapayer == $object->total_ttc && $object->paye == 0 && $ventilExportCompta == 0)
+		{
 			$result=$object->set_draft($user, $idwarehouse);
 			if ($result<0) setEventMessage($object->error,'errors');
 
@@ -484,12 +502,14 @@ else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_
 }
 
 // Classify "paid"
-else if ($action == 'confirm_paid' && $confirm == 'yes' && $user->rights->facture->paiement) {
+else if ($action == 'confirm_paid' && $confirm == 'yes' && $user->rights->facture->paiement)
+{
 	$object->fetch($id);
 	$result = $object->set_paid($user);
 	if ($result<0) setEventMessage($object->error,'errors');
 } // Classif "paid partialy"
-else if ($action == 'confirm_paid_partially' && $confirm == 'yes' && $user->rights->facture->paiement) {
+else if ($action == 'confirm_paid_partially' && $confirm == 'yes' && $user->rights->facture->paiement)
+{
 	$object->fetch($id);
 	$close_code = $_POST["close_code"];
 	$close_note = $_POST["close_note"];
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index c46f48ed1c6cee3c19d09a2b1543f5348d9d695d..c4b548c7e81553a920553bdf9aace3663aed860c 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -484,7 +484,7 @@ class Facture extends CommonInvoice
 
                     // Call trigger
                     $result=$this->call_trigger('BILL_CREATE',$user);
-                    if ($result < 0) $error++;             
+                    if ($result < 0) $error++;
                     // End call triggers
 
 					if (! $error)
@@ -593,8 +593,8 @@ class Facture extends CommonInvoice
 
 		// Load source object
 		$objFrom = dol_clone($this);
-		
-		
+
+
 
 		// Change socid if needed
 		if (! empty($socid) && $socid != $this->socid)
@@ -637,7 +637,7 @@ class Facture extends CommonInvoice
 				unset($this->products[$i]);	// Tant que products encore utilise
 			}
 		}
-		
+
 		// Create clone
 		$result=$this->create($user);
 		if ($result < 0) $error++;
@@ -645,7 +645,7 @@ class Facture extends CommonInvoice
 			// copy internal contacts
 			if ($this->copy_linked_contact($objFrom, 'internal') < 0)
 				$error++;
-			
+
 			// copy external contacts if same company
 			elseif ($objFrom->socid == $this->socid)
 			{
@@ -667,7 +667,7 @@ class Facture extends CommonInvoice
 
             // Call trigger
             $result=$this->call_trigger('BILL_CLONE',$user);
-            if ($result < 0) $error++;             
+            if ($result < 0) $error++;
             // End call triggers
 		}
 
@@ -1108,7 +1108,7 @@ class Facture extends CommonInvoice
 			{
 	            // Call trigger
 	            $result=$this->call_trigger('BILL_MODIFY',$user);
-	            if ($result < 0) $error++;             
+	            if ($result < 0) $error++;
 	            // End call triggers
 			}
 		}
@@ -1266,7 +1266,7 @@ class Facture extends CommonInvoice
 		{
             // Call trigger
             $result=$this->call_trigger('BILL_DELETE',$user);
-            if ($result < 0) $error++;             
+            if ($result < 0) $error++;
             // End call triggers
 		}
 
@@ -1438,7 +1438,7 @@ class Facture extends CommonInvoice
 			{
 	            // Call trigger
 	            $result=$this->call_trigger('BILL_PAYED',$user);
-	            if ($result < 0) $error++;             
+	            if ($result < 0) $error++;
 	            // End call triggers
 			}
 			else
@@ -1490,7 +1490,7 @@ class Facture extends CommonInvoice
 		{
             // Call trigger
             $result=$this->call_trigger('BILL_UNPAYED',$user);
-            if ($result < 0) $error++;             
+            if ($result < 0) $error++;
             // End call triggers
 		}
 		else
@@ -1554,7 +1554,7 @@ class Facture extends CommonInvoice
 	            // Call trigger
 	            $result=$this->call_trigger('BILL_CANCEL',$user);
 	            if ($result < 0)
-	            {             
+	            {
 					$this->db->rollback();
 					return -1;
 				}
@@ -1768,11 +1768,11 @@ class Facture extends CommonInvoice
 			{
 	            // Call trigger
 	            $result=$this->call_trigger('BILL_VALIDATE',$user);
-	            if ($result < 0) $error++;    
-	            //TODO: Restoring ref, facnumber, statut, brouillon to previous value if trigger fail           
+	            if ($result < 0) $error++;
+	            //TODO: Restoring ref, facnumber, statut, brouillon to previous value if trigger fail
 	            // End call triggers
 			}
-			
+
 			// Set new ref and define current statut
 			if (! $error)
 			{
@@ -1856,7 +1856,7 @@ class Facture extends CommonInvoice
 				$this->statut = 0;
 	            // Call trigger
 	            $result=$this->call_trigger('BILL_UNVALIDATE',$user);
-	            if ($result < 0)              
+	            if ($result < 0)
 				{
 					$error++;
 					$this->statut=$old_statut;
@@ -3164,7 +3164,7 @@ class Facture extends CommonInvoice
 		$sql.= ' p.ref as product_ref, p.fk_product_type, p.label as product_label,';
 		$sql.= ' p.description as product_desc';
 		$sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as l';
-		$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON l.fk_product=p.rowid';
+		$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product=p.rowid';
 		$sql.= ' WHERE l.fk_facture = '.$this->id;
 		$sql.= ' ORDER BY l.rang ASC, l.rowid';
 
@@ -3550,7 +3550,7 @@ class FactureLigne  extends CommonInvoiceLine
                 // Call trigger
                 $result=$this->call_trigger('LINEBILL_INSERT',$user);
                 if ($result < 0)
-                {            
+                {
 					$this->db->rollback();
 					return -2;
 				}
@@ -3661,7 +3661,7 @@ class FactureLigne  extends CommonInvoiceLine
 			{
                 // Call trigger
                 $result=$this->call_trigger('LINEBILL_UPDATE',$user);
-                if ($result < 0)            
+                if ($result < 0)
  				{
 					$this->db->rollback();
 					return -2;
@@ -3691,7 +3691,7 @@ class FactureLigne  extends CommonInvoiceLine
 		$error=0;
 
 		$this->db->begin();
-		
+
 		// Call trigger
 		$result=$this->call_trigger('LINEBILL_DELETE',$user);
 		if ($result < 0)
@@ -3700,7 +3700,7 @@ class FactureLigne  extends CommonInvoiceLine
 			return -1;
 		}
 		// End call triggers
-		
+
 
 		$sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = ".$this->rowid;
 		dol_syslog(get_class($this)."::delete", LOG_DEBUG);
diff --git a/htdocs/compta/journal/purchasesjournal.php b/htdocs/compta/journal/purchasesjournal.php
index 81ceeb6f39d75be0a212f80ae905d4447c35356e..169fb32010aeb96023ab38570c909521447769df 100644
--- a/htdocs/compta/journal/purchasesjournal.php
+++ b/htdocs/compta/journal/purchasesjournal.php
@@ -104,11 +104,11 @@ $sql.= " fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_t
 $sql.= " s.rowid as socid, s.nom as name, s.code_compta_fournisseur,";
 $sql.= " p.rowid as pid, p.ref as ref, p.accountancy_code_buy,";
 $sql.= " ct.accountancy_code_buy as account_tva, ct.recuperableonly";
-$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn_det fd";
-$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND fd.info_bits = ct.recuperableonly AND ct.fk_pays = '".$idpays."'";
-$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product";
-$sql.= " JOIN ".MAIN_DB_PREFIX."facture_fourn f ON f.rowid = fd.fk_facture_fourn";
-$sql.= " JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = f.fk_soc" ;
+$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as fd";
+$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva as ct ON fd.tva_tx = ct.taux AND fd.info_bits = ct.recuperableonly AND ct.fk_pays = '".$idpays."'";
+$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product";
+$sql.= " JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = fd.fk_facture_fourn";
+$sql.= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc" ;
 $sql.= " WHERE f.fk_statut > 0 AND f.entity = ".$conf->entity;
 if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2)";
 else $sql.= " AND f.type IN (0,1,2,3)";
diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php
index 6e65446bdda8d8b5a305cc9a4279982985ec48ea..f90add66b54e4ae8b7a05de9beba2d065dbcfb32 100644
--- a/htdocs/compta/journal/sellsjournal.php
+++ b/htdocs/compta/journal/sellsjournal.php
@@ -105,10 +105,10 @@ $sql.= " fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc, fd
 $sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.client,";
 $sql.= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell,";
 $sql.= " ct.accountancy_code_sell as account_tva, ct.recuperableonly";
-$sql.= " FROM ".MAIN_DB_PREFIX."facturedet fd";
-$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product";
-$sql.= " JOIN ".MAIN_DB_PREFIX."facture f ON f.rowid = fd.fk_facture";
-$sql.= " JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = f.fk_soc";
+$sql.= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
+$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product";
+$sql.= " JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture";
+$sql.= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
 $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND fd.info_bits = ct.recuperableonly AND ct.fk_pays = '".$idpays."'";
 $sql.= " WHERE f.entity = ".$conf->entity;
 $sql.= " AND f.fk_statut > 0";
diff --git a/htdocs/compta/paiement/info.php b/htdocs/compta/paiement/info.php
index 8cc06397e6286c1e2da8f2610792bedcbd42c091..84ef52c3a80c762c111dff56e35fd28c89381b97 100644
--- a/htdocs/compta/paiement/info.php
+++ b/htdocs/compta/paiement/info.php
@@ -31,6 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
 $langs->load("bills");
 $langs->load("companies");
 
+$id=GETPOST('id');
+
 
 /*
  * View
@@ -39,8 +41,8 @@ $langs->load("companies");
 llxHeader();
 
 $paiement = new Paiement($db);
-$paiement->fetch($_GET["id"], $user);
-$paiement->info($_GET["id"]);
+$paiement->fetch($id);
+$paiement->info($id);
 
 $head = payment_prepare_head($paiement);
 
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 73955bb82fc6117bd5f64dbd19b514f9de12c908..357270efb2d3c369eb191eed76fe57a1a0820a0b 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -1276,6 +1276,7 @@ class Form
     /**
      *	Return select list of users. Selected users are stored into session.
      *
+     *  @param  string	$action         Value for $action
      *  @param  string	$htmlname       Field name in form
      *  @param  int		$show_empty     0=liste sans valeur nulle, 1=ajoute valeur inconnue
      *  @param  array	$exclude        Array list of users id to exclude
@@ -1289,7 +1290,7 @@ class Form
      * 	@return	string					HTML select string
      *  @see select_dolgroups
      */
-    function select_dolusers_forevent($htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='')
+    function select_dolusers_forevent($action='', $htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='')
     {
         global $conf,$user,$langs;
 
@@ -1297,18 +1298,24 @@ class Form
 
         // Method with no ajax
         //$out.='<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
-		$out.=$this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter);
-		$out.='<input type="submit" class="button" name="addassignedtouser" value="'.dol_escape_htmltag($langs->trans("Add")).'">';
+		$out.='<input type="hidden" class="removedassignedhidden" name="removedassigned" value="">';
+		$out.='<script type="text/javascript" language="javascript">jQuery(document).ready(function () {    jQuery(".removedassigned").click(function() {        jQuery(".removedassignedhidden").val(jQuery(this).val());    });})</script>';
+        $out.=$this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter);
+		$out.='<input type="submit" class="button" name="'.$action.'assignedtouser" value="'.dol_escape_htmltag($langs->trans("Add")).'">';
 		$assignedtouser=array();
 		if (!empty($_SESSION['assignedtouser'])) $assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true);
 		if (count($assignedtouser)) $out.='<br>';
+		$i=0;
 		foreach($assignedtouser as $key => $value)
 		{
 			$userstatic->fetch($key);
 			$out.=$userstatic->getNomUrl(1);
+			if ($i == 0) $out.=' ('.$langs->trans("Owner").')';
+			$out.=' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 0, 1).'" value="'.$userstatic->id.'" class="removedassigned" id="removedassigned_'.$userstatic->id.'" name="removedassigned_'.$userstatic->id.'">';
 			//$out.=' '.($value['mandatory']?$langs->trans("Mandatory"):$langs->trans("Optional"));
 			//$out.=' '.($value['transparency']?$langs->trans("Busy"):$langs->trans("NotBusy"));
 			$out.='<br>';
+			$i++;
 		}
 
 		//$out.='</form>';
@@ -3043,7 +3050,7 @@ class Form
      *  @param	int		$page        	Page
      *  @param  string	$selected    	Id condition pre-selectionne
      *  @param  string	$htmlname    	Name of select html field
-     *	@param	int		$addempty		Ajoute entree vide
+     *	@param	int		$addempty		Add empty entry
      *  @return	void
      */
     function form_conditions_reglement($page, $selected='', $htmlname='cond_reglement_id', $addempty=0)
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 68d0f4e7639fa82027af27fc7957ef299ae2b490..dc87e64950db3ce1a4a12004f0e8131b4399200d 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -1940,29 +1940,31 @@ function img_pdf($titlealt = 'default', $size = 3)
  *	Show logo +
  *
  *	@param	string	$titlealt   Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
+ *	@param  string	$other      Add more attributes on img
  *	@return string      		Return tag img
  */
-function img_edit_add($titlealt = 'default')
+function img_edit_add($titlealt = 'default', $other = '')
 {
 	global $conf, $langs;
 
 	if ($titlealt == 'default') $titlealt = $langs->trans('Add');
 
-	return img_picto($titlealt, 'edit_add.png');
+	return img_picto($titlealt, 'edit_add.png', $other);
 }
 /**
  *	Show logo -
  *
  *	@param	string	$titlealt	Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
+ *	@param  string	$other      Add more attributes on img
  *	@return string      		Return tag img
  */
-function img_edit_remove($titlealt = 'default')
+function img_edit_remove($titlealt = 'default', $other='')
 {
 	global $conf, $langs;
 
 	if ($titlealt == 'default') $titlealt = $langs->trans('Remove');
 
-	return img_picto($titlealt, 'edit_remove.png');
+	return img_picto($titlealt, 'edit_remove.png', $other);
 }
 
 /**
@@ -2265,9 +2267,9 @@ function img_search($titlealt = 'default', $other = '')
 	global $conf, $langs;
 
 	if ($titlealt == 'default') $titlealt = $langs->trans('Search');
-	
+
 	$img = img_picto($titlealt, 'search.png', $other, false, 1);
-	
+
 	$input = '<input type="image" class="liste_titre" name="button_search" src="'.$img.'" ';
 	$input.= 'value="'.dol_escape_htmltag($titlealt).'" title="'.dol_escape_htmltag($titlealt).'" >';
 
@@ -2286,9 +2288,9 @@ function img_searchclear($titlealt = 'default', $other = '')
 	global $conf, $langs;
 
 	if ($titlealt == 'default') $titlealt = $langs->trans('Search');
-	
+
 	$img = img_picto($titlealt, 'searchclear.png', $other, false, 1);
-	
+
 	$input = '<input type="image" class="liste_titre" name="button_removefilter" src="'.$img.'" ';
 	$input.= 'value="'.dol_escape_htmltag($titlealt).'" title="'.dol_escape_htmltag($titlealt).'" >';
 
diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php
index 19611dd9404e6e8eb00dcebee3dfec1fb4e15973..05abcd625e8c47d75afc9953a1e443392196a342 100644
--- a/htdocs/core/lib/functions2.lib.php
+++ b/htdocs/core/lib/functions2.lib.php
@@ -1221,7 +1221,7 @@ function dol_print_reduction($reduction,$langs)
     $string = '';
     if ($reduction == 100)
     {
-        $string = $langs->trans("Offered");
+        $string = $langs->transnoentities("Offered");
     }
     else
     {
diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql
index 060524181d81d73780916b86a4a16ad3487a34c7..8455bcaf550ebfe2119154280fc56d456aa12893 100644
--- a/htdocs/core/menus/init_menu_auguria.sql
+++ b/htdocs/core/menus/init_menu_auguria.sql
@@ -39,22 +39,22 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
 -- Home - Sytem info
 insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$user->admin', __HANDLER__, 'left', 300__+MAX_llx_menu__, 'home', 'admintools', 1__+MAX_llx_menu__, '/admin/tools/index.php?leftmenu=admintools', 'SystemTools', 0, 'admin', '', '', 2, 2, __ENTITY__);
 insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 201__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/dolibarr.php?leftmenu=admintools', 'InfoDolibarr', 1, 'admin', '', '', 2, 0, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 208__+MAX_llx_menu__, 'home', '', 201__+MAX_llx_menu__, '/admin/system/modules.php?leftmenu=admintools', 'Modules', 2, 'admin', '', '', 2, 2, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 207__+MAX_llx_menu__, 'home', '', 201__+MAX_llx_menu__, '/admin/triggers.php?leftmenu=admintools', 'Triggers', 2, 'admin', '', '', 2, 3, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 202__+MAX_llx_menu__, 'home', '', 201__+MAX_llx_menu__, '/admin/system/modules.php?leftmenu=admintools', 'Modules', 2, 'admin', '', '', 2, 2, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 203__+MAX_llx_menu__, 'home', '', 201__+MAX_llx_menu__, '/admin/triggers.php?leftmenu=admintools', 'Triggers', 2, 'admin', '', '', 2, 3, __ENTITY__);
 insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 204__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/browser.php?leftmenu=admintools', 'InfoBrowser', 1, 'admin', '', '', 2, 1, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 204__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/os.php?leftmenu=admintools', 'InfoOS', 1, 'admin', '', '', 2, 2, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 205__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/web.php?leftmenu=admintools', 'InfoWebServer', 1, 'admin', '', '', 2, 3, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 206__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/phpinfo.php?leftmenu=admintools', 'InfoPHP', 1, 'admin', '', '', 2, 4, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 205__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/os.php?leftmenu=admintools', 'InfoOS', 1, 'admin', '', '', 2, 2, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 206__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/web.php?leftmenu=admintools', 'InfoWebServer', 1, 'admin', '', '', 2, 3, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 207__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/phpinfo.php?leftmenu=admintools', 'InfoPHP', 1, 'admin', '', '', 2, 4, __ENTITY__);
 insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 210__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/database.php?leftmenu=admintools', 'InfoDatabase', 1, 'admin', '', '', 2, 5, __ENTITY__);
 insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 301__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/dolibarr_export.php?leftmenu=admintools', 'Backup', 1, 'admin', '', '', 2, 6, __ENTITY__);
 insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 302__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/dolibarr_import.php?leftmenu=admintools', 'Restore', 1, 'admin', '', '', 2, 7, __ENTITY__);
 insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 305__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/update.php?leftmenu=admintools', 'MenuUpgrade', 1, 'admin', '', '', 2, 8, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools" && function_exists("eaccelerator_info")', __HANDLER__, 'left', 304__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/eaccelerator.php?leftmenu=admintools', 'EAccelerator', 1, 'admin', '', '', 2, 9, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 306__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/listevents.php?leftmenu=admintools', 'Audit', 1, 'admin', '', '', 2, 10, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools" && function_exists("eaccelerator_info")', __HANDLER__, 'left', 306__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/eaccelerator.php?leftmenu=admintools', 'EAccelerator', 1, 'admin', '', '', 2, 9, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 307__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/listevents.php?leftmenu=admintools', 'Audit', 1, 'admin', '', '', 2, 10, __ENTITY__);
 insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 308__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/listsessions.php?leftmenu=admintools', 'Sessions', 1, 'admin', '', '', 2, 11, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 303__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/purge.php?leftmenu=admintools', 'Purge', 1, 'admin', '', '', 2, 12, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 307__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/support/index.php?leftmenu=admintools', 'HelpCenter', 1, 'help', '', '_blank', 2, 13, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 203__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/about.php?leftmenu=admintools', 'About', 1, 'admin', '', '', 2, 14, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 309__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/purge.php?leftmenu=admintools', 'Purge', 1, 'admin', '', '', 2, 12, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 310__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/support/index.php?leftmenu=admintools', 'HelpCenter', 1, 'help', '', '_blank', 2, 13, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 311__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/about.php?leftmenu=admintools', 'About', 1, 'admin', '', '', 2, 14, __ENTITY__);
 -- Home - Menu users and groups
 insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', __HANDLER__, 'left', 400__+MAX_llx_menu__, 'home', 'users', 1__+MAX_llx_menu__, '/user/home.php?leftmenu=users', 'MenuUsersAndGroups', 0, 'users', '', '', 2, 3, __ENTITY__);
 insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 401__+MAX_llx_menu__, 'home', '', 400__+MAX_llx_menu__, '/user/index.php?leftmenu=users', 'Users', 1, 'users', '$user->rights->user->user->lire || $user->admin', '', 2, 0, __ENTITY__);
diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php
index fb55ce74052beca96b719004117d5b498cc76169..4a49740ebb1cf086abe305ca1c01394bb4b8d1fb 100644
--- a/htdocs/fourn/facture/card.php
+++ b/htdocs/fourn/facture/card.php
@@ -526,11 +526,11 @@ elseif ($action == 'update_line' && $user->rights->fournisseur->facture->creer)
 
         }
 
-        $localtax1tx= get_localtax($_POST['tauxtva'], 1, $mysoc,$object->thirdparty);
-        $localtax2tx= get_localtax($_POST['tauxtva'], 2, $mysoc,$object->thirdparty);
+        $localtax1_tx= get_localtax($_POST['tauxtva'], 1, $mysoc,$object->thirdparty);
+        $localtax2_tx= get_localtax($_POST['tauxtva'], 2, $mysoc,$object->thirdparty);
         $remise_percent=GETPOST('remise_percent');
 
-        $result=$object->updateline(GETPOST('lineid'), $label, $pu, GETPOST('tauxtva'), $localtax1tx, $localtax2tx, GETPOST('qty'), GETPOST('idprod'), $price_base_type, 0, $type, $remise_percent);
+        $result=$object->updateline(GETPOST('lineid'), $label, $pu, GETPOST('tauxtva'), $localtax1_tx, $localtax2_tx, GETPOST('qty'), GETPOST('idprod'), $price_base_type, 0, $type, $remise_percent);
         if ($result >= 0)
         {
             unset($_POST['label']);
@@ -626,13 +626,13 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer)
             $tvatx=get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, $_POST['idprodfournprice']);
             $npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, $_POST['idprodfournprice']);
 
-            $localtax1tx= get_localtax($tvatx, 1, $mysoc,$object->thirdparty);
-            $localtax2tx= get_localtax($tvatx, 2, $mysoc,$object->thirdparty);
+            $localtax1_tx= get_localtax($tvatx, 1, $mysoc,$object->thirdparty);
+            $localtax2_tx= get_localtax($tvatx, 2, $mysoc,$object->thirdparty);
 
             $type = $productsupplier->type;
 
             // TODO Save the product supplier ref into database into field ref_supplier (must rename field ref into ref_supplier first)
-            $result=$object->addline($desc, $productsupplier->fourn_pu, $tvatx, $localtax1tx, $localtax2tx, $qty, $idprod, $remise_percent, '', '', 0, $npr);
+            $result=$object->addline($desc, $productsupplier->fourn_pu, $tvatx, $localtax1_tx, $localtax2_tx, $qty, $idprod, $remise_percent, '', '', 0, $npr);
         }
     	if ($idprod == -2 || $idprod == 0)
         {
diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql
index 635154768bb55ffa04cc0178c959cce8a03931a1..24cb1a6203de2f6390c5e30d6674eeb0328330a9 100644
--- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql
+++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql
@@ -18,6 +18,16 @@
 -- -- VPGSQL8.2 DELETE FROM llx_usergroup_user      WHERE fk_user      NOT IN (SELECT rowid from llx_user);
 -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user      WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup);
 
+ALTER TABLE llx_bank_account ADD COLUMN fk_user_author integer;
+
+ALTER TABLE llx_propal ADD COLUMN fk_user_modif integer after fk_user_author;
+ALTER TABLE llx_commande ADD COLUMN fk_user_modif integer after fk_user_author;
+ALTER TABLE llx_facture ADD COLUMN fk_user_modif integer after fk_user_author;
+ALTER TABLE llx_product ADD COLUMN fk_user_modif integer after fk_user_author;
+ALTER TABLE llx_fichinter ADD COLUMN fk_user_modif integer after fk_user_author;
+ALTER TABLE llx_commande_fournisseur ADD COLUMN fk_user_modif integer after fk_user_author;
+ALTER TABLE llx_facture_fourn ADD COLUMN fk_user_modif integer after fk_user_author;
+ALTER TABLE llx_bank_account ADD COLUMN fk_user_modif integer after fk_user_author;
 
 
 ALTER TABLE llx_fichinter ADD COLUMN ref_ext 	varchar(255);
diff --git a/htdocs/install/mysql/tables/llx_bank_account.sql b/htdocs/install/mysql/tables/llx_bank_account.sql
index 63a0e23762d1abdda8a995d3c6eb785432fcbb2a..bb2da7841b817993c660d07db1ac01177b3d4c3d 100644
--- a/htdocs/install/mysql/tables/llx_bank_account.sql
+++ b/htdocs/install/mysql/tables/llx_bank_account.sql
@@ -30,6 +30,8 @@ create table llx_bank_account
   ref					varchar(12) NOT NULL,
   label					varchar(30) NOT NULL,
   entity				integer DEFAULT 1 NOT NULL,	-- multi company id
+  fk_user_author		integer,
+  fk_user_modif			integer,
   bank					varchar(60),
   code_banque			varchar(8),
   code_guichet			varchar(6),
diff --git a/htdocs/install/mysql/tables/llx_commande.sql b/htdocs/install/mysql/tables/llx_commande.sql
index 3cf3fdac2260425559c56016e70840a00315d21a..90e8fd7af7196cf81d15cadfe733c651a4224c23 100644
--- a/htdocs/install/mysql/tables/llx_commande.sql
+++ b/htdocs/install/mysql/tables/llx_commande.sql
@@ -36,9 +36,10 @@ create table llx_commande
   date_valid			datetime,						-- date de validation
   date_cloture			datetime,						-- date de cloture
   date_commande			date,							-- date de la commande
-  fk_user_author		integer,						-- createur de la commande
-  fk_user_valid			integer,						-- valideur de la commande
-  fk_user_cloture		integer,						-- auteur cloture
+  fk_user_author		integer,						-- user making creation
+  fk_user_modif         integer,                       -- user making last change
+  fk_user_valid			integer,						-- user validating
+  fk_user_cloture		integer,						-- user closing
   source				smallint,
   fk_statut				smallint  default 0,
   amount_ht				real      default 0,
diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur.sql
index d8076c1c06cf5614b05c0747cf4b21dc83ea04d6..2ecf9e10442f361b006429fd722fac4bb022e12c 100644
--- a/htdocs/install/mysql/tables/llx_commande_fournisseur.sql
+++ b/htdocs/install/mysql/tables/llx_commande_fournisseur.sql
@@ -30,16 +30,17 @@ create table llx_commande_fournisseur
   ref_supplier			varchar(30),
 
   fk_soc				integer NOT NULL,
-  fk_projet				integer DEFAULT 0,             -- projet auquel est rattache la commande
+  fk_projet				integer DEFAULT 0,             -- project id
 
   tms					timestamp,
   date_creation			datetime,                      -- date de creation 
   date_valid			datetime,                      -- date de validation
   date_approve			datetime,                      -- date de approve
   date_commande			date,                          -- date de la commande
-  fk_user_author		integer,                       -- createur de la commande
-  fk_user_valid			integer,                       -- valideur de la commande
-  fk_user_approve		integer,                       -- auteur approve
+  fk_user_author		integer,                       -- user making creation
+  fk_user_modif         integer,                       -- user making last change
+  fk_user_valid			integer,                       -- user validating
+  fk_user_approve		integer,                       -- user approving
   source				smallint NOT NULL,
   fk_statut				smallint  default 0,
   amount_ht				real      default 0,
diff --git a/htdocs/install/mysql/tables/llx_facture.sql b/htdocs/install/mysql/tables/llx_facture.sql
index 2522ee7a73e6b5e8c88d291fe8245f7e8edb90c8..433bef887f1b8b36abe666b42fdfa3acebc8eb4b 100644
--- a/htdocs/install/mysql/tables/llx_facture.sql
+++ b/htdocs/install/mysql/tables/llx_facture.sql
@@ -56,8 +56,9 @@ create table llx_facture
 
   fk_statut				smallint DEFAULT 0 NOT NULL,
 
-  fk_user_author		integer,								-- createur de la facture
-  fk_user_valid			integer,								-- valideur de la facture
+  fk_user_author		integer,								-- user making creation
+  fk_user_modif         integer,                               -- user making last change
+  fk_user_valid			integer,								-- user validating
 
   fk_facture_source		integer,								-- facture origine si facture avoir
   fk_projet				integer DEFAULT NULL,					-- projet auquel est associee la facture
diff --git a/htdocs/install/mysql/tables/llx_facture_fourn.sql b/htdocs/install/mysql/tables/llx_facture_fourn.sql
index 2bb85f8400e121f8e6e510bd9a5ac438dd837313..3a71c2455aa74fe3a92cdcf8631bdf8774784c4a 100644
--- a/htdocs/install/mysql/tables/llx_facture_fourn.sql
+++ b/htdocs/install/mysql/tables/llx_facture_fourn.sql
@@ -52,8 +52,9 @@ create table llx_facture_fourn
 
   fk_statut				smallint DEFAULT 0 NOT NULL,
 
-  fk_user_author		integer,                       -- createur de la facture
-  fk_user_valid			integer,                       -- valideur de la facture
+  fk_user_author		integer,                       -- user making creation
+  fk_user_modif         integer,                       -- user making last change
+  fk_user_valid			integer,                       -- user validating
 
   fk_facture_source		integer,                       -- facture origine si facture avoir
   fk_projet				integer,                       -- projet auquel est associee la facture
diff --git a/htdocs/install/mysql/tables/llx_fichinter.sql b/htdocs/install/mysql/tables/llx_fichinter.sql
index 242710a09938ecc62823558c3743002c2fcb23c3..58f953c719669efef562e1ce973c03c8ce2fdeb9 100644
--- a/htdocs/install/mysql/tables/llx_fichinter.sql
+++ b/htdocs/install/mysql/tables/llx_fichinter.sql
@@ -29,9 +29,10 @@ create table llx_fichinter
   tms				timestamp,
   datec				datetime,                   -- date de creation 
   date_valid		datetime,                   -- date de validation
-  datei				date,                       -- date de livraison du bon d'intervention
-  fk_user_author	integer,                    -- createur de la fiche
-  fk_user_valid		integer,                    -- valideur de la fiche
+  datei				date,						-- date de livraison du bon d'intervention
+  fk_user_author	integer,					-- user making creation
+  fk_user_modif     integer,                   -- user making last change
+  fk_user_valid		integer,                   -- valideur de la fiche
   fk_statut			smallint  DEFAULT 0,
   duree				real,                       -- duree totale de l'intervention
   description		text,
diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql
index 0ab9a24785c935e0cbcff1822e5161859523ef9b..e9703fc90cf9698483bfa5b36185611b1f638620 100644
--- a/htdocs/install/mysql/tables/llx_product.sql
+++ b/htdocs/install/mysql/tables/llx_product.sql
@@ -48,8 +48,9 @@ create table llx_product
   recuperableonly           integer NOT NULL DEFAULT '0',  -- French NPR VAT
   localtax1_tx				double(6,3)  DEFAULT 0,         -- Spanish local VAT 1 
   localtax2_tx				double(6,3)  DEFAULT 0,         -- Spanish local VAT 2
-  fk_user_author			integer DEFAULT NULL,
-  tosell					tinyint      DEFAULT 1,	            -- Product you sell
+  fk_user_author			integer DEFAULT NULL,			  -- user making creation
+  fk_user_modif             integer,                         -- user making last change
+  tosell					tinyint      DEFAULT 1,	          -- Product you sell
   tobuy						tinyint      DEFAULT 1,            -- Product you buy
   tobatch					tinyint      DEFAULT 0 NOT NULL,  -- Is it a product that need a batch or eat-by management
   fk_product_type			integer      DEFAULT 0,			-- Type of product: 0 for regular product, 1 for service, 9 for other (used by external module)
diff --git a/htdocs/install/mysql/tables/llx_propal.sql b/htdocs/install/mysql/tables/llx_propal.sql
index c9ab3ecd138849eb027f7ecf2336d884387aea99..90996073021eb52576abba25b9958dba03bbadd7 100644
--- a/htdocs/install/mysql/tables/llx_propal.sql
+++ b/htdocs/install/mysql/tables/llx_propal.sql
@@ -38,9 +38,10 @@ create table llx_propal
   fin_validite			datetime,						-- date de fin de validite
   date_valid			datetime,						-- date de validation
   date_cloture			datetime,						-- date de cloture
-  fk_user_author		integer,						-- createur de la propale
-  fk_user_valid			integer,						-- valideur de la propale
-  fk_user_cloture		integer,						-- cloture de la propale signee ou non signee
+  fk_user_author		integer,						-- user making creation
+  fk_user_modif         integer,                       -- user making last change
+  fk_user_valid			integer,						-- user validating
+  fk_user_cloture		integer,						-- user closing (signed or not)
   fk_statut				smallint DEFAULT 0 NOT NULL,
   price					real         DEFAULT 0,			-- (obsolete)
   remise_percent		real         DEFAULT 0,			-- remise globale relative en pourcent (obsolete)
diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang
index 0c1ad62eab210d104b14031c13954bcd2970f581..3d9681774d832a9ad1310efac4713f1bbced29c8 100644
--- a/htdocs/langs/en_US/accountancy.lang
+++ b/htdocs/langs/en_US/accountancy.lang
@@ -66,26 +66,26 @@ Lineofinvoice=Line of invoice
 VentilatedinAccount=Ventilated successfully in the accounting account
 NotVentilatedinAccount=Not ventilated in the accounting account
 
-ACCOUNTINGEX_SEPARATORCSV=Separator CSV
+ACCOUNTING_SEPARATORCSV=Separator CSV
 
-ACCOUNTINGEX_LIMIT_LIST_VENTILATION=Number of elements to be ventilated shown by page (maximum recommended : 50)
-ACCOUNTINGEX_LIST_SORT_VENTILATION_TODO=Begin the sorting of the pages of ventilation "Has to ventilate" by the most recent elements
-ACCOUNTINGEX_LIST_SORT_VENTILATION_DONE=Begin the sorting of the pages of ventilation "Ventilated" by the most recent elements
+ACCOUNTING_LIMIT_LIST_VENTILATION=Number of elements to be ventilated shown by page (maximum recommended : 50)
+ACCOUNTING_LIST_SORT_VENTILATION_TODO=Begin the sorting of the pages of ventilation "Has to ventilate" by the most recent elements
+ACCOUNTING_LIST_SORT_VENTILATION_DONE=Begin the sorting of the pages of ventilation "Ventilated" by the most recent elements
 
 AccountLength=Length of the accounting accounts shown in Dolibarr
 AccountLengthDesc=Function allowing to feign a length of accounting account by replacing spaces by the zero figure. This function touches only the display, it does not modify the accounting accounts registered in Dolibarr. For the export, this function is necessary to be compatible with certain software.  
-ACCOUNTINGEX_LENGTH_GACCOUNT=Length of the general accounts
-ACCOUNTINGEX_LENGTH_AACCOUNT=Length of the third party accounts
-
-ACCOUNTINGEX_SELL_JOURNAL=Sell journal
-ACCOUNTINGEX_PURCHASE_JOURNAL=Purchase journal
-ACCOUNTINGEX_BANK_JOURNAL=Bank journal
-ACCOUNTINGEX_CASH_JOURNAL=Cash journal
-ACCOUNTINGEX_MISCELLANEOUS_JOURNAL=Miscellaneous journal
-ACCOUNTINGEX_SOCIAL_JOURNAL=Social journal
-
-ACCOUNTINGEX_ACCOUNT_TRANSFER_CASH=Account of transfer
-ACCOUNTINGEX_ACCOUNT_SUSPENSE=Account of wait
+ACCOUNTING_LENGTH_GACCOUNT=Length of the general accounts
+ACCOUNTING_LENGTH_AACCOUNT=Length of the third party accounts
+
+ACCOUNTING_SELL_JOURNAL=Sell journal
+ACCOUNTING_PURCHASE_JOURNAL=Purchase journal
+ACCOUNTING_BANK_JOURNAL=Bank journal
+ACCOUNTING_CASH_JOURNAL=Cash journal
+ACCOUNTING_MISCELLANEOUS_JOURNAL=Miscellaneous journal
+ACCOUNTING_SOCIAL_JOURNAL=Social journal
+
+ACCOUNTING_ACCOUNT_TRANSFER_CASH=Account of transfer
+ACCOUNTING_ACCOUNT_SUSPENSE=Account of wait
 
 COMPTA_PRODUCT_BUY_ACCOUNT=Accounting account by default for bought products (if not defined in the product sheet)
 COMPTA_PRODUCT_SOLD_ACCOUNT=Accounting account by default for the sold products (if not defined in the product sheet)
diff --git a/htdocs/langs/es_ES/accountancy.lang b/htdocs/langs/es_ES/accountancy.lang
index 624e2c02291b1a3af66713e85656c6f204e6bc70..4298ceddbc6370c957dd48bf5fa190fbe796c9e1 100644
--- a/htdocs/langs/es_ES/accountancy.lang
+++ b/htdocs/langs/es_ES/accountancy.lang
@@ -1,149 +1,150 @@
-# Dolibarr language file - es_ES - Experto de la contabilidad
+# Dolibarr language file - en_US - Accounting Expert
 CHARSET=UTF-8
 
 Accounting=Contabilidad
 Globalparameters=Configuración global
-Chartofaccounts=Cuentas
+Chartofaccounts=Plan contable
 Fiscalyear=Años fiscales
-Menuaccount=Contabilidad Cuentas
+Menuaccount=Cuentas contables
 Menuthirdpartyaccount=Cuentas de terceros
-MenuTools=Instrumentos
-Configuration=Configuración
-Export=Exportación
+MenuTools=Utilidades
 
 ConfigAccountingExpert=Configuración del módulo contable
 Journaux=Diarios
-JournalFinancial=Diarios
+JournalFinancial=Diarios financieros
 Exports=Exportaciones
-Modelcsv=Plantilla de Exportación
-Selectmodelcsv=Seleccione una plantilla de exportación
+Modelcsv=Modelo de exportación
+Selectmodelcsv=Seleccione un modelo de exportación
 Modelcsv_normal=Exportación clásica
 Modelcsv_CEGID=Exportar a Cegid Expert
 BackToChartofaccounts=Volver al plan contable
 Back=Volver
 
-Definechartofaccounts=Definir la contabilidad
+Definechartofaccounts=Definir plan contable
 Selectchartofaccounts=Seleccione un plan contable
-Validate=validar
+Validate=Validar
 Addanaccount=Añadir una cuenta contable
-ImportAccount=Importar cuentas
-AccountAccounting=Cuenta
-Ventilation=Contabilización
+AccountAccounting=Cuenta contable
+Ventilation=Contabilizar
 ToDispatch=A realizar
 Dispatched=Realizadas
 
 CustomersVentilation=Contabilización ventas
 SuppliersVentilation=Contabilización compras
-TradeMargin=margen de beneficio
-Reports=relaciones
-ByCustomerInvoice=Por las facturas de los clientes
-ByMonth=por mes
+TradeMargin=Margen de beneficio
+Reports=Informes
+ByCustomerInvoice=Por facturas a clientes
+ByMonth=Por mes
 NewAccount=Nueva cuenta contable
-Update=Actualización
-List=lista
-Create=crear
-UpdateAccount=Editar una cuenta
-UpdateMvts=Modificación de un movimiento
+Update=Actualizar
+List=Listado
+Create=Crear
+UpdateAccount=Modificar una cuenta contable
+UpdateMvts=Modificar un movimiento
 WriteBookKeeping=Registrar los asientos en el libro mayor
-Bookkeeping=libro mayor
-AccountBalanceByMonth=Saldo Mensual
+Bookkeeping=Libro Mayor
+AccountBalanceByMonth=Saldo mensual
 
-AccountingVentilation=desglose de Contabilidad
-AccountingVentilationSupplier=Proveedor de cuentas de ventilación
-AccountingVentilationCustomer=Cliente de cuentas de ventilación
-Line=línea
+AccountingVentilation=Contabilización
+AccountingVentilationSupplier=Contabilización compras
+AccountingVentilationCustomer=Contabilización ventas
+Line=Línea
 
-Ventilate=contabilizar
-VentilationAuto=contabilización automática
+CAHTF=Total (base imponible) compras a proveedor
+InvoiceLines=Líneas de factura para contabilizar
+InvoiceLinesDone=Líneas de facturas contabilizadas
+IntoAccount=En la cuenta
+
+Ventilate=Contabilizar
+VentilationAuto=Contabilización automática
 
 Processing=Tratamiento
 EndProcessing=Final del tratamiento
-AnyLineVentilate=No hay línea para contabilizar
-SelectedLines=Las líneas seleccionadas
+AnyLineVentilate=No hay líneas para contabilizar
+SelectedLines=Líneas seleccionadas
 Lineofinvoice=Línea de la factura
 VentilatedinAccount=Contabilizada con éxito en la cuenta contable
 NotVentilatedinAccount=Cuenta sin contabilización en la contabilidad
 
-ACCOUNTING_SEPARATORCSV=separador CSV
+ACCOUNTINGEX_SEPARATORCSV=separador CSV
 
-ACCOUNTING_LIMIT_LIST_VENTILATION=(El máximo recomendado: 50) Número de elementos que se muestran por página para contabilizar
-ACCOUNTING_LIST_SORT_VENTILATION_TODO=Páginas de inicio de clasificación de ventilación "desglose" de las pruebas más recientes
-ACCOUNTING_LIST_SORT_VENTILATION_DONE=Páginas de inicio de clasificación de ventilación "ventilada" por la evidencia más reciente
+ACCOUNTINGEX_LIMIT_LIST_VENTILATION=Número de elementos a contabilizar que se muestran por página (máximo recomendado: 50)
+ACCOUNTINGEX_LIST_SORT_VENTILATION_TODO=Ordenar las páginas de contabilización "A contabilizar" por los elementos más recientes
+ACCOUNTINGEX_LIST_SORT_VENTILATION_DONE=Ordenar las páginas de contabilización "Contabilizadas" por los elementos más recientes
 
-AccountLength=Cuentas contables longitud mostrada en Dolibarr
-AccountLengthDesc=Función para simular una longitud de cuenta contable sustituyendo espacios con el número cero. Esta función sólo afecta a la pantalla, no cambia las cuentas contables registrados en Dolibarr. Para la exportación, esta función se requiere para ser compatible con algunos programas.
-ACCOUNTING_LENGTH_GACCOUNT=Longitud de las cuentas generales
-ACCOUNTING_LENGTH_AACCOUNT=Duración de subcuentas
+AccountLength=Longitud de las cuentas contables mostradas en Dolibarr
+AccountLengthDesc=Función para simular una longitud de cuenta contable sustituyendo los espacios por cero. Esta función sólo afecta a la pantalla, no cambia las cuentas contables registradas en Dolibarr. Esta función es necesaria para la exportación, para ser compatible con algunos programas.
+ACCOUNTINGEX_LENGTH_GACCOUNT=Longitud de las cuentas generales
+ACCOUNTINGEX_LENGTH_AACCOUNT=Longitud de las subcuentas
 
-ACCOUNTING_SELL_JOURNAL=Diario de Ventas
-ACCOUNTING_PURCHASE_JOURNAL=Diario de Compras
-ACCOUNTING_BANK_JOURNAL=Diario del Banco
-ACCOUNTING_CASH_JOURNAL=Diario de Caso
-ACCOUNTING_MISCELLANEOUS_JOURNAL=Diario de Operaciones diversas
-ACCOUNTING_SOCIAL_JOURNAL=Diario Social
+ACCOUNTINGEX_SELL_JOURNAL=Diario de ventas
+ACCOUNTINGEX_PURCHASE_JOURNAL=Diario de compras
+ACCOUNTINGEX_BANK_JOURNAL=Diario bancario
+ACCOUNTINGEX_CASH_JOURNAL=Diario de caja
+ACCOUNTINGEX_MISCELLANEOUS_JOURNAL=Diario de operaciones diversas
+ACCOUNTINGEX_SOCIAL_JOURNAL=Diario social
 
-ACCOUNTING_ACCOUNT_TRANSFER_CASH=Cuenta de caja
-ACCOUNTING_ACCOUNT_SUSPENSE=Cuenta partidas pendientes de aplicación
+ACCOUNTINGEX_ACCOUNT_TRANSFER_CASH=Cuenta de caja
+ACCOUNTINGEX_ACCOUNT_SUSPENSE=Cuenta operaciones pendientes de asignar
 
-COMPTA_PRODUCT_BUY_ACCOUNT=Cuenta predeterminada de contabilidad para los productos comprados (si no se define en el producto)
-COMPTA_PRODUCT_SOLD_ACCOUNT=Cuenta predeterminada de contabilidad para los productos vendidos (si no se define en el producto)
-COMPTA_SERVICE_BUY_ACCOUNT=Cuenta predeterminada de contabilidad para los servicios adquiridos (si no está definido en la hoja de servicio)
-COMPTA_SERVICE_SOLD_ACCOUNT=Cuenta predeterminada de contabilidad para servicios vendidos (si no se define en la ficha de servicio)
+COMPTA_PRODUCT_BUY_ACCOUNT=Cuenta contable predeterminada para los productos comprados (si no se define en el producto)
+COMPTA_PRODUCT_SOLD_ACCOUNT=Cuenta contable predeterminada para los productos vendidos (si no se define en el producto)
+COMPTA_SERVICE_BUY_ACCOUNT=Cuenta contable predeterminada para los servicios comprados (si no se define en el servicio)
+COMPTA_SERVICE_SOLD_ACCOUNT=Cuenta contable predeterminada para los servicios vendidos (si no se define en el servico)
 
 Doctype=Tipo de documento
-Docdate=fecha
-Docref=referencia
-Numerocompte=cuenta
-Code_tiers=tercero
+Docdate=Fecha
+Docref=Referencia
+Numerocompte=Cuenta
+Code_tiers=Tercero
 Labelcompte=Descripción
-Debit=débito
-Credit=crédito
-Amount=cantidad
-Sens=sentido
-Codejournal=diario
+Debit=Debe
+Credit=Crédito
+Amount=Cantidad
+Sens=Sentido
+Codejournal=Diario
 
-DelBookKeeping=Eliminar el libro mayor
+DelBookKeeping=Eliminar los registros del Diario Mayor
 
 SellsJournal=Diario de ventas
 PurchasesJournal=Diario de compras
 DescSellsJournal=Diario de ventas
 DescPurchasesJournal=Diario de compras
-BankJournal=Diario de banco
-DescBankJournal=Descripción del diario del Banco
-CashJournal=Libro de Caja
-DescCashJournal=Descripción Libro de Caja
+BankJournal=Diario bancario
+DescBankJournal=El diario bancario incluye todos los tipos pagos que no sean de efectivo
+CashJournal=Diario de caja
+DescCashJournal=El diario de caja incluye el tipo de pago efectivo
 
-CashPayment=Reglas caja
+CashPayment=Pago en efectivo
 
-SupplierInvoicePayment=Pago factura de proveedor
-CustomerInvoicePayment=Pago Factura a cliente
+SupplierInvoicePayment=Pago de factura de proveedor
+CustomerInvoicePayment=Cobro de factura a cliente
 
-ThirdPartyAccount=Cuenta tercero
+ThirdPartyAccount=Cuenta de tercero
 
-NewAccountingMvt=Nueva movimiento
-NumMvts=Número de movimiento
-ListeMvts=Apuntes del movimiento
-ErrorDebitCredit=Débito y Crédito no pueden terner valor al mismo tiempo
+NewAccountingMvt=Nuevo movimiento
+NumMvts=Número del movimiento
+ListeMvts=Listado del movimiento
+ErrorDebitCredit=Debe y Haber no pueden contener un valor al mismo tiempo
 
-ReportThirdParty=Lista cuentas de terceros
-DescThirdPartyReport=Consult here the list of the thirdparty customers and the suppliers and their accounting accounts
+ReportThirdParty=Listado cuentas de terceros
+DescThirdPartyReport=Consulte aquí el listado de clientes y proveedores y sus códigos contables
 
-ListAccounts=Lista de cuentas
+ListAccounts=Listado de cuentas contables
 
 Pcgversion=Versión del plan
-Pcgtype=Tipo de cuenta
-Pcgsubtype=tipo de subcuenta
-Accountparent=Cuenta padre
-Active=Activa
+Pcgtype=Tipo del plan
+Pcgsubtype=Subcuenta
+Accountparent=Padre de la cuenta
+Active=Estado
 
 NewFiscalYear=Nuevo año fiscal
-NewMovCompta=Nuevo registro contable
 
-DescVentilCustomer=Consulte aquí la contabilidad anual de sus facturas a clientes
+DescVentilCustomer=Consulte aquí la contabilización anual de sus facturas a clientes
 TotalVente=Total ventas (base imponible)
 TotalMarge=Total margen ventas
 DescVentilDoneCustomer=Consulte aquí las líneas de facturas a clientes y sus cuentas contables
-DescVentilTodoCustomer=Contabilize sus líneas de facturas a clientes
+DescVentilTodoCustomer=Contabilice sus líneas de facturas a clientes con una cuenta contable
 ChangeAccount=Cambie la cuenta para las líneas seleccionadas a la cuenta:
 Vide=-
 DescVentilSupplier=Consulte aquí la contabilidad anual de sus facturas de proveedores
@@ -155,14 +156,3 @@ ValidateHistory=Validar automáticamente
 ErrorAccountancyCodeIsAlreadyUse=Error, no puede eliminar esta cuenta ya que está siendo usada
 
 FicheVentilation=Ficha contable
-
-Accountancy_code_buy=Código compras
-Accountancy_code_buy_suggest=Código compras sugerido
-Accountancy_code_sell=Código ventas
-Accountancy_code_sell_suggest=Código ventas sugerido
-CreateMvts=Crear movimiento
-customer_invoice=Factura a cliente
-
-accountingaccount=Cuenta contable
-label=Descripción
-Import=Importar
\ No newline at end of file
diff --git a/htdocs/langs/es_ES/admin.lang b/htdocs/langs/es_ES/admin.lang
index 6d136f38157ece75190466e850668d39cf537846..7e07827309a493169cdfa42360c9036386b339a9 100644
--- a/htdocs/langs/es_ES/admin.lang
+++ b/htdocs/langs/es_ES/admin.lang
@@ -45,6 +45,8 @@ ErrorModuleRequireDolibarrVersion=Error, este módulo requiere una versión %s o
 ErrorDecimalLargerThanAreForbidden=Error, las precisiones superiores a <b>%s</b> no están soportadas.
 DictionarySetup=Diccionarios
 Dictionary=Diccionarios
+Chartofaccounts=Plan contable
+Fiscalyear=Años fiscales
 ErrorReservedTypeSystemSystemAuto=El uso del tipo 'system' y 'systemauto' está reservado. Puede utilizar 'user' como valor para añadir su propio registro
 ErrorCodeCantContainZero=El código no puede contener el valor 0
 DisableJavascript=Deshabilitar Javascript y funciones Ajax (Recomendado para personas ciegas o navegadores de texto)
diff --git a/htdocs/langs/es_ES/agenda.lang b/htdocs/langs/es_ES/agenda.lang
index 2bc22e55b67d697be3b515049526974901b99d40..b3aa4a58375b7ec62d77bb457abada7dd2ee49db 100644
--- a/htdocs/langs/es_ES/agenda.lang
+++ b/htdocs/langs/es_ES/agenda.lang
@@ -2,11 +2,11 @@
 IdAgenda=ID de evento
 Actions=Eventos
 ActionsArea=Área de eventos (acciones y tareas)
-Agenda= Agenda
-Agendas= Agendas
-Calendar= Calendario
-Calendars= Calendarios
-LocalAgenda=Calendario local
+Agenda=Agenda
+Agendas=Agendas
+Calendar=Calendario
+Calendars=Calendarios
+LocalAgenda=Calendario interno
 AffectedTo=Asignada a
 DoneBy=Realizado por
 Event=Evento
@@ -22,7 +22,7 @@ MenuToDoActions=Eventos incompletos
 MenuDoneActions=Eventos terminados
 MenuToDoMyActions=Mis eventos incompletos
 MenuDoneMyActions=Mis eventos terminados
-ListOfEvents=Listado de eventos Dolibarr
+ListOfEvents=Listado de eventos (calendario interno)
 ActionsAskedBy=Eventos registrados por
 ActionsToDoBy=Eventos asignados a
 ActionsDoneBy=Eventos realizados por
@@ -88,3 +88,4 @@ ExtSiteUrlAgenda=Url de acceso al archivo .ical
 ExtSiteNoLabel=Sin descripción
 WorkingTimeRange=Rango temporal
 WorkingDaysRange=Rango diario
+AddEvent=Crear evento
diff --git a/htdocs/langs/es_ES/dict.lang b/htdocs/langs/es_ES/dict.lang
index 7b440d712117a1364d776124d88a626f145ceda9..42c6d967657a9f71b6543953b542b5f5aff6bf1e 100644
--- a/htdocs/langs/es_ES/dict.lang
+++ b/htdocs/langs/es_ES/dict.lang
@@ -253,7 +253,6 @@ CivilityMR=Señor
 CivilityMLE=Señorita
 CivilityMTRE=Don
 CivilityDR=Doctor
-
 ##### Currencies #####
 Currencyeuros=Euros
 CurrencyAUD=Dólares Aus.
@@ -290,10 +289,10 @@ CurrencyXOF=Francos CFA BCEAO
 CurrencySingXOF=Franco CFA BCEAO
 CurrencyXPF=Francos CFP
 CurrencySingXPF=Franco CFP
-
 CurrencyCentSingEUR=céntimo
+CurrencyCentINR=paisa
+CurrencyCentSingINR=paise
 CurrencyThousandthSingTND=milésimo
-
 #### Input reasons #####
 DemandReasonTypeSRC_INTE=Internet
 DemandReasonTypeSRC_CAMP_MAIL=Campaña correo
@@ -306,7 +305,6 @@ DemandReasonTypeSRC_WOM=Boca a boca
 DemandReasonTypeSRC_PARTNER=Socio
 DemandReasonTypeSRC_EMPLOYEE=Empleado
 DemandReasonTypeSRC_SPONSORING=Patrocinador
-
 #### Paper formats ####
 PaperFormatEU4A0=Formato 4A0
 PaperFormatEU2A0=Formato 2A0
diff --git a/htdocs/langs/es_ES/main.lang b/htdocs/langs/es_ES/main.lang
index 7764545ed0a2229218df053a4e42cb883dac1e41..d92caea7ab26adbc76b67c21d2565d0b97051384 100644
--- a/htdocs/langs/es_ES/main.lang
+++ b/htdocs/langs/es_ES/main.lang
@@ -645,6 +645,7 @@ OptionalFieldsSetup=Configuración de los atributos opcionales
 URLPhoto=Url de la foto/logo
 SetLinkToThirdParty=Vincular a otro tercero
 CreateDraft=Crear borrador
+SetToDraft=Volver a borrador
 ClickToEdit=Clic para editar
 ObjectDeleted=Objeto %s eliminado
 ByCountry=Par país
diff --git a/htdocs/langs/es_ES/salaries.lang b/htdocs/langs/es_ES/salaries.lang
index bc4079feb210504d3d725c1a3e8e5aebff75fc6d..c8e3707d5df9235abc166753b0f68099f8cb664f 100644
--- a/htdocs/langs/es_ES/salaries.lang
+++ b/htdocs/langs/es_ES/salaries.lang
@@ -1,4 +1,6 @@
 # Dolibarr language file - Source file is en_US - users
+SALARIES_ACCOUNTING_ACCOUNT_PAYMENT=Código contable pago de salarios
+SALARIES_ACCOUNTING_ACCOUNT_CHARGE=Código contable cargas financieras
 Salary=Salario
 Salaries=Salarios
 Employee=Empleado
@@ -6,3 +8,5 @@ NewSalaryPayment=Nuevo pago
 SalaryPayment=Pago de salario
 SalariesPayments=Pagos de salarios
 ShowSalaryPayment=Ver pago
+THM=Precio medio por hora
+TJM=Precio medio por día
diff --git a/htdocs/langs/es_ES/users.lang b/htdocs/langs/es_ES/users.lang
index 37851adb724cbe8a02bd18c240ab9c6f2b6f5566..65b6d8ed0a07cff626b469ddd0efdaffc8dd4065 100644
--- a/htdocs/langs/es_ES/users.lang
+++ b/htdocs/langs/es_ES/users.lang
@@ -119,3 +119,4 @@ HierarchicView=Vista jerárquica
 UseTypeFieldToChange=Modificar el campo Tipo para cambiar
 OpenIDURL=Dirección OpenID
 LoginUsingOpenID=Usar OpenID para iniciar sesión
+WeeklyHours=Horas semanales
diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php
index 950b9b4e82b33ae2a626dd1440ae98d33fedd493..01d5516a48026b82f1ea6a5f4b7e774065810268 100644
--- a/htdocs/product/stock/card.php
+++ b/htdocs/product/stock/card.php
@@ -261,7 +261,7 @@ else
 
 			// Country
 			print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
-			if (! empty($object->country_code)) 
+			if (! empty($object->country_code))
 			{
 				$img=picto_from_langcode($object->country_code);
 				print ($img?$img.' ':'');
@@ -339,14 +339,14 @@ else
 						print "<a class=\"butAction\" href=\"card.php?action=edit&id=".$object->id."\">".$langs->trans("Modify")."</a>";
 					else
 						print "<a class=\"butActionRefused\" href=\"#\">".$langs->trans("Modify")."</a>";
-	
+
 					if ($user->rights->stock->supprimer)
 						print "<a class=\"butActionDelete\" href=\"card.php?action=delete&id=".$object->id."\">".$langs->trans("Delete")."</a>";
 					else
 						print "<a class=\"butActionRefused\" href=\"#\">".$langs->trans("Delete")."</a>";
 				}
 			}
-			
+
 			print "</div>";
 
 
@@ -375,7 +375,7 @@ else
 
 			$sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, p.fk_product_type as type, p.pmp as ppmp, p.price, p.price_ttc,";
 			$sql.= " ps.pmp, ps.reel as value";
-			$sql.= " FROM ".MAIN_DB_PREFIX."product_stock ps, ".MAIN_DB_PREFIX."product p";
+			$sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product as p";
 			$sql.= " WHERE ps.fk_product = p.rowid";
 			$sql.= " AND ps.reel <> 0";	// We do not show if stock is 0 (no product in this warehouse)
 			$sql.= " AND ps.fk_entrepot = ".$object->id;
diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php
index fb3882c3badb5270d8317cade3ef76e0e3442f07..3bf672f29a391e695884dc5a9e433937e8264ee8 100644
--- a/htdocs/product/stock/class/entrepot.class.php
+++ b/htdocs/product/stock/class/entrepot.class.php
@@ -186,12 +186,12 @@ class Entrepot extends CommonObject
 
 		$sql = "DELETE FROM ".MAIN_DB_PREFIX."stock_mouvement";
 		$sql.= " WHERE fk_entrepot = " . $this->id;
-		dol_syslog("Entrepot::delete", LOG_DEBUG);
+		dol_syslog(get_class($this)."::delete", LOG_DEBUG);
 		$resql1=$this->db->query($sql);
 
 		$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_stock";
 		$sql.= " WHERE fk_entrepot = " . $this->id;
-		dol_syslog("Entrepot::delete", LOG_DEBUG);
+		dol_syslog(get_class($this)."::delete", LOG_DEBUG);
 		$resql2=$this->db->query($sql);
 
 		if ($resql1 && $resql2)
@@ -202,8 +202,8 @@ class Entrepot extends CommonObject
 			dol_syslog(get_class($this)."::delete", LOG_DEBUG);
 			$resql1=$this->db->query($sql);
 
-			// Update denormalized fields because we change content of produt_stock
-			$sql = "UPDATE ".MAIN_DB_PREFIX."product p SET p.stock= (SELECT SUM(ps.reel) FROM ".MAIN_DB_PREFIX."product_stock ps WHERE ps.fk_product = p.rowid)";
+			// Update denormalized fields because we change content of produt_stock. Warning: Do not use "SET p.stock", does not works with pgsql
+			$sql = "UPDATE ".MAIN_DB_PREFIX."product as p SET stock = (SELECT SUM(ps.reel) FROM ".MAIN_DB_PREFIX."product_stock as ps WHERE ps.fk_product = p.rowid)";
 
 			dol_syslog(get_class($this)."::delete", LOG_DEBUG);
 			$resql2=$this->db->query($sql);
@@ -217,7 +217,7 @@ class Entrepot extends CommonObject
 			{
 				$this->db->rollback();
 				$this->error=$this->db->lasterror();
-				return -1;
+				return -2;
 			}
 		}
 		else
@@ -540,7 +540,7 @@ class Entrepot extends CommonObject
         $this->description = 'WAREHOUSE SPECIMEN '.dol_print_date($now,'dayhourlog');
 		$this->statut=1;
         $this->specimen=1;
-		
+
 		$this->lieu='Location test';
         $this->address='21 jump street';
         $this->zip='99999';
diff --git a/htdocs/webservices/server_invoice.php b/htdocs/webservices/server_invoice.php
index d0f3e589f25ff2e4ba2bd74c4b0f2f17734db961..8412ed6ab1b8ade44e29ccfecea7200bce14a4c2 100644
--- a/htdocs/webservices/server_invoice.php
+++ b/htdocs/webservices/server_invoice.php
@@ -541,6 +541,8 @@ function createInvoice($authentication,$invoice)
             $newline->total_ht=$line['total_net'];
             $newline->total_tva=$line['total_vat'];
             $newline->total_ttc=$line['total'];
+            $newline->date_start=dol_stringtotime($line['date_start']);
+            $newline->date_end=dol_stringtotime($line['date_end']);
             $newline->fk_product=$line['product_id'];
             $newobject->lines[]=$newline;
         }
diff --git a/test/phpunit/AllTests.php b/test/phpunit/AllTests.php
index d8dda85f2fcbc25db73e979a35711d628be882ed..a8a554ca25d8ea761aabf3c4316587acd8c01c0e 100644
--- a/test/phpunit/AllTests.php
+++ b/test/phpunit/AllTests.php
@@ -123,14 +123,21 @@ class AllTests
         require_once dirname(__FILE__).'/DiscountTest.php';
         $suite->addTestSuite('DiscountTest');
 
+        require_once dirname(__FILE__).'/ContratTest.php';
+        $suite->addTestSuite('ContratTest');
+
+        require_once dirname(__FILE__).'/FichinterTest.php';
+        $suite->addTestSuite('FichinterTest');
+
+        require_once dirname(__FILE__).'/PropalTest.php';
+        $suite->addTestSuite('PropalTest');
+
         require_once dirname(__FILE__).'/CommandeTest.php';
         $suite->addTestSuite('CommandeTest');
 
         require_once dirname(__FILE__).'/CommandeFournisseurTest.php';
         $suite->addTestSuite('CommandeFournisseurTest');
 
-        require_once dirname(__FILE__).'/ContratTest.php';
-        $suite->addTestSuite('ContratTest');
         require_once dirname(__FILE__).'/FactureTest.php';
         $suite->addTestSuite('FactureTest');
         require_once dirname(__FILE__).'/FactureRecTest.php';
@@ -139,8 +146,7 @@ class AllTests
         $suite->addTestSuite('FactureTestRounding');
         require_once dirname(__FILE__).'/FactureFournisseurTest.php';
         $suite->addTestSuite('FactureFournisseurTest');
-        require_once dirname(__FILE__).'/PropalTest.php';
-        $suite->addTestSuite('PropalTest');
+
 		require_once dirname(__FILE__).'/UserTest.php';
         $suite->addTestSuite('UserTest');
 		require_once dirname(__FILE__).'/UserGroupTest.php';
diff --git a/test/phpunit/FichInterTest.php b/test/phpunit/FichInterTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..96366af85a92afb3dd1bab2ffe30d669c1cce527
--- /dev/null
+++ b/test/phpunit/FichInterTest.php
@@ -0,0 +1,244 @@
+<?php
+/* Copyright (C) 2010 Laurent Destailleur  <eldy@users.sourceforge.net>
+ *
+ * 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/>.
+ * or see http://www.gnu.org/
+ */
+
+/**
+ *      \file       test/phpunit/FichinterTest.php
+ *		\ingroup    test
+ *      \brief      PHPUnit test
+ *		\remarks	To run this script as CLI:  phpunit filename.php
+ */
+
+global $conf,$user,$langs,$db;
+//define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
+//require_once 'PHPUnit/Autoload.php';
+require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
+require_once dirname(__FILE__).'/../../htdocs/fichinter/class/fichinter.class.php';
+
+if (empty($user->id))
+{
+	print "Load permissions for admin user nb 1\n";
+	$user->fetch(1);
+	$user->getrights();
+}
+$conf->global->MAIN_DISABLE_ALL_MAILS=1;
+
+
+/**
+ * Class for PHPUnit tests
+ *
+ * @backupGlobals disabled
+ * @backupStaticAttributes enabled
+ * @remarks	backupGlobals must be disabled to have db,conf,user and lang not erased.
+ */
+class FichinterTest extends PHPUnit_Framework_TestCase
+{
+	protected $savconf;
+	protected $savuser;
+	protected $savlangs;
+	protected $savdb;
+
+	/**
+	 * Constructor
+	 * We save global variables into local variables
+	 *
+	 * @return ContratTest
+	 */
+	function __construct()
+	{
+		//$this->sharedFixture
+		global $conf,$user,$langs,$db;
+		$this->savconf=$conf;
+		$this->savuser=$user;
+		$this->savlangs=$langs;
+		$this->savdb=$db;
+
+		print __METHOD__." db->type=".$db->type." user->id=".$user->id;
+		//print " - db ".$db->db;
+		print "\n";
+	}
+
+	// Static methods
+  	public static function setUpBeforeClass()
+    {
+    	global $conf,$user,$langs,$db;
+		$db->begin();	// This is to have all actions inside a transaction even if test launched without suite.
+
+    	print __METHOD__."\n";
+    }
+    public static function tearDownAfterClass()
+    {
+    	global $conf,$user,$langs,$db;
+		$db->rollback();
+
+		print __METHOD__."\n";
+    }
+
+	/**
+	 * Init phpunit tests
+	 *
+	 * @return	void
+	 */
+    protected function setUp()
+    {
+    	global $conf,$user,$langs,$db;
+		$conf=$this->savconf;
+		$user=$this->savuser;
+		$langs=$this->savlangs;
+		$db=$this->savdb;
+
+		print __METHOD__."\n";
+    }
+	/**
+	 * End phpunit tests
+	 *
+	 * @return	void
+	 */
+    protected function tearDown()
+    {
+    	print __METHOD__."\n";
+    }
+
+    /**
+     * testFichinterCreate
+     *
+     * @return	int
+     */
+    public function testFichinterCreate()
+    {
+    	global $conf,$user,$langs,$db;
+		$conf=$this->savconf;
+		$user=$this->savuser;
+		$langs=$this->savlangs;
+		$db=$this->savdb;
+
+		$localobject=new Fichinter($this->savdb);
+    	$localobject->initAsSpecimen();
+    	$result=$localobject->create($user);
+
+    	print __METHOD__." result=".$result."\n";
+    	$this->assertLessThan($result, 0);
+
+    	return $result;
+    }
+
+    /**
+     * testFichinterFetch
+     *
+     * @param	int		$id		Id of intervention
+     * @return	int
+     *
+     * @depends	testFichinterCreate
+     * The depends says test is run only if previous is ok
+     */
+    public function testFichinterFetch($id)
+    {
+    	global $conf,$user,$langs,$db;
+		$conf=$this->savconf;
+		$user=$this->savuser;
+		$langs=$this->savlangs;
+		$db=$this->savdb;
+
+		$localobject=new Fichinter($this->savdb);
+    	$result=$localobject->fetch($id);
+
+    	print __METHOD__." id=".$id." result=".$result."\n";
+    	$this->assertLessThan($result, 0);
+
+    	return $localobject;
+    }
+
+    /**
+     * testFichinterValid
+     *
+     * @param	Fichinter		$localobject		Intervention
+     * @return	int
+     *
+     * @depends	testFichinterFetch
+     * The depends says test is run only if previous is ok
+     */
+    public function testFichinterValid($localobject)
+    {
+    	global $conf,$user,$langs,$db;
+		$conf=$this->savconf;
+		$user=$this->savuser;
+		$langs=$this->savlangs;
+		$db=$this->savdb;
+
+    	$result=$localobject->setValid($user);
+    	print __METHOD__." id=".$localobject->id." result=".$result."\n";
+
+    	$this->assertLessThan($result, 0);
+    	return $localobject;
+    }
+
+   /**
+     * testFichinterValid
+     *
+     * @param	Object	$localobject	Object intervention
+     * @return	int
+     *
+     * @depends testFichinterValid
+     * The depends says test is run only if previous is ok
+     */
+    public function testFichinterOther($localobject)
+    {
+        global $conf,$user,$langs,$db;
+        $conf=$this->savconf;
+        $user=$this->savuser;
+        $langs=$this->savlangs;
+        $db=$this->savdb;
+
+        /*$result=$localobject->setstatus(0);
+        print __METHOD__." id=".$localobject->id." result=".$result."\n";
+        $this->assertLessThan($result, 0);
+        */
+
+        $localobject->info($localobject->id);
+        print __METHOD__." localobject->date_creation=".$localobject->date_creation."\n";
+        $this->assertNotEquals($localobject->date_creation, '');
+
+        return $localobject->id;
+    }
+
+    /**
+     * testFichinterDelete
+     *
+     * @param	int		$id		Id of intervention
+     * @return	int
+     *
+     * @depends	testFichinterOther
+     * The depends says test is run only if previous is ok
+     */
+    public function testFichinterDelete($id)
+    {
+    	global $conf,$user,$langs,$db;
+		$conf=$this->savconf;
+		$user=$this->savuser;
+		$langs=$this->savlangs;
+		$db=$this->savdb;
+
+		$localobject=new Fichinter($this->savdb);
+    	$result=$localobject->fetch($id);
+		$result=$localobject->delete($user);
+
+		print __METHOD__." id=".$id." result=".$result."\n";
+    	$this->assertLessThan($result, 0);
+    	return $result;
+    }
+
+}