modify parenting before task deletion

This commit is contained in:
atm-greg 2018-10-15 12:34:14 +02:00
parent fabc11191d
commit 06477b40a0

View File

@ -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)