Better error management
This commit is contained in:
parent
81ff145fc9
commit
e6c5f40de3
@ -510,6 +510,7 @@ class Product extends CommonObject
|
||||
function delete($id)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
$error=0;
|
||||
|
||||
if ($user->rights->produit->supprimer)
|
||||
{
|
||||
@ -536,8 +537,9 @@ class Product extends CommonObject
|
||||
$sqlz.= " WHERE rowid = ".$id;
|
||||
$resultz = $this->db->query($sqlz);
|
||||
|
||||
if ( !$resultz ){
|
||||
dol_syslog('Product::delete error sqlz='.$sqlz, LOG_INFO);
|
||||
if ( !$resultz )
|
||||
{
|
||||
dol_syslog('Product::delete error sqlz='.$sqlz, LOG_ERR);
|
||||
}
|
||||
|
||||
// Appel des triggers
|
||||
@ -547,11 +549,18 @@ class Product extends CommonObject
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
|
||||
return 0;
|
||||
if ($error)
|
||||
{
|
||||
return -$error;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error .= "Impossible de supprimer le produit.\n";
|
||||
$this->error .= "FailedToDeleteProduct. Already used.\n";
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user