Fix: Error on project creation

This commit is contained in:
Laurent Destailleur 2010-02-27 23:40:31 +00:00
parent 36c4605d17
commit 7e25edfe0a

View File

@ -71,17 +71,19 @@ class Project extends CommonObject
} }
/** /**
* \brief Cree un projet en base * \brief Create a project into database
* \param user Id utilisateur qui cree * \param user Id utilisateur qui cree
* \return int <0 si ko, id du projet cree si ok * \return int <0 si ko, id du projet cree si ok
*/ */
function create($user, $notrigger=0) function create($user, $notrigger=0)
{ {
$ret=0;
// Check parameters // Check parameters
if (! trim($this->ref)) if (! trim($this->ref))
{ {
$this->error='ErrorFieldsRequired'; $this->error='ErrorFieldsRequired';
dol_syslog("Project::Create error -1 ref null"); dol_syslog("Project::Create error -1 ref null", LOG_ERR);
return -1; return -1;
} }
@ -112,7 +114,7 @@ class Project extends CommonObject
if ($resql) if ($resql)
{ {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."projet"); $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."projet");
$result = $this->id; $ret = $this->id;
if (! $notrigger) if (! $notrigger)
{ {
@ -128,10 +130,10 @@ class Project extends CommonObject
{ {
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
dol_syslog("Project::Create error -2 ".$this->error, LOG_ERR); dol_syslog("Project::Create error -2 ".$this->error, LOG_ERR);
$result = -2; $ret = -2;
} }
return $result; return $ret;
} }