diff --git a/htdocs/admin/cashdesk.php b/htdocs/admin/cashdesk.php
index f6456c6aeaf240a5dccbd589261ff9e02c7129f5..fdc4337d9f83e8ee4c32559fd807f760e225eac9 100644
--- a/htdocs/admin/cashdesk.php
+++ b/htdocs/admin/cashdesk.php
@@ -1,5 +1,5 @@
 <?php
-/* Copyright (C) 2008 Laurent Destailleur  <eldy@users.sourceforge.net>
+/* Copyright (C) 2008-2009 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
@@ -49,12 +49,14 @@ $langs->load("@cashdesk");
 if ($_POST["action"] == 'set')
 {
 	if ($_POST["CASHDESK_ID_THIRDPARTY"] < 0) $_POST["CASHDESK_ID_THIRDPARTY"]='';
-	if ($_POST["CASHDESK_ID_WAREHOUSE"] < 0)  $_POST["CASHDESK_ID_WAREHOUSE"]='';
 	if ($_POST["CASHDESK_ID_BANKACCOUNT"] < 0)  $_POST["CASHDESK_ID_BANKACCOUNT"]='';
+//	if ($_POST["CASHDESK_ID_WAREHOUSE"] < 0)  $_POST["CASHDESK_ID_WAREHOUSE"]='';
 
 	dolibarr_set_const($db,"CASHDESK_ID_THIRDPARTY",$_POST["CASHDESK_ID_THIRDPARTY"],'chaine',0,'',$conf->entity);
-	dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT",$_POST["CASHDESK_ID_BANKACCOUNT"],'chaine',0,'',$conf->entity);
-	dolibarr_set_const($db,"CASHDESK_ID_WAREHOUSE",$_POST["CASHDESK_ID_WAREHOUSE"],'chaine',0,'',$conf->entity);
+	dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CASH",$_POST["CASHDESK_ID_BANKACCOUNT_CASH"],'chaine',0,'',$conf->entity);
+	dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CHEQUE",$_POST["CASHDESK_ID_BANKACCOUNT_CHEQUE"],'chaine',0,'',$conf->entity);
+	dolibarr_set_const($db,"CASHDESK_ID_BANKACCOUNT_CB",$_POST["CASHDESK_ID_BANKACCOUNT_CB"],'chaine',0,'',$conf->entity);
+//	dolibarr_set_const($db,"CASHDESK_ID_WAREHOUSE",$_POST["CASHDESK_ID_WAREHOUSE"],'chaine',0,'',$conf->entity);
 
 	dol_syslog("admin/cashdesk: level ".$_POST["level"]);
 }
@@ -96,9 +98,22 @@ if ($conf->global->MAIN_MODULE_BANQUE)
 	$var=!$var;
 	print '<tr '.$bc[$var].'><td>'.$langs->trans("CashDeskBankAccountForSell").'</td>';
 	print '<td colspan="2">';
-	$form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT,'CASHDESK_ID_BANKACCOUNT',0,"courant=2",1);
+	$form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CASH,'CASHDESK_ID_BANKACCOUNT_CASH',0,"courant=2",1);
+	print '</td></tr>';
+
+	$var=!$var;
+	print '<tr '.$bc[$var].'><td>'.$langs->trans("CashDeskBankAccountForCheque").'</td>';
+	print '<td colspan="2">';
+	$form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE,'CASHDESK_ID_BANKACCOUNT_CHEQUE',0,"courant=1",1);
+	print '</td></tr>';
+
+	$var=!$var;
+	print '<tr '.$bc[$var].'><td>'.$langs->trans("CashDeskBankAccountForCB").'</td>';
+	print '<td colspan="2">';
+	$form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CB,'CASHDESK_ID_BANKACCOUNT_CB',0,"courant=1",1);
 	print '</td></tr>';
 }
+/*
 if ($conf->global->MAIN_MODULE_STOCK)
 {
 	$var=!$var;
@@ -107,7 +122,7 @@ if ($conf->global->MAIN_MODULE_STOCK)
 	$formproduct->selectWarehouses($conf->global->CASHDESK_ID_WAREHOUSE,'CASHDESK_ID_WAREHOUSE','',1);
 	print '</td></tr>';
 }
-
+*/
 
 print '</table>';
 
