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] 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++; }