Qual: Mise en transaction de l'ajout d'écritures bancaires
This commit is contained in:
parent
8d8be88daf
commit
453141fe18
@ -137,8 +137,10 @@ class Account
|
|||||||
*/
|
*/
|
||||||
function addline($date, $oper, $label, $amount, $num_chq='', $categorie='', $user='')
|
function addline($date, $oper, $label, $amount, $num_chq='', $categorie='', $user='')
|
||||||
{
|
{
|
||||||
|
dolibarr_syslog("Account::addline: $date, $oper, $label, $amount, $num_chq, $categorie, $user");
|
||||||
if ($this->rowid)
|
if ($this->rowid)
|
||||||
{
|
{
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
switch ($oper)
|
switch ($oper)
|
||||||
{
|
{
|
||||||
@ -179,17 +181,26 @@ class Account
|
|||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if (! $result)
|
if (! $result)
|
||||||
{
|
{
|
||||||
return -2;
|
$this->db->rollback();
|
||||||
|
$this->error=$this->db->error();
|
||||||
|
return -3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$this->db->commit();
|
||||||
return $rowid;
|
return $rowid;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dolibarr_print_error($this->db);
|
$this->db->rollback();
|
||||||
return -1;
|
$this->error=$this->db->error();
|
||||||
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error="Account::addline rowid not defined";
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user