diff --git a/htdocs/cashdesk/include/environnement.php b/htdocs/cashdesk/include/environnement.php
index 2792620203b2eccc8a092dfa079c4ab10e4bfacf..398da6cb5ba711a2adc0adbcdbc0a30a114dcd85 100644
--- a/htdocs/cashdesk/include/environnement.php
+++ b/htdocs/cashdesk/include/environnement.php
@@ -39,7 +39,11 @@ $conf_url_racine = $dolibarr_main_url_root.'/cashdesk';
 // Identifiant unique correspondant au tiers generique pour la vente
 $conf_fksoc = $conf->global->CASHDESK_ID_THIRDPARTY;
 // Identifiant unique correspondant au compte caisse / liquide
-$conf_fkaccount = $conf->global->CASHDESK_ID_BANKACCOUNT > 0?$conf->global->CASHDESK_ID_BANKACCOUNT:$_SESSION["CASHDESK_ID_BANKACCOUNT"];
+$conf_fkaccount_cash = $conf->global->CASHDESK_ID_BANKACCOUNT_CASH > 0?$conf->global->CASHDESK_ID_BANKACCOUNT_CASH:$_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"];
+// Identifiant unique correspondant au compte cheque
+$conf_fkaccount_cheque = $conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE > 0?$conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE:$_SESSION["CASHDESK_ID_BANKACCOUNT_CHEQUE"];
+// Identifiant unique correspondant au compte cb
+$conf_fkaccount_cb = $conf->global->CASHDESK_ID_BANKACCOUNT_CB > 0?$conf->global->CASHDESK_ID_BANKACCOUNT_CB:$_SESSION["CASHDESK_ID_BANKACCOUNT_CB"];
 // Identifiant unique correspondant a l'entrepot associe a la caisse
 $conf_fkentrepot = $conf->global->CASHDESK_ID_WAREHOUSE > 0?$conf->global->CASHDESK_ID_WAREHOUSE:$_SESSION["CASHDESK_ID_WAREHOUSE"];
 
diff --git a/htdocs/cashdesk/templates/menu.tpl.php b/htdocs/cashdesk/templates/menu.tpl.php
index 51eb68eb6f46f119bfffad105bb5796367164740..bf0f72ad893502104b047471be1f7e64777779e2 100644
--- a/htdocs/cashdesk/templates/menu.tpl.php
+++ b/htdocs/cashdesk/templates/menu.tpl.php
@@ -27,9 +27,10 @@ $company->fetch($conf->global->CASHDESK_ID_THIRDPARTY);
 $bank=new Account($db);
 $bank->fetch($conf->global->CASHDESK_ID_BANKACCOUNT);
 $warehouse=new Entrepot($db);
-$warehouse->fetch($conf->global->CASHDESK_ID_WAREHOUSE);
+//$warehouse->fetch($conf->global->CASHDESK_ID_WAREHOUSE);
 
 $langs->load("@cashdesk");
+$langs->load("main");
 
 $logout='<img class="login" border="0" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/logout.png">';
 
@@ -42,7 +43,7 @@ print '<li class="menu_choix2"><a href=".."><span>'.$langs->trans("BackOffice").
 print '<li class="menu_choix0">'.$langs->trans("User").' : '.$_SESSION['prenom'].' '.$_SESSION['nom'].' <a href="deconnexion.php">'.$logout.'</a><br>';
 print $langs->trans("CashDeskThirdParty").' : '.$company->getNomUrl(1).'<br>';
 print $langs->trans("CashDeskBank").' : '.$bank->getNomUrl(1).'<br>';
-if ($conf->stock->enabled)
+if ($conf->stock->enabled && $warehouse->id)	// Disabled because warehouse->fetch disabled before
 {
 	print $langs->trans("CashDeskWarehouse").' : '.$warehouse->getNomUrl(1);
 }
