Skip to content

Commit

Permalink
FIX replace fk_statut by status
Browse files Browse the repository at this point in the history
  • Loading branch information
evarisk-micka committed Jan 31, 2024
1 parent ab1495f commit 40bb364
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 13 deletions.
2 changes: 1 addition & 1 deletion htdocs/projet/activity/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
49 changes: 39 additions & 10 deletions htdocs/projet/class/task.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;


/**
Expand Down Expand Up @@ -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,";
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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';
}

Expand Down Expand Up @@ -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, ";
Expand Down Expand Up @@ -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, ";
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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);

Expand Down
5 changes: 3 additions & 2 deletions htdocs/projet/tasks/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 40bb364

Please sign in to comment.