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: User group name do not display in card (view or edit mode)
|
||||||
Fix: Link "Show all supplier invoice" on suplier card not working
|
Fix: Link "Show all supplier invoice" on suplier card not working
|
||||||
Fix: [ bug #1039 ] Pre-defined invoices conversion
|
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.* *****
|
***** ChangeLog for 3.4 compared to 3.3.* *****
|
||||||
For users:
|
For users:
|
||||||
|
|||||||
@ -585,7 +585,7 @@ class Product extends CommonObject
|
|||||||
|
|
||||||
$error=0;
|
$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);
|
$objectisused = $this->isObjectUsed($id);
|
||||||
if (empty($objectisused))
|
if (empty($objectisused))
|
||||||
@ -617,23 +617,12 @@ class Product extends CommonObject
|
|||||||
if (! $result)
|
if (! $result)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$this->error = $this->db->lasterror();
|
$this->errors[] = $this->db->lasterror();
|
||||||
dol_syslog(get_class($this).'::delete error '.$this->error, LOG_ERR);
|
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
|
// Delete product
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@ -644,7 +633,7 @@ class Product extends CommonObject
|
|||||||
if ( ! $resultz )
|
if ( ! $resultz )
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$this->error = $this->db->lasterror();
|
$this->errors[] = $this->db->lasterror();
|
||||||
dol_syslog(get_class($this).'::delete error '.$this->error, LOG_ERR);
|
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);
|
$res=@dol_delete_dir_recursive($dir);
|
||||||
if (! $res)
|
if (! $res)
|
||||||
{
|
{
|
||||||
$this->error='ErrorFailToDeleteDir';
|
$this->errors[] = 'ErrorFailToDeleteDir';
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -686,6 +675,11 @@ class Product extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
foreach($this->errors as $errmsg)
|
||||||
|
{
|
||||||
|
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
||||||
|
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||||
|
}
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -$error;
|
return -$error;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user