diff --git a/htdocs/cashdesk/validation_verif.php b/htdocs/cashdesk/validation_verif.php
index 853ec1c96960a8f689f03d3919fab25f7439a882..9759f1fd408f34bed4a395c901dd0ff0871705c8 100644
--- a/htdocs/cashdesk/validation_verif.php
+++ b/htdocs/cashdesk/validation_verif.php
@@ -20,7 +20,9 @@
 require ('../master.inc.php');
 require (DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php');
 require (DOL_DOCUMENT_ROOT.'/cashdesk/classes/Facturation.class.php');
-require (DOL_DOCUMENT_ROOT.'/Facture.class.php');
+require (DOL_DOCUMENT_ROOT.'/facture.class.php');
+require (DOL_DOCUMENT_ROOT.'/compta/bank/account.class.php');
+require (DOL_DOCUMENT_ROOT.'/paiement.class.php');
 
 $obj_facturation = unserialize ($_SESSION['serObjFacturation']);
 unset ($_SESSION['serObjFacturation']);
@@ -85,16 +87,21 @@ switch ( $_GET['action'] )
 		$heure = date ('H:i:s');
 
 		$note = '';
+		if (! is_object($obj_facturation))
+		{
+			dol_print_error('','Empty context');
+			exit;
+		}
 
 		switch ( $obj_facturation->mode_reglement() )
 		{
 			case 'DIF':
 				$mode_reglement_id = 0;
-				//$cond_reglement_id = dol_getIdFromCode($db,'RECEP','cond_reglement','code','rowid')
+				//$cond_reglement_id = dol_getIdFromCode($sql,'RECEP','cond_reglement','code','rowid')
 				$cond_reglement_id = 0;
 				break;
 			case 'ESP':
-				$mode_reglement_id = dol_getIdFromCode($db,$obj_facturation->mode_reglement(),'c_paiement');
+				$mode_reglement_id = dol_getIdFromCode($sql,'LIQ','c_paiement');
 				$cond_reglement_id = 0;
 				$note .= $langs->trans("Cash")."\n";
 				$note .= $langs->trans("Received").' : '.$obj_facturation->montant_encaisse()." ".$conf->monnaie."\n";
@@ -103,19 +110,23 @@ switch ( $_GET['action'] )
 				$note .= '--------------------------------------'."\n\n";
 				break;
 			case 'CB':
-				$mode_reglement_id = dol_getIdFromCode($db,$obj_facturation->mode_reglement(),'c_paiement');
+				$mode_reglement_id = dol_getIdFromCode($sql,'CB','c_paiement');
 				$cond_reglement_id = 0;
 				break;
 			case 'CHQ':
-				$mode_reglement_id = dol_getIdFromCode($db,$obj_facturation->mode_reglement(),'c_paiement');
+				$mode_reglement_id = dol_getIdFromCode($sql,'CHQ','c_paiement');
 				$cond_reglement_id = 0;
 				break;
 		}
-
-		// ... on termine la note
+		if (empty($mode_reglement_id)) $mode_reglement_id=0;	// If mode_reglement_id not found
+		if (empty($cond_reglement_id)) $cond_reglement_id=0;	// If cond_reglement_id not found
 		$note .= $_POST['txtaNotes'];
+		dol_syslog("obj_facturation->mode_reglement()=".$obj_facturation->mode_reglement()." mode_reglement_id=".$mode_reglement_id." cond_reglement_id=".$cond_reglement_id);
 
 
+		$error=0;
+		$now=dol_now('tzserver');
+
 
 		$sql->begin();
 
@@ -123,7 +134,6 @@ switch ( $_GET['action'] )
 		$user->fetch();
 		$user->getrights();
 
-		$now=dol_now('tzserver');
 		$invoice=new Facture($sql,$conf_fksoc);
 
 
@@ -182,60 +192,6 @@ switch ( $_GET['action'] )
 			$invoiceline->total_ttc=$tab_liste[$i]['total_ttc'];
 			$invoiceline->total_tva=($tab_liste[$i]['total_ttc']-$tab_liste[$i]['total_ht']);
 			$invoice->lignes[]=$invoiceline;
-
-			// Calcul du montant de la TVA
-/*			$montant_tva = $tab_liste[$i]['total_ttc'] - $tab_liste[$i]['total_ht'];
-			// Calcul de la position de l'article dans la liste
-			$reel = $tab_liste[$i]['reel'];
-			$qte = $tab_liste[$i]['qte'];
-			$stock = $reel - $qte;
-			$position = $i + 1;
-
-			// Ajout d'une entree dans le detail de la facture
-			$sql->query (
-			'INSERT INTO '.MAIN_DB_PREFIX.'facturedet (
-							fk_facture,
-							fk_product,
-							description,
-							tva_taux,
-							qty,
-							remise_percent,
-							remise,
-							fk_remise_except,
-							subprice,
-							price,
-							total_ht,
-							total_tva,
-							total_ttc,
-							date_start,
-							date_end,
-							info_bits,
-							fk_code_ventilation,
-							fk_export_compta,
-							rang
-						)
-
-						VALUES (
-							'.$id.",
-							".$tab_liste[$i]['fk_article'].",
-							'".$tab_article['label']."',
-							".$tab_tva['taux'].",
-							".$tab_liste[$i]['qte'].",
-							".$tab_liste[$i]['remise_percent'].",
-							".$tab_liste[$i]['remise'].",
-							0,
-							".$tab_article['price'].",
-							".$tab_article['price'].",
-							".$tab_liste[$i]['total_ht'].",
-							".$montant_tva.",
-							".$tab_liste[$i]['total_ttc'].",
-							NULL,
-							NULL,
-							0,
-							0,
-							0,
-							".$position.")");
-		*/
 		}
 
 		$invoice->socid=$conf_fksoc;
