From 788b2af518001bb698a3fab70e4e144d21392537 Mon Sep 17 00:00:00 2001 From: w3houde Date: Thu, 11 Jun 2026 09:26:47 +0200 Subject: [PATCH] Fix #36795 persist rang on Task::create so cloned project tasks keep order (#38690) Task::create()'s INSERT statement omitted the rang column. Project clone flows go through Task::createFromClone -> Task::create with the rang copied from the source task, but because the INSERT never wrote it the new tasks always ended up with rang=0 (the column default) and the duplicated project lost the drag/drop ordering. Include rang in the INSERT, mirroring the update() statement at line 692 that already does '($this->rang ?: 0)'. Signed-off-by: Dolicraft Co-authored-by: Dolicraft --- htdocs/projet/class/task.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 1170bd877bd..44b746a2817 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -453,6 +453,7 @@ class Task extends CommonObjectLine $sql .= ", priority"; $sql .= ", billable"; $sql .= ", fk_statut"; + $sql .= ", rang"; $sql .= ") VALUES ("; $sql .= (!empty($this->entity) ? (int) $this->entity : (int) $conf->entity); $sql .= ", ".((int) $this->fk_project); @@ -472,6 +473,7 @@ class Task extends CommonObjectLine $sql .= ", ".(($this->priority != '' && $this->priority >= 0) ? (int) $this->priority : 'null'); $sql .= ", ".((int) $this->billable); $sql .= ", ".((int) $this->status); + $sql .= ", ".((!empty($this->rang)) ? ((int) $this->rang) : "0"); $sql .= ")"; $this->db->begin();