Fix: If only service module is activated, it's impossible to delete
service
This commit is contained in:
parent
cafd75ac4a
commit
2dce07590c
@ -15,6 +15,7 @@ Fix: [ bug #1037 ] Consumption> Supplier invoices related
|
||||
Fix: User group name do not display in card (view or edit mode)
|
||||
Fix: Link "Show all supplier invoice" on suplier card not working
|
||||
Fix: [ bug #1039 ] Pre-defined invoices conversion
|
||||
Fix: If only service module is activated, it's impossible to delete service
|
||||
|
||||
***** ChangeLog for 3.4 compared to 3.3.* *****
|
||||
For users:
|
||||
|
||||
@ -585,7 +585,7 @@ class Product extends CommonObject
|
||||
|
||||
$error=0;
|
||||
|
||||
if ($user->rights->produit->supprimer)
|
||||
if (($this->type == 0 && $user->rights->produit->supprimer) || ($this->type == 1 && $user->rights->service->supprimer))
|
||||
{
|
||||
$objectisused = $this->isObjectUsed($id);
|
||||
if (empty($objectisused))
|
||||
@ -617,23 +617,12 @@ class Product extends CommonObject
|
||||
if (! $result)
|
||||
{
|
||||
$error++;
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->errors[] = $this->db->lasterror();
|
||||
dol_syslog(get_class($this).'::delete error '.$this->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Removed extrafields
|
||||
if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
|
||||
{
|
||||
$result=$this->deleteExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
dol_syslog(get_class($this).'::delete error '.$this->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
// Delete product
|
||||
if (! $error)
|
||||
{
|
||||
@ -644,7 +633,7 @@ class Product extends CommonObject
|
||||
if ( ! $resultz )
|
||||
{
|
||||
$error++;
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->errors[] = $this->db->lasterror();
|
||||
dol_syslog(get_class($this).'::delete error '.$this->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
@ -661,7 +650,7 @@ class Product extends CommonObject
|
||||
$res=@dol_delete_dir_recursive($dir);
|
||||
if (! $res)
|
||||
{
|
||||
$this->error='ErrorFailToDeleteDir';
|
||||
$this->errors[] = 'ErrorFailToDeleteDir';
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -686,6 +675,11 @@ class Product extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -$error;
|
||||
}
|
||||
|
||||
@ -369,7 +369,7 @@ if (empty($reshook))
|
||||
{
|
||||
$result = $object->delete($object->id);
|
||||
}
|
||||
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
header('Location: '.DOL_URL_ROOT.'/product/liste.php?delprod='.urlencode($object->ref));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user