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 '
| '.$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 ' |