Skip to content

Commit

Permalink
FIX #26920 replace fk_statut by status (#27930)
Browse files Browse the repository at this point in the history
* FIX use status instead of fk_statut

* FIX replace fk_statut by status

* FIX keep old fk_statut field in case it is used by hook or trigger

* FIX select fk_statut as status and fill both with obj->status

* Update list.php

* Update task.class.php

---------

Co-authored-by: Laurent Destailleur <[email protected]>
  • Loading branch information
evarisk-micka and eldy authored Feb 16, 2024
1 parent 62626a4 commit 010257e
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 10 deletions.
1 change: 1 addition & 0 deletions htdocs/projet/activity/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,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);
Expand Down
50 changes: 44 additions & 6 deletions htdocs/projet/class/task.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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;


/**
Expand Down Expand Up @@ -335,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.fk_status as status,";
$sql .= " t.progress,";
$sql .= " t.budget_amount,";
$sql .= " t.priority,";
Expand Down Expand Up @@ -380,7 +415,8 @@ 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->fk_statut = $obj->status;
$this->status = $obj->status;
$this->progress = $obj->progress;
$this->budget_amount = $obj->budget_amount;
$this->priority = $obj->priority;
Expand Down Expand Up @@ -884,7 +920,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';
}

Expand Down Expand Up @@ -1038,7 +1074,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.fk_status,";
$sql .= " t.dateo, t.datee, t.planned_workload, t.rang,";
$sql .= " t.description, ";
$sql .= " t.budget_amount, ";
Expand Down Expand Up @@ -1119,7 +1155,8 @@ public function getTasksArray($usert = null, $userp = null, $projectid = 0, $soc
}

$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);
Expand Down Expand Up @@ -2130,7 +2167,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
Expand Down Expand Up @@ -2321,6 +2358,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);

Expand Down
8 changes: 4 additions & 4 deletions htdocs/projet/tasks/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,8 @@
$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";
Expand Down Expand Up @@ -540,7 +539,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.fk_status";
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
Expand Down Expand Up @@ -1137,6 +1136,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);
Expand Down

0 comments on commit 010257e

Please sign in to comment.