@@ -266,122 +222,97 @@ switch ( $_GET['action'] )
 			$id = $invoice->id;
 
 			// Add the payment
-			// TODO Manage ESP, CHQ...
-
-			// Ajout d'une operation sur le compte de caisse, uniquement si le paiement est en especes
-			if ( $obj_facturation->mode_reglement() == 'ESP' )
+			$payment=new Paiement($db);
+			$payment->datepaye=$now;
+			$payment->bank_account=$conf_fkaccount;
+			$payment->amounts[$invoice->id]=$obj_facturation->prix_total_ttc();
+			$payment->note=$langs->trans("Payment").' '.$langs->trans("Invoice").' '.$obj_facturation->num_facture();
+			$payment->paiementid=$invoice->mode_reglement_id;
+			$payment->num_paiement='';
+
+			$paiement_id = $payment->create($user);
+			if ($paiement_id > 0)
 			{
-				$sql->query (
-				"INSERT INTO ".MAIN_DB_PREFIX."bank (
-								datec,
-								datev,
-								dateo,
-								amount,
-								label,
-								fk_account,
-								fk_user_author,
-								fk_type,
-								rappro,
-								fk_bordereau
-							)
-
-							VALUES (
-								'".$date." ".$heure."',
-								'".$date."',
-								'".$date."',
-								".$obj_facturation->prix_total_ttc().",
-								'Paiement caisse facture ".$obj_facturation->num_facture()."',
-								".$conf_fkaccount.",
-								".$_SESSION['uid'].",
-								'ESP',
-								0,
-								0
-							)
-					");
-
-			}
-			// Recuperation de l'id de l'operation nouvellement creee
-			$resql=$sql->query (
-			"SELECT rowid
-						FROM ".MAIN_DB_PREFIX."bank
-						WHERE 1
-						ORDER BY rowid DESC");
-			$ret=array();
-			$tab = $sql->fetch_array($resql);
-			foreach ( $tab as $cle => $valeur )
-			{
-				$ret[$cle] = $valeur;
+				// Ajout d'une ecriture sur le compte bancaire
+				if ($conf->banque->enabled)
+				{
+					$bankaccountid=0;
+					if ( $obj_facturation->mode_reglement() == 'ESP' )
+					{
+						$bankaccountid=$conf_fkaccount_cash;
+					}
+					if ( $obj_facturation->mode_reglement() == 'CHQ' )
+					{
+						$bankaccountid=$conf_fkaccount_cheque;
+					}
+					if ( $obj_facturation->mode_reglement() == 'CB' )
+					{
+						$bankaccountid=$conf_fkaccount_cb;
+					}
+
+					if ($bankaccountid > 0)
+					{
+						// Insertion dans llx_bank
+						$label = "(CustomerInvoicePayment)";
+						$acc = new Account($db, $bankaccountid);
+
+						$bank_line_id = $acc->addline($payment->datepaye,
+						$payment->paiementid,	// Payment mode id or code ("CHQ or VIR for example")
+						$label,
+						$obj_facturation->prix_total_ttc(),
+						$payment->num_paiement,
+			      		'',
+						$user,
+						'',
+						'');
+
+						// Mise a jour fk_bank dans llx_paiement.
+						// On connait ainsi le paiement qui a genere l'ecriture bancaire
+						if ($bank_line_id > 0)
+						{
+							$payment->update_fk_bank($bank_line_id);
+							// Mise a jour liens (pour chaque facture concernees par le paiement)
+							foreach ($payment->amounts as $key => $value)
+							{
+								$facid = $key;
+								$fac = new Facture($db);
+								$fac->fetch($facid);
+								$fac->fetch_client();
+								$acc->add_url_line($bank_line_id,
+								$paiement_id,
+								DOL_URL_ROOT.'/compta/paiement/fiche.php?id=',
+				        									 '(paiement)',
+				        									 'payment');
+								$acc->add_url_line($bank_line_id,
+								$fac->client->id,
+								DOL_URL_ROOT.'/compta/fiche.php?socid=',
+								$fac->client->nom,
+				       										'company');
+							}
+						}
+						else
+						{
+							$error++;
+						}
+					}
+				}
 			}
-			$tab_id_operation = $tab;
-			$id_op = $tab_id_operation['rowid'];
-
-			// Ajout d'un nouveau paiement
-			$request="INSERT INTO ".MAIN_DB_PREFIX."paiement (
-							fk_facture,
-							datec,
-							datep,
-							amount,
-							fk_paiement,
-							num_paiement,
-							note,
-							fk_bank,
-							fk_user_creat,
-							fk_user_modif,
-							statut,
-							fk_export_compta
-						)
-
-						VALUES (
-							".$id.",
-							'".$date." ".$heure."',
-							'".$date." 12:00:00',
-							".$obj_facturation->prix_total_ttc().",
-							".$mode_reglement.",
-			NULL,
-			NULL,
-			$id_op,
-							".$_SESSION['uid'].",
-							NULL,
-							1,
-							0
-						)";
-			$sql->query ($request);
-			// Recuperation de l'id du paiement nouvellement cr�
-			$resql=$sql->query (
-			"SELECT rowid
-					FROM ".MAIN_DB_PREFIX."paiement
-					WHERE 1
-					ORDER BY rowid DESC");
-			$ret=array();
-			$tab = $sql->fetch_array($resql);
-			foreach ( $tab as $cle => $valeur )
+			else
 			{
-				$ret[$cle] = $valeur;
+				$error++;
 			}
-			$tab_id_paiement = $tab;
-			$id_paiement = $tab_id_paiement['rowid'];
-
-
-			$sql->query (
-			"INSERT INTO ".MAIN_DB_PREFIX."paiement_facture (
-							fk_paiement,
-							fk_facture,
-							amount
-						)
-
-						VALUES (
-							".$id_paiement.",
-							".$id.",
-							".$obj_facturation->prix_total_ttc()."
-						)
-				");
-
 		}
 
