Fix: Missing commit

This commit is contained in:
Laurent Destailleur 2014-06-28 15:03:11 +02:00
parent ef8b555750
commit dd1c5ce3d8

View File

@ -780,21 +780,23 @@ class CommandeFournisseur extends CommonOrder
$error=0; $error=0;
dol_syslog(get_class($this)."::refuse");
$result = 0; $result = 0;
if ($user->rights->fournisseur->commande->approuver) if ($user->rights->fournisseur->commande->approuver)
{ {
$this->db->begin(); $this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur SET fk_statut = 9"; $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur SET fk_statut = 9";
$sql .= " WHERE rowid = ".$this->id; $sql.= " WHERE rowid = ".$this->id;
if ($this->db->query($sql)) dol_syslog(get_class($this)."::refuse sql=".$sql);
$resql=$this->db->query($sql);
if ($resql)
{ {
$result = 0; $result = 0;
$this->log($user, 9, time()); $this->log($user, 9, time());
if ($error == 0) if (! $error)
{ {
// Appel des triggers // Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
@ -804,10 +806,18 @@ class CommandeFournisseur extends CommonOrder
{ {
$error++; $error++;
$this->errors=$interface->errors; $this->errors=$interface->errors;
$this->db->rollback();
} }
// Fin appel triggers // Fin appel triggers
} }
if (! $error)
{
$this->db->commit();
}
else
{
$this->db->rollback();
}
} }
else else
{ {
@ -821,7 +831,7 @@ class CommandeFournisseur extends CommonOrder
{ {
dol_syslog(get_class($this)."::refuse Not Authorized"); dol_syslog(get_class($this)."::refuse Not Authorized");
} }
return $result ; return $result;
} }
/** /**