diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index e5550f9ddd0..9b9f000cf17 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -354,12 +354,13 @@ function project_admin_prepare_head() * @param int $projectidfortotallink 0 or Id of project to use on total line (link to see all time consumed for project) * @param string $filterprogresscalc filter text * @param string $showbilltime Add the column 'TimeToBill' and 'TimeBilled' + * @param array $arrayfields Array with displayed coloumn information * @return int Nb of tasks shown */ -function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId = '', $addordertick = 0, $projectidfortotallink = 0, $filterprogresscalc = '', $showbilltime = 0) +function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId = '', $addordertick = 0, $projectidfortotallink = 0, $filterprogresscalc = '', $showbilltime = 0, $arrayfields = array()) { - global $user, $langs, $conf, $db; - global $projectstatic, $taskstatic; + global $user, $langs, $conf, $db, $hookmanager; + global $projectstatic, $taskstatic, $extrafields; $lastprojectid = 0; @@ -375,7 +376,6 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t } $lines = array_values($lines); } - $numlines = count($lines); // We declare counter as global because we want to edit them into recursive call @@ -487,44 +487,56 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t } // Ref of task - print ''; - if ($showlineingray) - { - print ''.img_object('', 'projecttask').' '.$lines[$i]->ref.''; + if (count($arrayfields)>0 && !empty($arrayfields['t.ref']['checked'])) { + print ''; + if ($showlineingray) { + print '' . img_object('', 'projecttask') . ' ' . $lines[$i]->ref . ''; + } else { + print $taskstatic->getNomUrl(1, 'withproject'); + } + print ''; } - else - { - print $taskstatic->getNomUrl(1, 'withproject'); - } - print ''; // Title of task - print ""; - if ($showlineingray) print ''; - //else print ''; - for ($k = 0; $k < $level; $k++) - { - print '
'; + if (count($arrayfields)>0 && !empty($arrayfields['t.label']['checked'])) { + print ""; + if ($showlineingray) + print ''; + //else print ''; + for ($k = 0; $k < $level; $k++) { + print '
'; + } + print $lines[$i]->label; + for ($k = 0; $k < $level; $k++) { + print '
'; + } + if ($showlineingray) + print '
'; + //else print ''; + print "\n"; } - print $lines[$i]->label; - for ($k = 0; $k < $level; $k++) - { - print '
'; + + if (count($arrayfields)>0 && !empty($arrayfields['t.description']['checked'])) { + print ""; + print $lines[$i]->description; + print "\n"; } - if ($showlineingray) print '
'; - //else print ''; - print "\n"; // Date start - print ''; - print dol_print_date($lines[$i]->date_start, 'dayhour'); - print ''; + if (count($arrayfields)>0 && !empty($arrayfields['t.dateo']['checked'])) { + print ''; + print dol_print_date($lines[$i]->date_start, 'dayhour'); + print ''; + } // Date end - print ''; - print dol_print_date($lines[$i]->date_end, 'dayhour'); - if ($taskstatic->hasDelay()) print img_warning($langs->trans("Late")); - print ''; + if (count($arrayfields)>0 && !empty($arrayfields['t.datee']['checked'])) { + print ''; + print dol_print_date($lines[$i]->date_end, 'dayhour'); + if ($taskstatic->hasDelay()) + print img_warning($langs->trans("Late")); + print ''; + } $plannedworkloadoutputformat = 'allhourmin'; $timespentoutputformat = 'allhourmin'; @@ -532,79 +544,88 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t if (!empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) $timespentoutputformat = $conf->global->PROJECT_TIME_SPENT_FORMAT; // Planned Workload (in working hours) - print ''; - $fullhour = convertSecondToTime($lines[$i]->planned_workload, $plannedworkloadoutputformat); - $workingdelay = convertSecondToTime($lines[$i]->planned_workload, 'all', 86400, 7); // TODO Replace 86400 and 7 to take account working hours per day and working day per weeks - if ($lines[$i]->planned_workload != '') - { - print $fullhour; - // TODO Add delay taking account of working hours per day and working day per week - //if ($workingdelay != $fullhour) print '
('.$workingdelay.')'; + if (count($arrayfields)>0 && !empty($arrayfields['t.planned_workload']['checked'])) { + print ''; + $fullhour = convertSecondToTime($lines[$i]->planned_workload, $plannedworkloadoutputformat); + $workingdelay = convertSecondToTime($lines[$i]->planned_workload, 'all', 86400, 7); // TODO Replace 86400 and 7 to take account working hours per day and working day per weeks + if ($lines[$i]->planned_workload != '') { + print $fullhour; + // TODO Add delay taking account of working hours per day and working day per week + //if ($workingdelay != $fullhour) print '
('.$workingdelay.')'; + } + //else print '--:--'; + print ''; } - //else print '--:--'; - print ''; // Time spent - print ''; - if ($showlineingray) print ''; - else print ''; - if ($lines[$i]->duration) print convertSecondToTime($lines[$i]->duration, $timespentoutputformat); - else print '--:--'; - if ($showlineingray) print ''; - else print ''; - print ''; + if (count($arrayfields)>0 && !empty($arrayfields['t.duration_effective']['checked'])) { + print ''; + if ($showlineingray) + print ''; + else print ''; + if ($lines[$i]->duration) + print convertSecondToTime($lines[$i]->duration, $timespentoutputformat); + else print '--:--'; + if ($showlineingray) + print ''; + else print ''; + print ''; + } // Progress calculated (Note: ->duration is time spent) - print ''; - if ($lines[$i]->planned_workload || $lines[$i]->duration) - { - if ($lines[$i]->planned_workload) print round(100 * $lines[$i]->duration / $lines[$i]->planned_workload, 2).' %'; - else print ''.$langs->trans('WorkloadNotDefined').''; + if (count($arrayfields)>0 && !empty($arrayfields['t.progress_calculated']['checked'])) { + print ''; + if ($lines[$i]->planned_workload || $lines[$i]->duration) { + if ($lines[$i]->planned_workload) + print round(100 * $lines[$i]->duration / $lines[$i]->planned_workload, 2) . ' %'; + else print '' . $langs->trans('WorkloadNotDefined') . ''; + } + print ''; } - print ''; // Progress declared - print ''; - if ($lines[$i]->progress != '') - { - print getTaskProgressBadge($taskstatic); + if (count($arrayfields)>0 && !empty($arrayfields['t.progress']['checked'])) { + print ''; + if ($lines[$i]->progress != '') { + print getTaskProgressBadge($taskstatic); + } + print ''; } - print ''; // resume - print ''; - if ($lines[$i]->progress != '' && $lines[$i]->duration) { - print getTaskProgressView($taskstatic, false, false); - } - print ''; + if (count($arrayfields)>0 && !empty($arrayfields['t.progress_summary']['checked'])) { + print ''; + if ($lines[$i]->progress != '' && $lines[$i]->duration) { + print getTaskProgressView($taskstatic, false, false); + } + print ''; + } if ($showbilltime) { // Time not billed - print ''; - if ($lines[$i]->usage_bill_time) - { - print convertSecondToTime($lines[$i]->tobill, 'allhourmin'); - $total_projectlinesa_tobill += $lines[$i]->tobill; - } - else - { - print ''.$langs->trans("NA").''; - } - print ''; + if (count($arrayfields)>0 && !empty($arrayfields['t.tobill']['checked'])) { + print ''; + if ($lines[$i]->usage_bill_time) { + print convertSecondToTime($lines[$i]->tobill, 'allhourmin'); + $total_projectlinesa_tobill += $lines[$i]->tobill; + } else { + print '' . $langs->trans("NA") . ''; + } + print ''; + } // Time billed - print ''; - if ($lines[$i]->usage_bill_time) - { - print convertSecondToTime($lines[$i]->billed, 'allhourmin'); - $total_projectlinesa_billed += $lines[$i]->billed; - } - else - { - print ''.$langs->trans("NA").''; - } - print ''; + if (count($arrayfields)>0 && !empty($arrayfields['t.billed']['checked'])) { + print ''; + if ($lines[$i]->usage_bill_time) { + print convertSecondToTime($lines[$i]->billed, 'allhourmin'); + $total_projectlinesa_billed += $lines[$i]->billed; + } else { + print '' . $langs->trans("NA") . ''; + } + print ''; + } } // Contacts of task @@ -628,6 +649,15 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t print ''; } + // Extra fields + $extrafieldsobjectkey=$taskstatic->table_element; + $obj=$lines[$i]; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$lines[$i]); + $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Tick to drag and drop if ($addordertick) { @@ -641,7 +671,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t if ($level >= 0) // Call sublevels { $level++; - if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick, $projectidfortotallink, $filterprogresscalc, $showbilltime); + if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick, $projectidfortotallink, $filterprogresscalc, $showbilltime, $arrayfields); $level--; } @@ -663,17 +693,23 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t print ''; print ''.$langs->trans("Total").''; if ($showproject) print ''; - print ''; - print ''; - print ''; - print ''; - print convertSecondToTime($total_projectlinesa_planned, 'allhourmin'); - print ''; - print ''; - if ($projectidfortotallink > 0) print ''; - print convertSecondToTime($total_projectlinesa_spent, 'allhourmin'); - if ($projectidfortotallink > 0) print ''; - print ''; + if (count($arrayfields)>0 && !empty($arrayfields['t.label']['checked'])) print ''; + if (count($arrayfields)>0 && !empty($arrayfields['t.dateo']['checked'])) print ''; + if (count($arrayfields)>0 && !empty($arrayfields['t.datee']['checked'])) print ''; + if (count($arrayfields)>0 && !empty($arrayfields['t.planned_workload']['checked'])) { + print ''; + print convertSecondToTime($total_projectlinesa_planned, 'allhourmin'); + print ''; + } + if (count($arrayfields)>0 && !empty($arrayfields['t.duration_effective']['checked'])) { + print ''; + if ($projectidfortotallink > 0) + print ''; + print convertSecondToTime($total_projectlinesa_spent, 'allhourmin'); + if ($projectidfortotallink > 0) + print ''; + print ''; + } if ($total_projectlinesa_planned) { $totalAverageDeclaredProgress = round(100 * $total_projectlinesa_declared_if_planned / $total_projectlinesa_planned, 2); @@ -698,33 +734,45 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t } } - print ''; - if ($total_projectlinesa_planned) print $totalCalculatedProgress.' %'; - print ''; - print ''; - if ($total_projectlinesa_planned) print ''.$totalAverageDeclaredProgress.' %'; - print ''; + if (count($arrayfields)>0 && !empty($arrayfields['t.progress_calculated']['checked'])) { + print ''; + if ($total_projectlinesa_planned) + print $totalCalculatedProgress . ' %'; + print ''; + } + if (count($arrayfields)>0 && !empty($arrayfields['t.progress']['checked'])) { + print ''; + if ($total_projectlinesa_planned) + print '' . $totalAverageDeclaredProgress . ' %'; + print ''; + } // resume - print ''; - if ($total_projectlinesa_planned) { - print ''; - print '
'; - print '
'; - print '
'; - print ''; - } - print ''; + if (count($arrayfields)>0 && !empty($arrayfields['t.progress_summary']['checked'])) { + print ''; + if ($total_projectlinesa_planned) { + print ''; + print '
'; + print '
'; + print '
'; + print ''; + } + print ''; + } if ($showbilltime) { - print ''; - print convertSecondToTime($total_projectlinesa_tobill, 'allhourmin'); - print ''; - print ''; - print convertSecondToTime($total_projectlinesa_billed, 'allhourmin'); - print ''; + if (count($arrayfields)>0 && !empty($arrayfields['t.tobill']['checked'])) { + print ''; + print convertSecondToTime($total_projectlinesa_tobill, 'allhourmin'); + print ''; + } + if (count($arrayfields)>0 && !empty($arrayfields['t.billed']['checked'])) { + print ''; + print convertSecondToTime($total_projectlinesa_billed, 'allhourmin'); + print ''; + } } // Contacts of task if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) diff --git a/htdocs/core/tpl/extrafields_list_search_title.tpl.php b/htdocs/core/tpl/extrafields_list_search_title.tpl.php index c6d3776cfe4..9b06fc37eff 100644 --- a/htdocs/core/tpl/extrafields_list_search_title.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_title.tpl.php @@ -8,6 +8,7 @@ if (empty($conf) || ! is_object($conf)) } if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey=$object->table_element; +if (!isset($disablesortlink)) $disablesortlink=0; // Loop to show all columns of extrafields for the title line if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ... @@ -30,7 +31,7 @@ if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_ { $tooltip = empty($extrafields->attributes[$extrafieldsobjectkey]['help'][$key]) ? '' : $extrafields->attributes[$extrafieldsobjectkey]['help'][$key]; - print getTitleFieldOfList($extrafields->attributes[$extrafieldsobjectkey]['label'][$key], 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'" data-titlekey="'.$key.'"':'data-titlekey="'.$key.'"'), $sortfield, $sortorder, '', 0, $tooltip)."\n"; + print getTitleFieldOfList($extrafields->attributes[$extrafieldsobjectkey]['label'][$key], 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'" data-titlekey="'.$key.'"':'data-titlekey="'.$key.'"'), $sortfield, $sortorder, '', $disablesortlink, $tooltip)."\n"; } } } diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index ead6dbf0ade..4a4c70d2bb7 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -266,3 +266,4 @@ InvoiceToUse=Draft invoice to use NewInvoice=New invoice OneLinePerTask=One line per task OneLinePerPeriod=One line per period +RefTaskParent=Ref. Parent Task diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 3b91c867ebe..f3457b2481f 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -743,11 +743,12 @@ class Task extends CommonObject * @param string $filterontaskuser Filter on user assigned to task * @param array $extrafields Show additional column from project or task * @param int $includebilltime Calculate also the time to bill and billed + * @param array $search_array_options Array of search * @return array Array of tasks */ - public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0) + public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options = array()) { - global $conf; + global $conf, $hookmanager; $tasks = array(); @@ -759,6 +760,7 @@ class Task extends CommonObject $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.dateo as date_start, t.datee as date_end, t.planned_workload, t.rang,"; + $sql .= " t.description, "; $sql .= " s.rowid as thirdparty_id, s.nom as thirdparty_name, s.email as thirdparty_email,"; $sql .= " p.fk_opp_status, p.opp_amount, p.opp_percent, p.budget_amount"; if (!empty($extrafields->attributes['projet']['label'])) @@ -853,12 +855,21 @@ class Task extends CommonObject if ($filteronproj) $sql .= natural_search(array("p.ref", "p.title"), $filteronproj); if ($filteronprojstatus && $filteronprojstatus != '-1') $sql .= " AND p.fk_statut IN (".$filteronprojstatus.")"; if ($morewherefilter) $sql .= $morewherefilter; + // Add where from extra fields + $extrafieldsobjectkey='projet_task'; + $extrafieldsobjectprefix='efpt.'; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; + // Add where from hooks + $parameters = array(); + $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook + $sql .= $hookmanager->resPrint; 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.dateo, t.datee, t.planned_workload, t.rang,"; + $sql .= " t.description, "; $sql .= " s.rowid, s.nom, s.email,"; $sql .= " p.fk_opp_status, p.opp_amount, p.opp_percent, p.budget_amount"; if (!empty($extrafields->attributes['projet']['label'])) @@ -871,6 +882,7 @@ class Task extends CommonObject } } + $sql .= " ORDER BY p.ref, t.rang, t.dateo"; //print $sql;exit; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index b125ed7306e..a95d7162a87 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -52,6 +52,7 @@ $cancel = GETPOST('cancel', 'alpha'); $search_user_id = GETPOST('search_user_id', 'int'); $search_taskref = GETPOST('search_taskref'); $search_tasklabel = GETPOST('search_tasklabel'); +$search_taskdescription=GETPOST('search_taskdescription'); $search_dtstartday = GETPOST('search_dtstartday'); $search_dtstartmonth = GETPOST('search_dtstartmonth'); $search_dtstartyear = GETPOST('search_dtstartyear'); @@ -63,6 +64,8 @@ $search_timespend = GETPOST('search_timespend'); $search_progresscalc = GETPOST('search_progresscalc'); $search_progressdeclare = GETPOST('search_progressdeclare'); +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'projecttasklist'; + //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects $object = new Project($db); @@ -78,6 +81,7 @@ if ($id > 0 || !empty($ref)) $extrafields->fetch_name_optionals_label($object->table_element); } $extrafields->fetch_name_optionals_label($taskstatic->table_element); +$search_array_options = $extrafields->getOptionalsFromPost($taskstatic->table_element, '', 'search_'); // Security check $socid = 0; @@ -96,37 +100,36 @@ $planned_workloadhour = (GETPOST('planned_workloadhour', 'int') ?GETPOST('planne $planned_workloadmin = (GETPOST('planned_workloadmin', 'int') ?GETPOST('planned_workloadmin', 'int') : 0); $planned_workload = $planned_workloadhour * 3600 + $planned_workloadmin * 60; +// Definition of fields for list $arrayfields = array( - 't.ref'=>array('label'=>$langs->trans("RefTask"), 'checked'=>1, 'position'=>80), - 't.label'=>array('label'=>$langs->trans("LabelTask"), 'checked'=>1, 'position'=>80), - 't.dateo'=>array('label'=>$langs->trans("DateStart"), 'checked'=>1, 'position'=>100), - 't.datee'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1, 'position'=>101), - 'p.ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>1), - 'p.title'=>array('label'=>$langs->trans("ProjectLabel"), 'checked'=>0), - 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>0), - 'p.fk_statut'=>array('label'=>$langs->trans("ProjectStatus"), 'checked'=>1), - 't.planned_workload'=>array('label'=>$langs->trans("PlannedWorkload"), 'checked'=>1, 'position'=>102), - 't.duration_effective'=>array('label'=>$langs->trans("TimeSpent"), 'checked'=>1, 'position'=>103), - 't.progress_calculated'=>array('label'=>$langs->trans("ProgressCalculated"), 'checked'=>1, 'position'=>104), - 't.progress'=>array('label'=>$langs->trans("ProgressDeclared"), 'checked'=>1, 'position'=>105), - 't.tobill'=>array('label'=>$langs->trans("TimeToBill"), 'checked'=>0, 'position'=>110), - 't.billed'=>array('label'=>$langs->trans("TimeBilled"), 'checked'=>0, 'position'=>111), - 't.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), - 't.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), - //'t.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), + 't.ref'=>array('label'=>$langs->trans("RefTask"), 'checked'=>1, 'position'=>1), + 't.label'=>array('label'=>$langs->trans("LabelTask"), 'checked'=>1, 'position'=>2), + 't.description'=>array('label'=>$langs->trans("Description"), 'checked'=>0, 'position'=>3), + 't.dateo'=>array('label'=>$langs->trans("DateStart"), 'checked'=>1, 'position'=>4), + 't.datee'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1, 'position'=>5), + 't.planned_workload'=>array('label'=>$langs->trans("PlannedWorkload"), 'checked'=>1, 'position'=>6), + 't.duration_effective'=>array('label'=>$langs->trans("TimeSpent"), 'checked'=>1, 'position'=>7), + 't.progress_calculated'=>array('label'=>$langs->trans("ProgressCalculated"), 'checked'=>1, 'position'=>8), + 't.progress'=>array('label'=>$langs->trans("ProgressDeclared"), 'checked'=>1, 'position'=>9), + 't.progress_summary'=>array('label'=>$langs->trans("TaskProgressSummary"), 'checked'=>1, 'position'=>10), ); -// Extra fields project -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) +if ($object->usage_bill_time) { + $arrayfields['t.tobill']=array('label'=>$langs->trans("TimeToBill"), 'checked'=>0, 'position'=>11); + $arrayfields['t.billed']=array('label'=>$langs->trans("TimeBilled"), 'checked'=>0, 'position'=>12); +} + +// Extra fields +if (is_array($extrafields->attributes[$taskstatic->table_element]['label']) && count($extrafields->attributes[$taskstatic->table_element]['label']) > 0) { - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) + foreach ($extrafields->attributes[$taskstatic->table_element]['label'] as $key => $val) { - if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) - $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); + if (!empty($extrafields->attributes[$taskstatic->table_element]['list'][$key])) + $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$taskstatic->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$taskstatic->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$taskstatic->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$taskstatic->table_element]['list'][$key]) != 3 && $extrafields->attributes[$taskstatic->table_element]['perms'][$key])); } } -$object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); +$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; /* * Actions @@ -204,7 +207,6 @@ if (!empty($search_progressdeclare)) { $morewherefilterarray[] = natural_search('t.progress', $search_progressdeclare, 1, 1); } - $morewherefilter = ''; if (count($morewherefilterarray) > 0) { $morewherefilter = ' AND '.implode(' AND ', $morewherefilterarray); @@ -332,21 +334,18 @@ $projectstatic = new Project($db); $taskstatic = new Task($db); $userstatic = new User($db); -$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - $title = $langs->trans("Project").' - '.$langs->trans("Tasks").' - '.$object->ref.' '.$object->name; if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->ref.' '.$object->name.' - '.$langs->trans("Tasks"); $help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; llxHeader("", $title, $help_url); + if ($id > 0 || !empty($ref)) { $object->fetch($id, $ref); $object->fetch_thirdparty(); $res = $object->fetch_optionals(); - // To verify role of users //$userAccess = $object->restrictedProjectArea($user,'read'); $userWrite = $object->restrictedProjectArea($user, 'write'); @@ -359,8 +358,25 @@ if ($id > 0 || !empty($ref)) $head = project_prepare_head($object); dol_fiche_head($head, $tab, $langs->trans("Project"), -1, ($object->public ? 'projectpub' : 'project')); - $param = ''; - if ($search_user_id > 0) $param .= '&search_user_id='.dol_escape_htmltag($search_user_id); + $param = 'id='.$object->id; + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); + if ($search_user_id) $param .= '&search_user_id='.urlencode($search_user_id); + if ($search_taskref) $param .= '&search_taskref='.urlencode($search_taskref); + if ($search_tasklabel) $param .= '&search_tasklabel='.urlencode($search_tasklabel); + if ($search_taskdescription) $param .= '&search_taskdescription='.urlencode($search_taskdescription); + if ($search_dtstartday) $param .= '&search_dtstartday='.urlencode($search_dtstartday); + if ($search_dtstartmonth) $param .= '&search_dtstartmonth='.urlencode($search_dtstartmonth); + if ($search_dtstartyear) $param .= '&search_dtstartyear='.urlencode($search_dtstartyear); + if ($search_dtendday) $param .= '&search_dtendday='.urlencode($search_dtendday); + if ($search_dtendmonth) $param .= '&search_dtendmonth='.urlencode($search_dtendmonth); + if ($search_dtendyear) $param .= '&search_dtendyear='.urlencode($search_dtendyear); + if ($search_planedworkload) $param .= '&search_planedworkload='.urlencode($search_planedworkload); + if ($search_timespend) $param .= '&search_timespend='.urlencode($search_timespend); + if ($search_progresscalc) $param .= '&search_progresscalc='.urlencode($search_progresscalc); + if ($search_progressdeclare) $param .= '&search_progressdeclare='.urlencode($search_progressdeclare); + if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); + // Add $param from extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // Project card @@ -425,25 +441,6 @@ if ($id > 0 || !empty($ref)) else print $langs->trans('PrivateProject'); print ''; - /*if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) - { - // Opportunity status - print ''.$langs->trans("OpportunityStatus").''; - $code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code'); - if ($code) print $langs->trans("OppStatus".$code); - print ''; - - // Opportunity percent - print ''.$langs->trans("OpportunityProbability").''; - if (strcmp($object->opp_percent,'')) print price($object->opp_percent,'',$langs,1,0).' %'; - print ''; - - // Opportunity Amount - print ''.$langs->trans("OpportunityAmount").''; - if (strcmp($object->opp_amount,'')) print price($object->opp_amount,'',$langs,1,0,0,$conf->currency); - print ''; - }*/ - // Date start - end print ''.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; $start = dol_print_date($object->date_start, 'day'); @@ -618,27 +615,12 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third } elseif ($id > 0 || !empty($ref)) { + $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + /* * Projet card in view mode */ - // Definition of fields for list - $arrayfields = array(); - $arrayfields['t.task_ref'] = array('label'=>$langs->trans("RefTask"), 'checked'=>1); - $arrayfields['t.task_label'] = array('label'=>$langs->trans("LabelTask"), 'checked'=>1); - $arrayfields['t.task_date_start'] = array('label'=>$langs->trans("DateStart"), 'checked'=>1); - $arrayfields['t.task_date_end'] = array('label'=>$langs->trans("DateEnd"), 'checked'=>1); - // Extra fields - if (is_array($extrafields->attributes[$taskstatic->table_element]['label']) && count($extrafields->attributes[$taskstatic->table_element]['label']) > 0) - { - foreach ($extrafields->attributes[$taskstatic->table_element]['label'] as $key => $val) - { - if (!empty($extrafields->attributes[$taskstatic->table_element]['list'][$key])) - $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$taskstatic->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$taskstatic->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$taskstatic->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$taskstatic->table_element]['list'][$key]) != 3 && $extrafields->attributes[$taskstatic->table_element]['perms'][$key])); - } - } - $arrayfields = dol_sort_array($arrayfields, 'position'); - print '
'; // Link to create task @@ -654,7 +636,6 @@ elseif ($id > 0 || !empty($ref)) $linktocreatetask = dolGetButtonTitle($langs->trans('AddTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?id='.$object->id.'&action=create'.$param.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id), '', $linktocreatetaskUserRight, $linktocreatetaskParam); - print '
'; if ($optioncss != '') print ''; print ''; @@ -674,7 +655,7 @@ elseif ($id > 0 || !empty($ref)) // Get list of tasks in tasksarray and taskarrayfiltered // We need all tasks (even not limited to a user because a task to user can have a parent that is not affected to him). $filteronthirdpartyid = $socid; - $tasksarray = $taskstatic->getTasksArray(0, 0, $object->id, $filteronthirdpartyid, 0, '', -1, $morewherefilter, 0, 0, array(), 1); + $tasksarray = $taskstatic->getTasksArray(0, 0, $object->id, $filteronthirdpartyid, 0, '', -1, $morewherefilter, 0, 0, $extrafields, 1, $search_array_options); // We load also tasks limited to a particular user $tmpuser = new User($db); if ($search_user_id > 0) $tmpuser->fetch($search_user_id); @@ -704,64 +685,90 @@ elseif ($id > 0 || !empty($ref)) print ''; } - $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; - $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - print '
'; print ''; // Fields title search print ''; - print ''; + if (!empty($arrayfields['t.ref']['checked'])) { + print ''; + } - print ''; + if (!empty($arrayfields['t.label']['checked'])) { + print ''; + } - print ''; + if (!empty($arrayfields['t.description']['checked'])) { + print ''; + } - print ''; + if (!empty($arrayfields['t.dateo']['checked'])) { + print ''; + } - print ''; + if (!empty($arrayfields['t.datee']['checked'])) { + print ''; + } - print ''; + if (!empty($arrayfields['t.planned_workload']['checked'])) { + print ''; + } - print ''; + if (!empty($arrayfields['t.duration_effective']['checked'])) { + print ''; + } - print ''; + if (!empty($arrayfields['t.progress_calculated']['checked'])) { + print ''; + } + + if (!empty($arrayfields['t.progress']['checked'])) { + print ''; + } // progress resume not searchable print ''; if ($object->usage_bill_time) { - print ''; + if (!empty($arrayfields['t.tobill']['checked'])) { + print ''; + } - print ''; + if (!empty($arrayfields['t.billed']['checked'])) { + print ''; + } } - if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) print ''; + if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) print ''; + + $extrafieldsobjectkey=$taskstatic->table_element; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Action column print ''; // print ''; - print_liste_field_titre("RefTask", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, ''); - print_liste_field_titre("LabelTask", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, ''); - print_liste_field_titre("DateStart", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center '); - print_liste_field_titre("DateEnd", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center '); - print_liste_field_titre("PlannedWorkload", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); - print_liste_field_titre("TimeSpent", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); - print_liste_field_titre("ProgressCalculated", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); - print_liste_field_titre("ProgressDeclared", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); - print_liste_field_titre("TaskProgressSummary", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['t.ref']['checked'])) print_liste_field_titre($arrayfields['t.ref']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, ''); + if (!empty($arrayfields['t.label']['checked'])) print_liste_field_titre($arrayfields['t.label']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, ''); + if (!empty($arrayfields['t.description']['checked'])) print_liste_field_titre($arrayfields['t.description']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, ''); + if (!empty($arrayfields['t.dateo']['checked'])) print_liste_field_titre($arrayfields['t.dateo']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['t.datee']['checked'])) print_liste_field_titre($arrayfields['t.datee']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['t.planned_workload']['checked'])) print_liste_field_titre($arrayfields['t.planned_workload']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right '); + if (!empty($arrayfields['t.duration_effective']['checked'])) print_liste_field_titre($arrayfields['t.duration_effective']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right '); + if (!empty($arrayfields['t.progress_calculated']['checked'])) print_liste_field_titre($arrayfields['t.progress_calculated']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right '); + if (!empty($arrayfields['t.progress']['checked'])) print_liste_field_titre($arrayfields['t.progress']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right '); + if (!empty($arrayfields['t.progress_summary']['checked'])) print_liste_field_titre($arrayfields['t.progress_summary']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center '); if ($object->usage_bill_time) { - print_liste_field_titre("TimeToBill", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); - print_liste_field_titre("TimeBilled", $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'right '); + if (!empty($arrayfields['t.tobill']['checked'])) print_liste_field_titre($arrayfields['t.tobill']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right '); + if (!empty($arrayfields['t.billed']['checked'])) print_liste_field_titre($arrayfields['t.billed']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right '); } - if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) print_liste_field_titre("TaskRessourceLinks", $_SERVER["PHP_SELF"], '', '', '', $sortfield, $sortorder); - print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', 'width="80"', $sortfield, $sortorder, 'center maxwidthsearch '); + if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) print_liste_field_titre("TaskRessourceLinks", $_SERVER["PHP_SELF"], '', '', $param, $sortfield, $sortorder); + // Extra fields + $disablesortlink=1; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; + // Hook fields + $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); + $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; if (count($tasksarray) > 0) { // Show all lines in taskarray (recursive function to go down on tree) $j = 0; $level = 0; - $nboftaskshown = projectLinesa($j, 0, $tasksarray, $level, true, 0, $tasksrole, $object->id, 1, $object->id, $filterprogresscalc, ($object->usage_bill_time ? 1 : 0)); + $nboftaskshown = projectLinesa($j, 0, $tasksarray, $level, true, 0, $tasksrole, $object->id, 1, $object->id, $filterprogresscalc, ($object->usage_bill_time ? 1 : 0), $arrayfields); } else { diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 09135733e9e..f55bcb36e9b 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -56,6 +56,7 @@ $search_project_title = GETPOST('search_project_title'); $search_task_ref = GETPOST('search_task_ref'); $search_task_label = GETPOST('search_task_label'); $search_task_description = GETPOST('search_task_description'); +$search_task_ref_parent = GETPOST('search_task_ref_parent'); $search_project_user = GETPOST('search_project_user'); $search_task_user = GETPOST('search_task_user'); @@ -109,8 +110,10 @@ $fieldstosearchall = array( if (empty($user->socid)) $fieldstosearchall['t.note_private'] = "NotePrivate"; $arrayfields = array( + 't.fk_task_parent'=>array('label'=>$langs->trans("RefTaskParent"), 'checked'=>0, 'position'=>70), 't.ref'=>array('label'=>$langs->trans("RefTask"), 'checked'=>1, 'position'=>80), 't.label'=>array('label'=>$langs->trans("LabelTask"), 'checked'=>1, 'position'=>80), + 't.description'=>array('label'=>$langs->trans("Description"), 'checked'=>0, 'position'=>80), 't.dateo'=>array('label'=>$langs->trans("DateStart"), 'checked'=>1, 'position'=>100), 't.datee'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1, 'position'=>101), 'p.ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>1), @@ -169,6 +172,7 @@ if (empty($reshook)) $search_task_ref = ""; $search_task_label = ""; $search_task_description = ""; + $search_task_ref_parent = ""; $search_task_user = -1; $search_project_user = -1; $search_sday = ''; @@ -262,7 +266,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.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.fk_statut, "; +$sql .= " t.description, t.fk_task_parent"; // We'll need these fields in order to filter by categ if ($search_categ) $sql .= ", cs.fk_categorie, cs.fk_project"; // Add sum fields @@ -302,6 +307,8 @@ if ($search_project_ref) $sql .= natural_search('p.ref', $search_project_ref); if ($search_project_title) $sql .= natural_search('p.title', $search_project_title); if ($search_task_ref) $sql .= natural_search('t.ref', $search_task_ref); if ($search_task_label) $sql .= natural_search('t.label', $search_task_label); +if ($search_task_description) $sql .= natural_search('t.description', $search_task_description); +if ($search_task_ref_parent) $sql .= ' AND t.fk_task_parent IN (SELECT ipt.rowid FROM '.MAIN_DB_PREFIX.'projet_task as ipt WHERE '.natural_search('ipt.ref', $search_task_ref_parent, 0, 1).')'; if ($search_societe) $sql .= natural_search('s.nom', $search_societe); $sql .= dolSqlDateFilter('t.dateo', $search_sday, $search_smonth, $search_syear); $sql .= dolSqlDateFilter('t.datee', $search_eday, $search_emonth, $search_eyear); @@ -385,8 +392,10 @@ if ($socid) $param .= '&socid='.urlencode($socid); if ($search_all != '') $param .= '&search_all='.urlencode($search_all); if ($search_project_ref != '') $param .= '&search_project_ref='.urlencode($search_project_ref); if ($search_project_title != '') $param .= '&search_project_title='.urlencode($search_project_title); -if ($search_ref != '') $param .= '&search_ref='.urlencode($search_ref); -if ($search_label != '') $param .= '&search_label='.urlencode($search_label); +if ($search_task_ref != '') $param .= '&search_task_ref='.urlencode($search_ref); +if ($search_task_label != '') $param .= '&search_task_label='.urlencode($search_label); +if ($search_task_description != '') $param .= '&search_task_description='.urlencode($search_description); +if ($search_task_ref_parent != '') $param .= '&search_task_ref_parent='.urlencode($search_task_ref_parent); if ($search_societe != '') $param .= '&search_societe='.urlencode($search_societe); if ($search_projectstatus != '') $param .= '&search_projectstatus='.urlencode($search_projectstatus); if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array('all', 'none'))) $param .= '&search_opp_status='.urlencode($search_opp_status); @@ -491,6 +500,12 @@ print '
'; print '
'; - print ''; - print ''; + print ''; + print ''; - print ''; - print ''; + print ''; + print ''; - print ''; - print ''; - $formother->select_year($search_dtstartyear ? $search_dtstartyear : -1, 'search_dtstartyear', 1, 20, 5); - print ''; + print ''; + print ''; - print ''; - print ''; - $formother->select_year($search_dtendyear ? $search_dtendyear : -1, 'search_dtendyear', 1, 20, 5); - print ''; + print ''; + print ''; + $formother->select_year($search_dtstartyear ? $search_dtstartyear : -1, 'search_dtstartyear', 1, 20, 5); + print ''; - print ''; - print ''; + print ''; + print ''; + $formother->select_year($search_dtendyear ? $search_dtendyear : -1, 'search_dtendyear', 1, 20, 5); + print ''; - print ''; - print ''; + print ''; + print ''; - print ''; - print ''; + print ''; + print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; - print ''; + print ''; - print ''; + print ''; @@ -772,29 +779,37 @@ elseif ($id > 0 || !empty($ref)) print '
'.$langs->trans("Project").'
'."\n"; print ''; +if (!empty($arrayfields['t.fk_task_parent']['checked'])) +{ + print ''; +} if (!empty($arrayfields['t.ref']['checked'])) { print ''; } +//Task Description +if (!empty($arrayfields['t.description']['checked'])) +{ + print ''; +} // Start date if (!empty($arrayfields['t.dateo']['checked'])) { @@ -581,17 +603,19 @@ print ''; print "\n"; print ''; +if (!empty($arrayfields['t.fk_task_parent']['checked'])) print_liste_field_titre($arrayfields['t.fk_task_parent']['label'], $_SERVER["PHP_SELF"], "t.fk_task_parent", "", $param, "", $sortfield, $sortorder); if (!empty($arrayfields['t.ref']['checked'])) print_liste_field_titre($arrayfields['t.ref']['label'], $_SERVER["PHP_SELF"], "t.ref", "", $param, "", $sortfield, $sortorder); if (!empty($arrayfields['t.label']['checked'])) print_liste_field_titre($arrayfields['t.label']['label'], $_SERVER["PHP_SELF"], "t.label", "", $param, "", $sortfield, $sortorder); -if (!empty($arrayfields['t.dateo']['checked'])) print_liste_field_titre($arrayfields['t.dateo']['label'], $_SERVER["PHP_SELF"], "t.dateo", "", $param, '', $sortfield, $sortorder, 'center '); +if (!empty($arrayfields['t.description']['checked'])) print_liste_field_titre($arrayfields['t.description']['label'], $_SERVER["PHP_SELF"], "t.description", "", $param, "", $sortfield, $sortorder); +if (!empty($arrayfields['t.dateo']['checked'])) print_liste_field_titre($arrayfields['t.dateo']['label'], $_SERVER["PHP_SELF"], "t.dateo", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['t.datee']['checked'])) print_liste_field_titre($arrayfields['t.datee']['label'], $_SERVER["PHP_SELF"], "t.datee", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], "p.ref", "", $param, "", $sortfield, $sortorder); if (!empty($arrayfields['p.title']['checked'])) print_liste_field_titre($arrayfields['p.title']['label'], $_SERVER["PHP_SELF"], "p.title", "", $param, "", $sortfield, $sortorder); if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder); if (!empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, '', $sortfield, $sortorder, 'center '); -if (!empty($arrayfields['t.planned_workload']['checked'])) print_liste_field_titre($arrayfields['t.planned_workload']['label'], $_SERVER["PHP_SELF"], "t.planned_workload", "", $param, '', $sortfield, $sortorder, 'center '); -if (!empty($arrayfields['t.duration_effective']['checked'])) print_liste_field_titre($arrayfields['t.duration_effective']['label'], $_SERVER["PHP_SELF"], "t.duration_effective", "", $param, '', $sortfield, $sortorder, 'center '); -if (!empty($arrayfields['t.progress_calculated']['checked'])) print_liste_field_titre($arrayfields['t.progress_calculated']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'center '); +if (!empty($arrayfields['t.planned_workload']['checked'])) print_liste_field_titre($arrayfields['t.planned_workload']['label'], $_SERVER["PHP_SELF"], "t.planned_workload", "", $param, '', $sortfield, $sortorder, 'center '); +if (!empty($arrayfields['t.duration_effective']['checked'])) print_liste_field_titre($arrayfields['t.duration_effective']['label'], $_SERVER["PHP_SELF"], "t.duration_effective", "", $param, '', $sortfield, $sortorder, 'center '); +if (!empty($arrayfields['t.progress_calculated']['checked'])) print_liste_field_titre($arrayfields['t.progress_calculated']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'center '); if (!empty($arrayfields['t.progress']['checked'])) print_liste_field_titre($arrayfields['t.progress']['label'], $_SERVER["PHP_SELF"], "t.progress", "", $param, '', $sortfield, $sortorder, 'center '); 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 '); if (!empty($arrayfields['t.tobill']['checked'])) print_liste_field_titre($arrayfields['t.tobill']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'center '); @@ -622,12 +646,14 @@ while ($i < min($num, $limit)) $object->id = $obj->id; $object->ref = $obj->ref; $object->label = $obj->label; + $object->description = $obj->description; $object->fk_statut = $obj->fk_statut; $object->progress = $obj->progress; $object->datee = $db->jdate($obj->date_end); // deprecated $object->date_end = $db->jdate($obj->date_end); $object->planned_workload = $obj->planned_workload; $object->duration_effective = $obj->duration_effective; + $object->fk_task_parent = $obj->fk_task_parent; $projectstatic->id = $obj->projectid; @@ -642,6 +668,23 @@ while ($i < min($num, $limit)) { print ''; + // Ref Parent + if (!empty($arrayfields['t.fk_task_parent']['checked'])) { + print ''; + if (!$i) $totalarray['nbfield']++; + } // Ref if (!empty($arrayfields['t.ref']['checked'])) { @@ -659,6 +702,14 @@ while ($i < min($num, $limit)) print ''; if (!$i) $totalarray['nbfield']++; } + // Description + if (!empty($arrayfields['t.description']['checked'])) + { + print ''; + if (!$i) $totalarray['nbfield']++; + } // Date start if (!empty($arrayfields['t.dateo']['checked'])) { @@ -874,13 +925,11 @@ while ($i < min($num, $limit)) print "\n"; - //print projectLinesa(); } $i++; } // Show total line -//include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['totalplannedworkloadfield']) || isset($totalarray['totalprogress_calculatedfield']) || isset($totalarray['totaltobill']) || isset($totalarray['totalbilled'])) {
'; + print ''; + print ''; @@ -503,6 +518,13 @@ if (!empty($arrayfields['t.label']['checked'])) print ''; print ''; + print ''; + print '
'; + if (!empty($object->fk_task_parent)) { + $object_parent = new Task($db); + $result = $object_parent->fetch($object->fk_task_parent); + if ($result < 0) { + setEventMessage($object_parent->error, 'errors'); + } else { + print $object_parent->getNomUrl(1, 'withproject'); + if ($object_parent->hasDelay()) + print img_warning("Late"); + } + } + print ''; + print $object->description; + print '