-		$sql->commit();
-
-
-		$redirection = 'affIndex.php?menu=validation_ok&facid='.$id;	// Ajout de l'id de la facture, pour l'inclure dans un lien pointant directement vers celle-ci dans Dolibarr
+		if (! $error)
+		{
+			$sql->commit();
+			$redirection = 'affIndex.php?menu=validation_ok&facid='.$id;	// Ajout de l'id de la facture, pour l'inclure dans un lien pointant directement vers celle-ci dans Dolibarr
+		}
+		else
+		{
+			$sql->rollback();
+			$redirection = 'affIndex.php?facid='.$id;	// Ajout de l'id de la facture, pour l'inclure dans un lien pointant directement vers celle-ci dans Dolibarr
+		}
 		break;
 
 		// End of case: valide_facture
diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php
index dd3207e87495ca3cd2a6a47b25bd60cd77484837..a4fffd54ec517c91304cf385e03c294242edacfb 100644
--- a/htdocs/compta/paiement.php
+++ b/htdocs/compta/paiement.php
@@ -59,7 +59,7 @@ if ($_POST['action'] == 'add_paiement' || $_POST['action'] == 'confirm_paiement'
 	$_POST['reyear']);
 	$paiement_id = 0;
 
-	// Verifie si des paiements sont sup�rieurs au montant facture
+	// Verifie si des paiements sont superieurs au montant facture
 	foreach ($_POST as $key => $value)
 	{
 		if (substr($key,0,7) == 'amount_')
@@ -93,8 +93,8 @@ if ($_POST['action'] == 'add_paiement' || $_POST['action'] == 'confirm_paiement'
 		// d'un paiement
 		if (! $_POST['accountid'])
 		{
-	  $fiche_erreur_message = '<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')).'</div>';
-	  $error++;
+	  		$fiche_erreur_message = '<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')).'</div>';
+			$error++;
 		}
 	}
 
