Skip to content

Commit

Permalink
Fix: task #11248 : there is no DB transaction on products->delete
Browse files Browse the repository at this point in the history
Qual: Mutualize code to see of an object as child
  • Loading branch information
eldy committed Aug 28, 2011
1 parent 058636e commit be53335
Show file tree
Hide file tree
Showing 4 changed files with 521 additions and 522 deletions.
29 changes: 15 additions & 14 deletions htdocs/product/class/product.class.php
Expand Up @@ -571,20 +571,6 @@ function delete($id)
}
}

if (! $error)
{
$sqlz = "DELETE FROM ".MAIN_DB_PREFIX."product";
$sqlz.= " WHERE rowid = ".$id;
dol_syslog(get_class($this).'::delete sql='.$sql, LOG_DEBUG);
$resultz = $this->db->query($sqlz);
if ( ! $resultz )
{
$error++;
$this->error = $this->db->lasterror();
dol_syslog(get_class($this).'::delete error '.$this->error, LOG_ERR);
}
}

if (! $error)
{
// Actions on extra fields (by external module or standard code)
Expand All @@ -606,6 +592,21 @@ function delete($id)
}
}

// Delete product
if (! $error)
{
$sqlz = "DELETE FROM ".MAIN_DB_PREFIX."product";
$sqlz.= " WHERE rowid = ".$id;
dol_syslog(get_class($this).'::delete sql='.$sql, LOG_DEBUG);
$resultz = $this->db->query($sqlz);
if ( ! $resultz )
{
$error++;
$this->error = $this->db->lasterror();
dol_syslog(get_class($this).'::delete error '.$this->error, LOG_ERR);
}
}

if (! $error)
{
// Appel des triggers
Expand Down

0 comments on commit be53335

Please sign in to comment.