From 40bb36474a603e039aef4ea64baa6b79a90b67b7 Mon Sep 17 00:00:00 2001 From: evarisk-micka Date: Wed, 31 Jan 2024 16:48:55 +0100 Subject: [PATCH] FIX replace fk_statut by status --- htdocs/projet/activity/index.php | 2 +- htdocs/projet/class/task.class.php | 49 ++++++++++++++++++++++++------ htdocs/projet/tasks/list.php | 5 +-- 3 files changed, 43 insertions(+), 13 deletions(-) diff --git a/htdocs/projet/activity/index.php b/htdocs/projet/activity/index.php index 6d7f9656d7364..3927ccfc0d81e 100644 --- a/htdocs/projet/activity/index.php +++ b/htdocs/projet/activity/index.php @@ -474,7 +474,7 @@ $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 2a768dbbd2ad4..f0c29d303530f 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -195,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; /** @@ -341,7 +370,7 @@ public function fetch($id, $ref = '', $loadparentdata = 0) $sql .= " t.datee as date_end,"; $sql .= " t.fk_user_creat,"; $sql .= " t.fk_user_valid,"; - $sql .= " t.fk_statut,"; + $sql .= " t.status,"; $sql .= " t.progress,"; $sql .= " t.budget_amount,"; $sql .= " t.priority,"; @@ -386,7 +415,7 @@ public function fetch($id, $ref = '', $loadparentdata = 0) $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->status = $obj->status; $this->progress = $obj->progress; $this->budget_amount = $obj->budget_amount; $this->priority = $obj->priority; @@ -890,7 +919,7 @@ public function initAsSpecimen() $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'; } @@ -931,7 +960,7 @@ public function getTasksArray($usert = null, $userp = null, $projectid = 0, $soc $sql .= " DISTINCT"; // We may get several time the same record if user has several roles on same project/task } $sql .= " p.rowid as projectid, p.ref, p.title as plabel, p.public, p.fk_statut as projectstatus, p.usage_bill_time,"; - $sql .= " t.rowid as taskid, t.ref as taskref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_statut as status,"; + $sql .= " t.rowid as taskid, t.ref as taskref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.status as status,"; $sql .= " t.dateo as date_start, t.datee as date_end, t.planned_workload, t.rang,"; $sql .= " t.description, "; $sql .= " t.budget_amount, "; @@ -1044,7 +1073,7 @@ public function getTasksArray($usert = null, $userp = null, $projectid = 0, $soc 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.status,"; $sql .= " t.dateo, t.datee, t.planned_workload, t.rang,"; $sql .= " t.description, "; $sql .= " t.budget_amount, "; @@ -1125,7 +1154,7 @@ public function getTasksArray($usert = null, $userp = null, $projectid = 0, $soc } $tasks[$i]->progress = $obj->progress; - $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); @@ -1205,7 +1234,7 @@ public function getUserRolesForProjectsOrTasks($userp, $usert, $projectid = '', $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as ctc"; $sql .= " WHERE pt.rowid = ec.element_id"; if ($userp && $filteronprojstatus > -1) { - $sql .= " AND pt.fk_statut = ".((int) $filteronprojstatus); + $sql .= " AND pt.status = ".((int) $filteronprojstatus); } if ($usert && $filteronprojstatus > -1) { $sql .= " AND pt.fk_projet = p.rowid AND p.fk_statut = ".((int) $filteronprojstatus); @@ -2136,7 +2165,7 @@ public function createFromClone(User $user, $fromid, $project_id, $parent_task_i */ public function getLibStatut($mode = 0) { - return $this->LibStatut($this->fk_statut, $mode); + return $this->LibStatut($this->status, $mode); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -2287,7 +2316,7 @@ public function load_board($user) // List of tasks (does not care about permissions. Filtering will be done later) $sql = "SELECT p.rowid as projectid, p.fk_statut as projectstatus,"; - $sql .= " t.rowid as taskid, t.progress as progress, t.fk_statut as status,"; + $sql .= " t.rowid as taskid, t.progress as progress, t.status as status,"; $sql .= " t.dateo as date_start, t.datee as date_end"; $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; //$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; @@ -2326,7 +2355,7 @@ public function load_board($user) $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 72c5008475043..1c2c5056b2b4e 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -346,7 +346,7 @@ $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_update,"; -$sql .= " t.rowid as id, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress, t.fk_statut,"; +$sql .= " t.rowid as id, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress, t.status,"; $sql .= " t.description, t.fk_task_parent"; $sql .= " ,t.budget_amount"; // Add sum fields @@ -540,7 +540,7 @@ $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.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 +1137,7 @@ $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);