From 8655c29d090d7c806bc8d962ba1fda45695796a8 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Tue, 21 Dec 2010 00:44:57 +0000
Subject: [PATCH] Fix: Error message as not visible

---
 htdocs/compta/paiement.php                      |  2 ++
 htdocs/compta/paiement/cheque/fiche.php         |  4 ++--
 htdocs/compta/paiement/class/paiement.class.php | 13 +++++--------
 htdocs/lib/functions.lib.php                    |  8 +++++---
 4 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php
index e38af4c4dee..d420675adcc 100644
--- a/htdocs/compta/paiement.php
+++ b/htdocs/compta/paiement.php
@@ -214,6 +214,8 @@ if ($_GET['action'] == 'create' || $_POST['action'] == 'confirm_paiement' || $_P
 		if ($facture->type == 2) $title.=$langs->trans("EnterPaymentDueToCustomer");
 		print_fiche_titre($title);
 
+		if ($errmsg) dol_htmloutput_errors($errmsg);
+
 		// Bouchon
 		if ($facture->type == 2)
 		{
diff --git a/htdocs/compta/paiement/cheque/fiche.php b/htdocs/compta/paiement/cheque/fiche.php
index f082e4f1ba4..ae009749eff 100644
--- a/htdocs/compta/paiement/cheque/fiche.php
+++ b/htdocs/compta/paiement/cheque/fiche.php
@@ -172,7 +172,7 @@ if ($_GET['action'] == 'new')
 	$hselected = $h;
 	$h++;
 
-	dol_fiche_head($head, $hselected, $langs->trans("Cheques"));
+	print_fiche_titre($langs->trans("Cheques"));
 }
 else
 {
@@ -423,7 +423,7 @@ else
 
 }
 
-print '</div>';
+if ($_GET['action'] == 'new') dol_fiche_end();
 
 
 /*
diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php
index 3d080e1f7a6..39c1138371e 100644
--- a/htdocs/compta/paiement/class/paiement.class.php
+++ b/htdocs/compta/paiement/class/paiement.class.php
@@ -143,7 +143,7 @@ class Paiement
 		$this->total = price2num($this->total);
 
 		// Check parameters
-		if ($this->total == 0) return -1; // On accepte les montants negatifs pour les rejets de prelevement
+		if ($this->total == 0) return -1; // On accepte les montants negatifs pour les rejets de prelevement mais pas null
 
 
 		$this->db->begin();
@@ -194,17 +194,12 @@ class Paiement
 		}
 		else
 		{
-			$this->error=$this->db->error();
+			$this->error=$this->db->lasterror();
 			dol_syslog(get_class($this).'::Create insert paiement error='.$this->error, LOG_ERR);
 			$error++;
 		}
 
-        // If option to add link to bank account is on
-
-
-
-
-		if (! $error) // On accepte les montants negatifs
+		if (! $error)
 		{
 			$this->db->commit();
 			return $this->id;
@@ -325,6 +320,8 @@ class Paiement
         {
             require_once(DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php');
 
+            dol_syslog("$user->id,$mode,$label,$accountid,$emetteur_nom,$emetteur_banque");
+
             $acc = new Account($this->db);
             $acc->fetch($accountid);
 
diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php
index 54fd231d7bd..7b26d9fcaf3 100644
--- a/htdocs/lib/functions.lib.php
+++ b/htdocs/lib/functions.lib.php
@@ -84,7 +84,7 @@ function dol_include_once($relpath)
 function dol_require_once($relpath)
 {
 	$res=false;
-	
+
 	// Forced to use file_exists otherwise there is a blank page
 	//$res=@require_once(DOL_DOCUMENT_ROOT.$relpath);
 	//if (! $res && defined('DOL_DOCUMENT_ROOT_ALT')) $res=@require_once(DOL_DOCUMENT_ROOT_ALT.$relpath);
@@ -127,7 +127,7 @@ function dol_buildpath($path,$mode=0)
 			if (! file_exists(DOL_DOCUMENT_ROOT.$path)) $res = DOL_URL_ROOT_ALT.$path;
 		}
 	}
-	
+
 	return $res;
 }
 
@@ -2060,6 +2060,7 @@ function dolibarr_print_error($db='',$error='')
  *	renvoyer leur erreur par l'intermediaire de leur propriete "error".
  *	@param      db      	Database handler
  *	@param      error		String or array of errors strings to show
+ *  @see        dol_htmloutput_errors
  */
 function dol_print_error($db='',$error='')
 {
@@ -3453,6 +3454,7 @@ function monthArrayOrSelected($selected=0)
  *	@param		mesgstring		Error message
  *	@param		mesgarray		Error messages array
  *	@return		html			Return html output
+ *  @see        dol_print_error
  */
 function dol_htmloutput_errors($mesgstring='',$mesgarray='')
 {
@@ -3475,7 +3477,7 @@ function dol_htmloutput_errors($mesgstring='',$mesgarray='')
 	{
 		$ret++;
 		print '<div class="error">';
-		print $mesgstring;
+		print $langs->trans($mesgstring);
 		print '</div>';
 	}
 
-- 
GitLab