Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
aspangaro committed Jul 5, 2014
1 parent 7892852 commit e294fe1
Showing 1 changed file with 5 additions and 33 deletions.
38 changes: 5 additions & 33 deletions htdocs/core/class/fiscalyear.class.php
Expand Up @@ -62,11 +62,12 @@ function __construct($db)
}

/**
* Create object in database
* Create object in database
*
* @return int <0 if KO, >0 if OK
* @param User $user User making creation
* @return int <0 if KO, >0 if OK
*/
function create()
function create($user)
{
global $conf;

Expand Down Expand Up @@ -97,43 +98,14 @@ function create()
dol_syslog(get_class($this)."::create", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result)
{
$error++; $this->errors[]="Error ".$this->db->lasterror();
}

if (! $error)
{
$this->rowid = $this->db->last_insert_id(MAIN_DB_PREFIX."accounting_fiscalyear");
}

// Commit or rollback
if ($error)
{
foreach($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback();
return -1*$error;
}
else
{
$this->db->commit();
return $this->rowid;
}

dol_syslog(get_class($this)."::create=", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."accounting_fiscalyear");

$result=$this->update($user);
if ($result > 0)
{
$this->db->commit();
return $this->rowid;
return $this->id;
}
else
{
Expand Down

0 comments on commit e294fe1

Please sign in to comment.