modify parenting before task deletion
This commit is contained in:
parent
fabc11191d
commit
06477b40a0
@ -598,6 +598,17 @@ if (! $error && $massaction == 'delete' && $permtodelete)
|
||||
$result=$objecttmp->fetch($toselectid);
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($objectclass == "Task" && $objecttmp->hasChildren() > 0) {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."projet_task SET fk_task_parent = 0 WHERE fk_task_parent = ".$objecttmp->id;
|
||||
$res = $db->query($sql);
|
||||
|
||||
if (!$res)
|
||||
{
|
||||
setEventMessage('ErrorRecordParentingNotModified', 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array($objecttmp->element, array('societe','member'))) $result = $objecttmp->delete($objecttmp->id, $user, 1);
|
||||
else $result = $objecttmp->delete($user);
|
||||
if ($result <= 0)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user