diff --git a/htdocs/projet/activity/index.php b/htdocs/projet/activity/index.php index 3d7e06f5a74..6d7be3e49f7 100644 --- a/htdocs/projet/activity/index.php +++ b/htdocs/projet/activity/index.php @@ -475,6 +475,7 @@ if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_SHO $taskstatic->projectstatus = $obj->projectstatus; $taskstatic->progress = $obj->progress; $taskstatic->fk_statut = $obj->status; + $taskstatic->status = $obj->status; $taskstatic->date_start = $db->jdate($obj->date_start); $taskstatic->date_end = $db->jdate($obj->date_end); $taskstatic->dateo = $db->jdate($obj->date_start); diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 21e5557244f..739c23713ac 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -101,9 +101,15 @@ class Task extends CommonObjectLine /** * @var int ID + * @deprecated use status instead */ public $fk_statut; + /** + * @var int ID + */ + public $status; + public $priority; /** @@ -189,6 +195,35 @@ class Task extends CommonObjectLine */ public $project_budget_amount; + /** + * Draft status + */ + const STATUS_DRAFT = 0; + + /** + * To do status + */ + const STATUS_TODO = 1; + + /** + * Running status + */ + const STATUS_RUNNING = 2; + + /** + * Finished status + */ + const STATUS_FINISHED = 3; + + /** + * Transferred status + */ + const STATUS_TRANSFERRED = 4; + + /** + * status canceled + */ + const STATUS_CANCELED = 9; /** @@ -335,7 +370,7 @@ class Task extends CommonObjectLine $sql .= " t.datee as date_end,"; $sql .= " t.fk_user_creat,"; $sql .= " t.fk_user_valid,"; - $sql .= " t.fk_statut,"; + $sql .= " t.fk_status as status,"; $sql .= " t.progress,"; $sql .= " t.budget_amount,"; $sql .= " t.priority,"; @@ -380,7 +415,8 @@ class Task extends CommonObjectLine $this->date_end = $this->db->jdate($obj->date_end); $this->fk_user_creat = $obj->fk_user_creat; $this->fk_user_valid = $obj->fk_user_valid; - $this->fk_statut = $obj->fk_statut; + $this->fk_statut = $obj->status; + $this->status = $obj->status; $this->progress = $obj->progress; $this->budget_amount = $obj->budget_amount; $this->priority = $obj->priority; @@ -884,7 +920,7 @@ class Task extends CommonObjectLine $this->duration_effective = ''; $this->fk_user_creat = null; $this->progress = '25'; - $this->fk_statut = null; + $this->status = null; $this->note = 'This is a specimen task not'; } @@ -1038,7 +1074,7 @@ class Task extends CommonObjectLine if ($includebilltime) { $sql .= " GROUP BY p.rowid, p.ref, p.title, p.public, p.fk_statut, p.usage_bill_time,"; $sql .= " t.datec, t.dateo, t.datee, t.tms,"; - $sql .= " t.rowid, t.ref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_statut,"; + $sql .= " t.rowid, t.ref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_status,"; $sql .= " t.dateo, t.datee, t.planned_workload, t.rang,"; $sql .= " t.description, "; $sql .= " t.budget_amount, "; @@ -1119,7 +1155,8 @@ class Task extends CommonObjectLine } $tasks[$i]->progress = $obj->progress; - $tasks[$i]->fk_statut = $obj->status; + $tasks[$i]->fk_statut = $obj->status; + $tasks[$i]->status = $obj->status; $tasks[$i]->public = $obj->public; $tasks[$i]->date_start = $this->db->jdate($obj->date_start); $tasks[$i]->date_end = $this->db->jdate($obj->date_end); @@ -2130,7 +2167,7 @@ class Task extends CommonObjectLine */ public function getLibStatut($mode = 0) { - return $this->LibStatut($this->fk_statut, $mode); + return $this->LibStatut($this->status, $mode); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -2321,6 +2358,7 @@ class Task extends CommonObjectLine $task_static->projectstatus = $obj->projectstatus; $task_static->progress = $obj->progress; $task_static->fk_statut = $obj->status; + $task_static->status = $obj->status; $task_static->date_start = $this->db->jdate($obj->date_start); $task_static->date_end = $this->db->jdate($obj->date_end); diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 7a7b02637be..5f190cb236b 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -346,9 +346,8 @@ $distinct = 'DISTINCT'; // We add distinct until we are added a protection to be $sql = "SELECT ".$distinct." p.rowid as projectid, p.ref as projectref, p.title as projecttitle, p.fk_statut as projectstatus, p.datee as projectdatee, p.fk_opp_status, p.public, p.fk_user_creat as projectusercreate, p.usage_bill_time,"; $sql .= " s.nom as name, s.name_alias as alias, s.rowid as socid,"; $sql .= " t.datec as date_creation, t.dateo as date_start, t.datee as date_end, t.tms as date_modification,"; -$sql .= " t.rowid as id, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress, t.fk_statut,"; -$sql .= " t.description, t.fk_task_parent"; -$sql .= " ,t.budget_amount"; +$sql .= " t.rowid as id, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress, t.fk_statut as status,"; +$sql .= " t.description, t.fk_task_parent, t.budget_amount"; // Add sum fields if (!empty($arrayfields['t.tobill']['checked']) || !empty($arrayfields['t.billed']['checked'])) { $sql .= " , SUM(tt.element_duration * ".$db->ifsql("invoice_id IS NULL", "1", "0").") as tobill, SUM(tt.element_duration * ".$db->ifsql("invoice_id IS NULL", "0", "1").") as billed"; @@ -540,7 +539,7 @@ if (!empty($arrayfields['t.tobill']['checked']) || !empty($arrayfields['t.billed $sql .= " GROUP BY p.rowid, p.ref, p.title, p.fk_statut, p.datee, p.fk_opp_status, p.public, p.fk_user_creat,"; $sql .= " s.nom, s.rowid,"; $sql .= " t.datec, t.dateo, t.datee, t.tms,"; - $sql .= " t.rowid, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress,t.budget_amount, t.fk_statut"; + $sql .= " t.rowid, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress,t.budget_amount, t.fk_status"; // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { @@ -1137,6 +1136,7 @@ while ($i < $imaxinloop) { $object->label = $obj->label; $object->description = $obj->description; $object->fk_statut = $obj->fk_statut; + $object->status = $obj->status; $object->progress = $obj->progress; $object->budget_amount = $obj->budget_amount; $object->date_start = $db->jdate($obj->date_start);