fix infinite loop
This commit is contained in:
parent
3d84adbd76
commit
ba6f7d4b0a
@ -633,7 +633,8 @@ class Project extends CommonObject
|
|||||||
$this->getLinesArray($user);
|
$this->getLinesArray($user);
|
||||||
|
|
||||||
// Delete tasks
|
// Delete tasks
|
||||||
$this->deleteTasks($this->lines);
|
$ret = $this->deleteTasks($user);
|
||||||
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
// Delete project
|
// Delete project
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -715,16 +716,31 @@ class Project extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param array $arr Array of tasks
|
* @param array $arr Array of tasks
|
||||||
*/
|
*/
|
||||||
function deleteTasks($arr)
|
function deleteTasks($user)
|
||||||
{
|
{
|
||||||
global $user;
|
$countTasks = count($this->lines);
|
||||||
|
$deleted = false;
|
||||||
foreach($arr as $task)
|
if ($countTasks){
|
||||||
{
|
foreach($this->lines as $task)
|
||||||
if($task->hasChildren() <= 0) $task->delete($user);
|
{
|
||||||
|
if($task->hasChildren() <= 0) {
|
||||||
|
$deleted = true;
|
||||||
|
$ret = $task->delete($user);
|
||||||
|
if ($ret < 1)
|
||||||
|
{
|
||||||
|
$this->errors[] = $this->db->lasterror();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$this->getLinesArray($user);
|
$this->getLinesArray($user);
|
||||||
if (count($this->lines)) $this->deleteTasks($this->lines);
|
if($deleted && count($this->lines) < $countTasks)
|
||||||
|
{
|
||||||
|
if (count($this->lines)) $this->deleteTasks($this->lines);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user