Fix: Add more log and missing error message

This commit is contained in:
Laurent Destailleur 2014-08-17 12:43:24 +02:00
parent 3f8ec47e91
commit b0ebaec0da
3 changed files with 10 additions and 8 deletions

View File

@ -473,7 +473,8 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />'; $msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />';
}*/ }*/
} }
if (isset($_POST["country"]) && $_POST["country"]=='0') { if (isset($_POST["country"]) && $_POST["country"]=='0')
{
$ok=0; $ok=0;
setEventMessage($langs->transnoentities("ErrorFieldRequired",$langs->transnoentities("Country")),'errors'); setEventMessage($langs->transnoentities("ErrorFieldRequired",$langs->transnoentities("Country")),'errors');
} }
@ -532,7 +533,8 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$result = $db->query($sql); $result = $db->query($sql);
if ($result) // Add is ok 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 else
{ {

View File

@ -271,7 +271,7 @@ class DoliDBMysql extends DoliDB
$this->lastqueryerror = $query; $this->lastqueryerror = $query;
$this->lasterror = $this->error(); $this->lasterror = $this->error();
$this->lasterrno = $this->errno(); $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->lastquery=$query;
$this->_results = $ret; $this->_results = $ret;
@ -825,12 +825,12 @@ class DoliDBMysql extends DoliDB
$resql=$this->query($sql); $resql=$this->query($sql);
if (! $resql) 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); dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
return -1; return -1;
} }
else else
{ {
// If user already exists, we continue to set permissions // If user already exists, we continue to set permissions
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING); dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING);

View File

@ -273,7 +273,7 @@ class DoliDBMysqli extends DoliDB
$this->lastqueryerror = $query; $this->lastqueryerror = $query;
$this->lasterror = $this->error(); $this->lasterror = $this->error();
$this->lasterrno = $this->errno(); $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->lastquery=$query;
$this->_results = $ret; $this->_results = $ret;
@ -829,12 +829,12 @@ class DoliDBMysqli extends DoliDB
$resql=$this->query($sql); $resql=$this->query($sql);
if (! $resql) 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); dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_ERR);
return -1; return -1;
} }
else else
{ {
// If user already exists, we continue to set permissions // If user already exists, we continue to set permissions
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING); dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING);