From 04cb8453f046e6b98bbec91e2a61d8b5f9744be0 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Tue, 6 Apr 2021 16:59:00 +0200 Subject: [PATCH 1/2] FIX : we can't update task if closed project because of wrong test with PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE conf --- htdocs/projet/class/task.class.php | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index fe8b2eeb8e3..71907745ffe 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -402,20 +402,23 @@ class Task extends CommonObject if (!$error && !empty($conf->global->PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE)) { // Close the parent project if it is open (validated) and its tasks are 100% completed $project = new Project($this->db); - if ($project->fetch($this->fk_project) > 0 && $project->statut == Project::STATUS_VALIDATED) { - $project->getLinesArray(null); // this method does not return <= 0 if fails - $projectCompleted = array_reduce( - $project->lines, - function ($allTasksCompleted, $task) { - return $allTasksCompleted && $task->progress >= 100; - }, + if ($project->fetch($this->fk_project) > 0) { + if($project->statut == Project::STATUS_VALIDATED) { + $project->getLinesArray(null); // this method does not return <= 0 if fails + $projectCompleted = array_reduce( + $project->lines, + function ($allTasksCompleted, $task) { + return $allTasksCompleted && $task->progress >= 100; + }, 1 - ); - if ($projectCompleted) { - if ($project->setClose($user) <= 0) { - $error++; + ); + if ($projectCompleted) { + if ($project->setClose($user) <= 0) { + $error++; + } } } + } else { $error++; } From f5aa199c94fbb2c64b20a6ba2ace604a7bf4a685 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 6 Apr 2021 15:03:07 +0000 Subject: [PATCH 2/2] Fixing style errors. --- htdocs/projet/class/task.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 71907745ffe..0f84313b75a 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -403,7 +403,7 @@ class Task extends CommonObject // Close the parent project if it is open (validated) and its tasks are 100% completed $project = new Project($this->db); if ($project->fetch($this->fk_project) > 0) { - if($project->statut == Project::STATUS_VALIDATED) { + if ($project->statut == Project::STATUS_VALIDATED) { $project->getLinesArray(null); // this method does not return <= 0 if fails $projectCompleted = array_reduce( $project->lines, @@ -418,7 +418,6 @@ class Task extends CommonObject } } } - } else { $error++; }