diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php
index ffd3420fb38..9ec5e33b555 100644
--- a/htdocs/core/lib/project.lib.php
+++ b/htdocs/core/lib/project.lib.php
@@ -870,6 +870,13 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
print '';
}
+ // Status
+ if (count($arrayfields) > 0 && !empty($arrayfields['t.fk_statut']['checked'])) {
+ print '
';
+ print $taskstatic->getLibStatut(4);
+ print ' | ';
+ }
+
if ($showbilltime) {
// Time not billed
if (count($arrayfields) > 0 && !empty($arrayfields['t.tobill']['checked'])) {
@@ -955,13 +962,6 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
print '';
}
- // Status
- if (count($arrayfields) > 0 && !empty($arrayfields['t.fk_statut']['checked'])) {
- print '';
- print $taskstatic->getLibStatut(4);
- print ' | ';
- }
-
// Extra fields
$extrafieldsobjectkey = $taskstatic->table_element;
$extrafieldsobjectprefix = 'efpt.';
diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang
index a76687104cb..0542f2ac060 100644
--- a/htdocs/langs/en_US/main.lang
+++ b/htdocs/langs/en_US/main.lang
@@ -1347,3 +1347,4 @@ SpecialLine=Special Line
EcoTax=Eco-Tax
GroupingLine=Grouping line
AllTime=From start
+Transferred=Transferred
diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang
index 22f6e3f3559..9e2bf735982 100644
--- a/htdocs/langs/en_US/projects.lang
+++ b/htdocs/langs/en_US/projects.lang
@@ -314,3 +314,4 @@ ErrorsTaskMerge=An error occurred while merging tasks
Billable = Billable
ConfirmCloseTask=Are you sure you want to close this task ?
ConfirmClosed=Confirm task closed
+TaskStatus=Task status
diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php
index f2bd2c74fdb..4696ce2baf1 100644
--- a/htdocs/projet/class/task.class.php
+++ b/htdocs/projet/class/task.class.php
@@ -386,6 +386,21 @@ class Task extends CommonObjectLine
public function __construct($db)
{
$this->db = $db;
+ // list of status of the task
+ $this->labelStatus = array(
+ 0 => 'Draft',
+ 1 => 'Validated',
+ 2 => 'In progress',
+ 3 => 'Closed',
+ 4 => 'Transferred',
+ );
+ $this->labelStatusShort = array(
+ 0 => 'Draft',
+ 1 => 'Validated',
+ 2 => 'In progress',
+ 3 => 'Closed',
+ 4 => 'Transferred',
+ );
}
@@ -2516,18 +2531,6 @@ class Task extends CommonObjectLine
// phpcs:enable
global $langs;
- // list of status of the task
- $this->labelStatus[0] = 'Draft';
- $this->labelStatus[1] = 'Validated';
- $this->labelStatus[2] = 'In progress';
- $this->labelStatus[3] = 'Closed';
- $this->labelStatus[4] = 'Transfered';
- $this->labelStatusShort[0] = 'Draft';
- $this->labelStatusShort[1] = 'Validated';
- $this->labelStatusShort[2] = 'In progress';
- $this->labelStatusShort[3] = 'Closed';
- $this->labelStatusShort[4] = 'Transfered';
-
if ($mode == 0) {
return $langs->trans($this->labelStatus[$status]);
} elseif ($mode == 1) {
diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php
index 281d7189419..1128ffa0b0e 100644
--- a/htdocs/projet/tasks.php
+++ b/htdocs/projet/tasks.php
@@ -98,7 +98,7 @@ $search_progresscalc = GETPOST('search_progresscalc');
$search_progressdeclare = GETPOST('search_progressdeclare');
$search_task_budget_amount = GETPOST('search_task_budget_amount');
$search_task_billable = GETPOST('search_task_billable');
-$search_fk_statut = GETPOSTINT('search_fk_statut');
+$search_status = GETPOSTINT('search_status');
$search_date_start_startmonth = GETPOSTINT('search_date_start_startmonth');
$search_date_start_startyear = GETPOSTINT('search_date_start_startyear');
@@ -182,9 +182,9 @@ $arrayfields = array(
't.progress_calculated' => array('label' => "ProgressCalculated", 'checked' => 1, 'position' => 8),
't.progress' => array('label' => "ProgressDeclared", 'checked' => 1, 'position' => 9),
't.progress_summary' => array('label' => "TaskProgressSummary", 'checked' => 1, 'position' => 10),
- 't.budget_amount' => array('label' => "Budget", 'checked' => 0, 'position' => 11),
- 'c.assigned' => array('label' => "TaskRessourceLinks", 'checked' => 1, 'position' => 12),
- 't.fk_statut' => array('label' => "Status", 'checked' => 1, 'position' => 12),
+ 't.fk_statut' => array('label' => "Status", 'checked' => 1, 'position' => 11),
+ 't.budget_amount' => array('label' => "Budget", 'checked' => 0, 'position' => 12),
+ 'c.assigned' => array('label' => "TaskRessourceLinks", 'checked' => 1, 'position' => 13),
);
if ($object->usage_bill_time) {
@@ -251,7 +251,7 @@ if (empty($reshook)) {
$search_progressdeclare = '';
$search_task_budget_amount = '';
$search_task_billable = '';
- $search_fk_statut = '';
+ $search_status = -1;
$toselect = array();
$search_array_options = array();
$search_date_start_startmonth = "";
@@ -330,15 +330,15 @@ if (!empty($search_progresscalc)) {
$morewherefilterarray[] = '(planned_workload IS NULL OR planned_workload = 0 OR '.natural_search('ROUND(100 * duration_effective / planned_workload, 2)', $search_progresscalc, 1, 1).')';
//natural_search('round(100 * $line->duration_effective / $line->planned_workload,2)', $filterprogresscalc, 1, 1).' {return 1;} else {return 0;}';
}
+if ($search_status > -1) {
+ $morewherefilterarray[] = " t.fk_statut = ".$search_status;
+}
if ($search_task_budget_amount) {
$morewherefilterarray[] = natural_search('t.budget_amount', $search_task_budget_amount, 1, 1);
}
if ($search_task_billable) {
$morewherefilterarray[] = " t.billable = ".($search_task_billable == "yes" ? 1 : 0);
}
-if ($search_fk_statut) {
- $morewherefilterarray[] = " t.fk_statut = ".$search_fk_statut;
-}
//var_dump($morewherefilterarray);
$morewherefilter = '';
@@ -579,6 +579,9 @@ if ($id > 0 || !empty($ref)) {
if ($search_progressdeclare) {
$param .= '&search_progressdeclare='.urlencode($search_progressdeclare);
}
+ if ($search_status) {
+ $param .= '&search_status='.urlencode($search_status);
+ }
if ($search_task_budget_amount) {
$param .= '&search_task_budget_amount='.urlencode($search_task_budget_amount);
}
@@ -1057,6 +1060,16 @@ if ($action == 'create' && $user->hasRight('projet', 'creer') && (empty($object-
print ' | ';
}
+ if (!empty($arrayfields['t.fk_statut']['checked'])) {
+ print '';
+ $arrayofstatus = array();
+ foreach ($taskstatic->labelStatusShort as $key => $val) {
+ $arrayofstatus[$key] = $langs->trans($val);
+ }
+ print $form->selectarray('search_status', $arrayofstatus, $search_status, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
+ print ' | ';
+ }
+
if ($object->usage_bill_time) {
if (!empty($arrayfields['t.tobill']['checked'])) {
print '';
@@ -1085,11 +1098,6 @@ if ($action == 'create' && $user->hasRight('projet', 'creer') && (empty($object-
print $form->selectyesno('search_task_billable', $search_task_billable, 0, false, 1);
print ' | ';
}
- if (!empty($arrayfields['t.fk_statut']['checked'])) {
- print '';
- //TODO: add status filter
- print ' | ';
- }
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
@@ -1147,6 +1155,9 @@ if ($action == 'create' && $user->hasRight('projet', 'creer') && (empty($object-
if (!empty($arrayfields['t.progress_summary']['checked'])) {
print_liste_field_titre($arrayfields['t.progress_summary']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center ', '', 1);
}
+ if (!empty($arrayfields['t.fk_statut']['checked'])) {
+ print_liste_field_titre($arrayfields['t.fk_statut']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center ', '');
+ }
if ($object->usage_bill_time) {
if (!empty($arrayfields['t.tobill']['checked'])) {
print_liste_field_titre($arrayfields['t.tobill']['label'], $_SERVER["PHP_SELF"], "t.tobill", '', $param, '', $sortfield, $sortorder, 'right ');
@@ -1168,9 +1179,6 @@ if ($action == 'create' && $user->hasRight('projet', 'creer') && (empty($object-
print_liste_field_titre($arrayfields['t.billable']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center ', '');
}
- if (!empty($arrayfields['t.fk_statut']['checked'])) {
- print_liste_field_titre($arrayfields['t.fk_statut']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center ', '');
- }
// Extra fields
$disablesortlink = 1;
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php
index 056860cd47e..37c156c2b28 100644
--- a/htdocs/projet/tasks/list.php
+++ b/htdocs/projet/tasks/list.php
@@ -70,6 +70,7 @@ $search_project_user = GETPOST('search_project_user', 'intcomma');
$search_task_user = GETPOST('search_task_user', 'intcomma');
$search_task_progress = GETPOST('search_task_progress');
$search_task_budget_amount = GETPOST('search_task_budget_amount');
+$search_task_status = GETPOSTINT('search_task_status');
$search_societe = GETPOST('search_societe');
$search_societe_alias = GETPOST('search_societe_alias');
$search_opp_status = GETPOST("search_opp_status", 'alpha');
@@ -181,6 +182,7 @@ $arrayfields = array(
't.progress' => array('label' => "ProgressDeclared", 'checked' => 1, 'position' => 305),
't.progress_summary' => array('label' => "TaskProgressSummary", 'checked' => 1, 'position' => 306),
't.budget_amount' => array('label' => "Budget", 'checked' => 0, 'position' => 307),
+ 't.fk_statut' => array('label' => "TaskStatus", 'checked' => 0, 'position' => 308),
't.tobill' => array('label' => "TimeToBill", 'checked' => 0, 'position' => 310),
't.billed' => array('label' => "TimeBilled", 'checked' => 0, 'position' => 311),
't.datec' => array('label' => "DateCreation", 'checked' => 0, 'position' => 500),
@@ -241,6 +243,7 @@ if (empty($reshook)) {
$search_task_progress = "";
$search_task_budget_amount = "";
$search_task_user = -1;
+ $search_task_status = -1;
$search_project_user = -1;
$search_date_startday = '';
$search_date_startmonth = '';
@@ -464,6 +467,9 @@ if ($search_project_user > 0) {
if ($search_task_user > 0) {
$sql .= " AND ect.fk_c_type_contact IN (".$db->sanitize(implode(',', array_keys($listoftaskcontacttype))).") AND ect.element_id = t.rowid AND ect.fk_socpeople = ".((int) $search_task_user);
}
+if ($search_task_status > -1) {
+ $sql .= " AND t.fk_statut = ".((int) $search_task_status);
+}
// Search for tag/category ($searchCategoryProjectList is an array of ID)
$searchCategoryProjectList = array($search_categ);
$searchCategoryProjectOperator = 0;
@@ -685,6 +691,9 @@ if ($search_task_ref_parent != '') {
if ($search_task_progress != '') {
$param .= '&search_task_progress='.urlencode($search_task_progress);
}
+if ($search_task_status != '') {
+ $param .= '&search_task_status='.urlencode($search_task_status);
+}
if ($search_societe != '') {
$param .= '&search_societe='.urlencode($search_societe);
}
@@ -954,6 +963,15 @@ if (!empty($arrayfields['t.progress']['checked'])) {
if (!empty($arrayfields['t.progress_summary']['checked'])) {
print ' | ';
}
+if (!empty($arrayfields['t.fk_statut']['checked'])) {
+ print '';
+ $arrayofstatus = array();
+ foreach ($object->labelStatusShort as $key => $val) {
+ $arrayofstatus[$key] = $langs->trans($val);
+ }
+ print $form->selectarray('search_task_status', $arrayofstatus, $search_task_status, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100');
+ print ' | ';
+}
if (!empty($arrayfields['t.budget_amount']['checked'])) {
print '';
@@ -1086,6 +1104,10 @@ if (!empty($arrayfields['t.progress_summary']['checked'])) {
print_liste_field_titre($arrayfields['t.progress_summary']['label'], $_SERVER["PHP_SELF"], "t.progress", "", $param, '', $sortfield, $sortorder, 'center ');
$totalarray['nbfield']++;
}
+if (!empty($arrayfields['t.fk_statut']['checked'])) {
+ print_liste_field_titre($arrayfields['t.fk_statut']['label'], $_SERVER["PHP_SELF"], "t.fk_statut", "", $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
+}
if (!empty($arrayfields['t.budget_amount']['checked'])) {
print_liste_field_titre($arrayfields['t.budget_amount']['label'], $_SERVER["PHP_SELF"], "t.budget_amount", "", $param, '', $sortfield, $sortorder, 'center ');
$totalarray['nbfield']++;
@@ -1479,6 +1501,15 @@ while ($i < $imaxinloop) {
$totalarray['totalprogress_summary'] = $totalarray['nbfield'];
}
}
+ // Project status
+ if (!empty($arrayfields['t.fk_statut']['checked'])) {
+ print ' | ';
+ print $object->getLibStatut(4);
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
// Budget for task
if (!empty($arrayfields['t.budget_amount']['checked'])) {
print '';
|