@@ -155,9 +155,9 @@ if ($_POST['action'] == 'confirm_paiement' && $_POST['confirm'] == 'yes')
 				// Insertion dans llx_bank
 				$label = "(CustomerInvoicePayment)";
 				$acc = new Account($db, $_POST['accountid']);
-				//paiementid contient "CHQ ou VIR par exemple"
+
 				$bank_line_id = $acc->addline($paiement->datepaye,
-				$paiement->paiementid,
+				$paiement->paiementid,	// Payment mode id or code ("CHQ or VIR for example")
 				$label,
 				$totalpaiement,
 				$paiement->num_paiement,
@@ -167,7 +167,7 @@ if ($_POST['action'] == 'confirm_paiement' && $_POST['confirm'] == 'yes')
 				$_POST['chqbank']);
 
 				// Mise a jour fk_bank dans llx_paiement.
-				// On connait ainsi le paiement qui a g�n�r� l'�criture bancaire
+				// On connait ainsi le paiement qui a genere l'ecriture bancaire
 				if ($bank_line_id > 0)
 				{
 					$paiement->update_fk_bank($bank_line_id);
diff --git a/htdocs/includes/modules/modCashDesk.class.php b/htdocs/includes/modules/modCashDesk.class.php
index a1fb37cf0bbeae4e1e957e8ff2052840aa6cdedf..ae99afdb0e93356f528a815560762baac8dcf680 100644
--- a/htdocs/includes/modules/modCashDesk.class.php
+++ b/htdocs/includes/modules/modCashDesk.class.php
@@ -56,8 +56,7 @@ class modCashDesk extends DolibarrModules
 		$this->description = "CashDesk module";
 
 		$this->revision = explode(' ','$Revision$');
-		$this->version = 'experimental';
-		//$this->version = 'experimental';    // 'development' or 'experimental' or 'dolibarr' or version
+		$this->version = 'dolibarr';
 
 		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
 		$this->special = 0;
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index ff484b8c5657a49ac3d403d3e13ddac536399426..793dc8d94d05e36360e751cd3ccd818dc484a565 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1093,7 +1093,9 @@ ClickToDialDesc=This module allows to add an icon after the phone number of Doli
 CashDesk=Point of sales
 CashDeskSetup=Point of sales module setup
 CashDeskThirdPartyForSell=Generic third party to use for sells
-CashDeskBankAccountForSell=Cash account to use for sells
+CashDeskBankAccountForSell=Account to use to receive cash payments
+CashDeskBankAccountForCheque = Account to use to receive payments by cheque
+CashDeskBankAccountForCB = Account to use to receive cash payments by credit cards
 CashDeskIdWareHouse=Warehouse to use for sells
 ##### Bookmark #####
 BookmarkSetup=Bookmark module setup
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index 3e82d154c48e08e939f6f4ef448263690aa2797b..d09802b84a06f3daeadfa127a8bcfa1c0448589c 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -1093,7 +1093,9 @@ ClickToDialDesc = Ce module permet d'ajouter un petit picto a coté des numéros
 CashDesk=Caisse enregistreuse
 CashDeskSetup = Configuration du module Caisse enregistreuse
 CashDeskThirdPartyForSell = Tiers générique à utiliser pour les ventes
-CashDeskBankAccountForSell = Compte caisse à utiliser pour les ventes
+CashDeskBankAccountForSell = Compte à utiliser pour l'encaissement en liquide (cash)
+CashDeskBankAccountForCheque = Compte à utiliser pour l'encaissement en chèque
+CashDeskBankAccountForCB = Compte à utiliser pour l'encaissement par carte de crédit
 CashDeskIdWareHouse = Entrepot à utiliser pour les ventes
 ##### Bookmark ##### = undefined
 BookmarkSetup = Configuration du module Bookmark
diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php
index f4076c7c32781d4bf36febd8fae89fae20c34ad9..d745806cd5d242f64689da66f32e63ac19b4ce9d 100644
--- a/htdocs/lib/functions.lib.php
+++ b/htdocs/lib/functions.lib.php
@@ -3124,8 +3124,7 @@ function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id')
 	}
 	else
 	{
-		$this->error=$db->lasterror();
-		dol_syslog("dol_getIdFromCode error=".$this->error,LOG_ERR);
+		dol_syslog("dol_getIdFromCode error=".$db->lasterror(),LOG_ERR);
 		return -1;
 	}
 }