Fix: problem to delete a service if the product module is disable

This commit is contained in:
Regis Houssin 2011-05-15 17:00:18 +00:00
parent 27005362b3
commit b523ab815a
2 changed files with 7 additions and 2 deletions

View File

@ -572,6 +572,7 @@ class Product extends CommonObject
function delete($id)
{
global $conf,$user,$langs;
$error=0;
if ($user->rights->produit->supprimer)

View File

@ -343,11 +343,15 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->produit->
/*
* Suppression d'un produit/service pas encore affect
*/
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->produit->supprimer)
if ($action == 'confirm_delete' && $confirm == 'yes')
{
$product = new Product($db);
$product->fetch($id);
$result = $product->delete($id);
if ( ($product->type == 0 && $user->rights->produit->supprimer) || ($product->type == 1 && $user->rights->service->supprimer) )
{
$result = $product->delete($id);
}
if ($result == 0)
{