From b0ebaec0dab012d205908fddf2f192eabdc17268 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Sun, 17 Aug 2014 12:43:24 +0200
Subject: [PATCH] Fix: Add more log and missing error message

---
 htdocs/admin/dict.php           | 6 ++++--
 htdocs/core/db/mysql.class.php  | 6 +++---
 htdocs/core/db/mysqli.class.php | 6 +++---
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index b72dff643b5..305843f7188 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -473,7 +473,8 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
 	    	$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />';
 	    }*/
     }
-    if (isset($_POST["country"]) && $_POST["country"]=='0') {
+    if (isset($_POST["country"]) && $_POST["country"]=='0')
+    {
         $ok=0;
         setEventMessage($langs->transnoentities("ErrorFieldRequired",$langs->transnoentities("Country")),'errors');
     }
@@ -532,7 +533,8 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
         $result = $db->query($sql);
         if ($result)	// Add is ok
         {
-            $_POST=array('id'=>$id);	// Clean $_POST array, we keep only
+            setEventMessage($langs->transnoentities("RecordSaved"));
+        	$_POST=array('id'=>$id);	// Clean $_POST array, we keep only
         }
         else
         {
diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php
index ab9d6e5850e..bfd7c55b4c2 100644
--- a/htdocs/core/db/mysql.class.php
+++ b/htdocs/core/db/mysql.class.php
@@ -271,7 +271,7 @@ class DoliDBMysql extends DoliDB
 				$this->lastqueryerror = $query;
 				$this->lasterror = $this->error();
 				$this->lasterrno = $this->errno();
-                dol_syslog(get_class($this)."::query SQL error: ".$query." ".$this->lasterrno, LOG_WARNING);
+                dol_syslog(get_class($this)."::query SQL error: ".$query." ".$this->lasterrno." ".$this->lasterror, LOG_WARNING);
 			}
 			$this->lastquery=$query;
 			$this->_results = $ret;
@@ -825,12 +825,12 @@ class DoliDBMysql extends DoliDB
         $resql=$this->query($sql);
         if (! $resql)
         {
-            if ($this->lasterrno != 'DB_ERROR_USER_ALREADY_EXISTS') 
+            if ($this->lasterrno != 'DB_ERROR_USER_ALREADY_EXISTS')
             {
         		dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
 	            return -1;
             }
-            else 
+            else
             {
             	// If user already exists, we continue to set permissions
             	dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING);
diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php
index 40061a4fa1a..7a964d07afc 100644
--- a/htdocs/core/db/mysqli.class.php
+++ b/htdocs/core/db/mysqli.class.php
@@ -273,7 +273,7 @@ class DoliDBMysqli extends DoliDB
                 $this->lastqueryerror = $query;
                 $this->lasterror = $this->error();
                 $this->lasterrno = $this->errno();
-                dol_syslog(get_class($this)."::query SQL error: ".$query." ".$this->lasterrno, LOG_WARNING);
+                dol_syslog(get_class($this)."::query SQL error: ".$query." ".$this->lasterrno." ".$this->lasterror, LOG_WARNING);
             }
             $this->lastquery=$query;
             $this->_results = $ret;
@@ -829,12 +829,12 @@ class DoliDBMysqli extends DoliDB
         $resql=$this->query($sql);
         if (! $resql)
         {
-            if ($this->lasterrno != 'DB_ERROR_USER_ALREADY_EXISTS') 
+            if ($this->lasterrno != 'DB_ERROR_USER_ALREADY_EXISTS')
             {
             	dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
             	return -1;
             }
-            else 
+            else
             {
             	// If user already exists, we continue to set permissions
             	dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING);
-- 
GitLab