add commit or rollback if error

This commit is contained in:
All-3kcis 2015-11-02 10:26:07 +01:00
parent 00c2b1a32a
commit a658ff7e90

View File

@ -138,22 +138,21 @@ class ProductFournisseur extends Product
dol_syslog(get_class($this)."::remove_product_fournisseur_price", LOG_DEBUG); dol_syslog(get_class($this)."::remove_product_fournisseur_price", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if (!$resql)
{
$this->db->commit();
return 1;
}
else
{ {
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
$this->db->rollback(); $error++;
return -1;
} }
} }
else
{ if (empty($error)){
$this->db->commit();
return 1;
}else{
$this->db->rollback();
return -1; return -1;
} }
} }