Skip to content

Commit

Permalink
modify parenting before task deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
atm-greg committed Oct 15, 2018
1 parent fabc111 commit 06477b4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions htdocs/core/actions_massactions.inc.php
Expand Up @@ -598,6 +598,17 @@
$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)
Expand Down

0 comments on commit 06477b4

Please sign in to comment.