diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 87dab1c728a..1ece3dc712f 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -198,7 +198,7 @@ class Task extends CommonObjectLine $sql .= ", progress"; $sql .= ", budget_amount"; $sql .= ") VALUES ("; - $sql .= ((int) $conf->entity); + $sql .= (!empty($this->entity) ? (int) $this->entity : (int) $conf->entity); $sql .= ", ".((int) $this->fk_project); $sql .= ", ".(!empty($this->ref) ? "'".$this->db->escape($this->ref)."'" : 'null'); $sql .= ", ".((int) $this->fk_task_parent); diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 22258bd3b18..e5a7bb4134a 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -336,6 +336,7 @@ if ($action == 'createtask' && $user->rights->projet->creer) { $task = new Task($db); $task->fk_project = $projectid; + $task->entity = $object->entity; // Task have the same entity of project $task->ref = $taskref; $task->label = $label; $task->description = $description;