'."\n";
+// Fields title search
+// --------------------------------------------------------------------
print '';
if (!empty($arrayfields['t.fk_task_parent']['checked'])) {
print '| ';
@@ -792,7 +813,7 @@ if (!empty($arrayfields['t.billed']['checked'])) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields);
-$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
+$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (!empty($arrayfields['t.datec']['checked'])) {
// Date creation
@@ -809,63 +830,8 @@ print ' | ';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print ' | ';
-print "
\n";
+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.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.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.budget_amount']['checked'])) {
- print_liste_field_titre($arrayfields['t.budget_amount']['label'], $_SERVER["PHP_SELF"], "t.budget_amount", "", $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 ');
-}
-if (!empty($arrayfields['t.billed']['checked'])) {
- print_liste_field_titre($arrayfields['t.billed']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'center ');
-}
$totalarray = array(
'nbfield' => 0,
'val' => array(
@@ -884,6 +850,82 @@ $totalarray = array(
'totaltobill' => 0,
'totalbilled' => 0,
);
+
+// Fields title label
+// --------------------------------------------------------------------
+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);
+ $totalarray['nbfield']++;
+}
+if (!empty($arrayfields['t.ref']['checked'])) {
+ print_liste_field_titre($arrayfields['t.ref']['label'], $_SERVER["PHP_SELF"], "t.ref", "", $param, "", $sortfield, $sortorder);
+ $totalarray['nbfield']++;
+}
+if (!empty($arrayfields['t.label']['checked'])) {
+ print_liste_field_titre($arrayfields['t.label']['label'], $_SERVER["PHP_SELF"], "t.label", "", $param, "", $sortfield, $sortorder);
+ $totalarray['nbfield']++;
+}
+if (!empty($arrayfields['t.description']['checked'])) {
+ print_liste_field_titre($arrayfields['t.description']['label'], $_SERVER["PHP_SELF"], "t.description", "", $param, "", $sortfield, $sortorder);
+ $totalarray['nbfield']++;
+}
+if (!empty($arrayfields['t.dateo']['checked'])) {
+ print_liste_field_titre($arrayfields['t.dateo']['label'], $_SERVER["PHP_SELF"], "t.dateo", "", $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
+}
+if (!empty($arrayfields['t.datee']['checked'])) {
+ print_liste_field_titre($arrayfields['t.datee']['label'], $_SERVER["PHP_SELF"], "t.datee", "", $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
+}
+if (!empty($arrayfields['p.ref']['checked'])) {
+ print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], "p.ref", "", $param, "", $sortfield, $sortorder);
+ $totalarray['nbfield']++;
+}
+if (!empty($arrayfields['p.title']['checked'])) {
+ print_liste_field_titre($arrayfields['p.title']['label'], $_SERVER["PHP_SELF"], "p.title", "", $param, "", $sortfield, $sortorder);
+ $totalarray['nbfield']++;
+}
+if (!empty($arrayfields['s.nom']['checked'])) {
+ print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder);
+ $totalarray['nbfield']++;
+}
+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 ');
+ $totalarray['nbfield']++;
+}
+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 ');
+ $totalarray['nbfield']++;
+}
+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 ');
+ $totalarray['nbfield']++;
+}
+if (!empty($arrayfields['t.progress_calculated']['checked'])) {
+ print_liste_field_titre($arrayfields['t.progress_calculated']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', '', '', 'center ');
+ $totalarray['nbfield']++;
+}
+if (!empty($arrayfields['t.progress']['checked'])) {
+ print_liste_field_titre($arrayfields['t.progress']['label'], $_SERVER["PHP_SELF"], "t.progress", "", $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
+}
+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.budget_amount']['checked'])) {
+ print_liste_field_titre($arrayfields['t.budget_amount']['label'], $_SERVER["PHP_SELF"], "t.budget_amount", "", $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
+}
+if (!empty($arrayfields['t.tobill']['checked'])) {
+ print_liste_field_titre($arrayfields['t.tobill']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
+}
+if (!empty($arrayfields['t.billed']['checked'])) {
+ print_liste_field_titre($arrayfields['t.billed']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
+}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
@@ -898,13 +940,15 @@ $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // No
print $hookmanager->resPrint;
if (!empty($arrayfields['t.datec']['checked'])) {
print_liste_field_titre($arrayfields['t.datec']['label'], $_SERVER["PHP_SELF"], "t.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['t.tms']['checked'])) {
print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER["PHP_SELF"], "t.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
+ $totalarray['nbfield']++;
}
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
-print "
\n";
-
+$totalarray['nbfield']++;
+print ''."\n";
$plannedworkloadoutputformat = 'allhourmin';
$timespentoutputformat = 'allhourmin';
@@ -915,10 +959,19 @@ if (!empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) {
$timespentoutputformat = $conf->global->PROJECT_TIME_SPENT_FORMAT;
}
+// Loop on record
+// --------------------------------------------------------------------
$i = 0;
-while ($i < min($num, $limit)) {
+$savnbfield = $totalarray['nbfield'];
+$totalarray['nbfield'] = 0;
+$imaxinloop = ($limit ? min($num, $limit) : $num);
+while ($i < $imaxinloop) {
$obj = $db->fetch_object($resql);
+ if (empty($obj)) {
+ break; // Should not happen
+ }
+ // Store properties in $object
$object->id = $obj->id;
$object->ref = $obj->ref;
$object->label = $obj->label;
@@ -932,7 +985,6 @@ while ($i < min($num, $limit)) {
$object->duration_effective = $obj->duration_effective;
$object->fk_task_parent = $obj->fk_task_parent;
-
$projectstatic->id = $obj->projectid;
$projectstatic->ref = $obj->projectref;
$projectstatic->title = $obj->projecttitle;
@@ -940,341 +992,355 @@ while ($i < min($num, $limit)) {
$projectstatic->statut = $obj->projectstatus;
$projectstatic->datee = $db->jdate($obj->projectdatee);
- $userAccess = $projectstatic->restrictedProjectArea($user); // why this ?
- if ($userAccess >= 0) {
- print '';
+ if ($mode == 'kanban') {
+ if ($i == 0) {
+ print '
| ';
+ print ' ';
+ }
+ // Output Kanban
+ print $object->getKanbanView('');
+ if ($i == ($imaxinloop - 1)) {
+ print ' ';
+ print ' |
';
+ }
+ } else {
+ $userAccess = $projectstatic->restrictedProjectArea($user); // why this ?
+ if ($userAccess >= 0) {
+ print '';
- // Ref Parent
- if (!empty($arrayfields['t.fk_task_parent']['checked'])) {
- 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");
+ // Ref Parent
+ if (!empty($arrayfields['t.fk_task_parent']['checked'])) {
+ 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 ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Ref
- if (!empty($arrayfields['t.ref']['checked'])) {
- print '';
- print $object->getNomUrl(1, 'withproject');
- if ($object->hasDelay()) {
- print img_warning("Late");
- }
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Label
- if (!empty($arrayfields['t.label']['checked'])) {
- print '';
- print dol_escape_htmltag($object->label);
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Description
- if (!empty($arrayfields['t.description']['checked'])) {
- print '';
- print dol_escape_htmltag($object->description);
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Date start
- if (!empty($arrayfields['t.dateo']['checked'])) {
- print '';
- print dol_print_date($db->jdate($obj->date_start), 'day');
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Date end
- if (!empty($arrayfields['t.datee']['checked'])) {
- print '';
- print dol_print_date($db->jdate($obj->date_end), 'day');
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Project ref
- if (!empty($arrayfields['p.ref']['checked'])) {
- print '';
- print $projectstatic->getNomUrl(1, 'task');
- if ($projectstatic->hasDelay()) {
- print img_warning("Late");
- }
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Project title
- if (!empty($arrayfields['p.title']['checked'])) {
- print '';
- print dol_trunc($obj->projecttitle, 80);
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Third party
- if (!empty($arrayfields['s.nom']['checked'])) {
- print '';
- if ($obj->socid) {
- $socstatic->id = $obj->socid;
- $socstatic->name = $obj->name;
- print $socstatic->getNomUrl(1);
- } else {
- print ' ';
- }
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Project status
- if (!empty($arrayfields['p.fk_statut']['checked'])) {
- print '';
- print $projectstatic->getLibStatut(1);
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
-
- // Planned workload
- if (!empty($arrayfields['t.planned_workload']['checked'])) {
- print '';
- $fullhour = convertSecondToTime($obj->planned_workload, $plannedworkloadoutputformat);
- $workingdelay = convertSecondToTime($obj->planned_workload, 'all', 86400, 7); // TODO Replace 86400 and 7 to take account working hours per day and working day per weeks
- if ($obj->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 ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- if (!$i) {
- $totalarray['pos'][$totalarray['nbfield']] = 't.planned_workload';
- }
- $totalarray['val']['t.planned_workload'] += $obj->planned_workload;
- if (!$i) {
- $totalarray['totalplannedworkloadfield'] = $totalarray['nbfield'];
- }
- $totalarray['totalplannedworkload'] += $obj->planned_workload;
- }
- // Time spent
- if (!empty($arrayfields['t.duration_effective']['checked'])) {
- $showlineingray = 0; $showproject = 1;
- print '';
- if ($showlineingray) {
- print '';
- } else {
- print '';
- }
- if ($obj->duration_effective) {
- print convertSecondToTime($obj->duration_effective, $timespentoutputformat);
- } else {
- print '--:--';
- }
- if ($showlineingray) {
- print '';
- } else {
- print '';
- }
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- if (!$i) {
- $totalarray['pos'][$totalarray['nbfield']] = 't.duration_effective';
- }
- $totalarray['val']['t.duration_effective'] += $obj->duration_effective;
- if (!$i) {
- $totalarray['totaldurationeffectivefield'] = $totalarray['nbfield'];
- }
- $totalarray['totaldurationeffective'] += $obj->duration_effective;
- }
- // Calculated progress
- if (!empty($arrayfields['t.progress_calculated']['checked'])) {
- print '';
- if ($obj->planned_workload || $obj->duration_effective) {
- if ($obj->planned_workload) {
- print round(100 * $obj->duration_effective / $obj->planned_workload, 2).' %';
- } else {
- print $form->textwithpicto('', $langs->trans('WorkloadNotDefined'), 1, 'help');
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
}
}
- print '';
- if (!$i) {
- $totalarray['nbfield']++;
+ // Ref
+ if (!empty($arrayfields['t.ref']['checked'])) {
+ print '';
+ print $object->getNomUrl(1, 'withproject');
+ if ($object->hasDelay()) {
+ print img_warning("Late");
+ }
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- if (!$i) {
- $totalarray['totalprogress_calculatedfield'] = $totalarray['nbfield'];
+ // Label
+ if (!empty($arrayfields['t.label']['checked'])) {
+ print '';
+ print dol_escape_htmltag($object->label);
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Declared progress
- if (!empty($arrayfields['t.progress']['checked'])) {
- print '';
- if ($obj->progress != '') {
- print getTaskProgressBadge($object);
+ // Description
+ if (!empty($arrayfields['t.description']['checked'])) {
+ print ' | ';
+ print dol_escape_htmltag($object->description);
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- print '';
- if (!$i) {
- $totalarray['nbfield']++;
+ // Date start
+ if (!empty($arrayfields['t.dateo']['checked'])) {
+ print '';
+ print dol_print_date($db->jdate($obj->date_start), 'day');
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- if (!$i) {
- $totalarray['pos'][$totalarray['nbfield']] = 't.progress';
+ // Date end
+ if (!empty($arrayfields['t.datee']['checked'])) {
+ print '';
+ print dol_print_date($db->jdate($obj->date_end), 'day');
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- $totalarray['val']['t.progress'] += ($obj->planned_workload * $obj->progress / 100);
- if (!$i) {
- $totalarray['totalprogress_declaredfield'] = $totalarray['nbfield'];
+ // Project ref
+ if (!empty($arrayfields['p.ref']['checked'])) {
+ print '';
+ print $projectstatic->getNomUrl(1, 'task');
+ if ($projectstatic->hasDelay()) {
+ print img_warning("Late");
+ }
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- $totalarray['totaldurationdeclared'] += $obj->planned_workload * $obj->progress / 100;
- }
- // Progress summary
- if (!empty($arrayfields['t.progress_summary']['checked'])) {
- print '';
- if ($obj->progress != '' && $obj->duration_effective) {
- print getTaskProgressView($object, false, false);
+ // Project title
+ if (!empty($arrayfields['p.title']['checked'])) {
+ print ' | ';
+ print dol_trunc($obj->projecttitle, 80);
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- print '';
- if (!$i) {
- $totalarray['nbfield']++;
+ // Third party
+ if (!empty($arrayfields['s.nom']['checked'])) {
+ print '';
+ if ($obj->socid) {
+ $socstatic->id = $obj->socid;
+ $socstatic->name = $obj->name;
+ print $socstatic->getNomUrl(1);
+ } else {
+ print ' ';
+ }
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- if (!$i) {
- $totalarray['totalprogress_summary'] = $totalarray['nbfield'];
+ // Project status
+ if (!empty($arrayfields['p.fk_statut']['checked'])) {
+ print '';
+ print $projectstatic->getLibStatut(1);
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- if (!empty($arrayfields['t.budget_amount']['checked'])) {
- print '';
- print price($object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency);
- if (!$i) {
- $totalarray['nbfield']++;
- }
- if (!$i) {
- $totalarray['pos'][$totalarray['nbfield']] = 't.budget_amount';
- }
- $totalarray['val']['t.budget_amount'] += $obj->budget_amount;
- if (!$i) {
- $totalarray['totalbudget_amountfield'] = $totalarray['nbfield'];
- }
- $totalarray['totalbudgetamount'] += $obj->budget_amount;
- print ' | ';
- }
- // Time not billed
- if (!empty($arrayfields['t.tobill']['checked'])) {
- print '';
- if ($obj->usage_bill_time) {
- print convertSecondToTime($obj->tobill, 'allhourmin');
- $totalarray['val']['t.tobill'] += $obj->tobill;
- $totalarray['totaltobill'] += $obj->tobill;
- } else {
- print ''.$langs->trans("NA").'';
- }
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- if (!$i) {
- $totalarray['pos'][$totalarray['nbfield']] = 't.tobill';
- }
- if (!$i) {
- $totalarray['totaltobillfield'] = $totalarray['nbfield'];
- }
- }
- // Time billed
- if (!empty($arrayfields['t.billed']['checked'])) {
- print '';
- if ($obj->usage_bill_time) {
- print convertSecondToTime($obj->billed, 'allhourmin');
- $totalarray['val']['t.billed'] += $obj->billed;
- $totalarray['totalbilled'] += $obj->billed;
- } else {
- print ''.$langs->trans("NA").'';
- }
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- if (!$i) {
- $totalarray['pos'][$totalarray['nbfield']] = 't.billed';
- }
- if (!$i) {
- $totalarray['totalbilledfield'] = $totalarray['nbfield'];
- }
- }
- // Extra fields
- include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
- // Fields from hook
- $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
- $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
- print $hookmanager->resPrint;
- // Date creation
- if (!empty($arrayfields['t.datec']['checked'])) {
- print '';
- print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Date modification
- if (!empty($arrayfields['t.tms']['checked'])) {
- print '';
- print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Status
- /*if (! empty($arrayfields['p.fk_statut']['checked']))
- {
- $projectstatic->statut = $obj->fk_statut;
- print ''.$projectstatic->getLibStatut(5).' | ';
- }*/
- // Action column
- print '';
- if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
- $selected = 0;
- if (in_array($obj->id, $arrayofselected)) {
- $selected = 1;
- }
- print '';
- }
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- print "
\n";
+ // Planned workload
+ if (!empty($arrayfields['t.planned_workload']['checked'])) {
+ print '';
+ $fullhour = convertSecondToTime($obj->planned_workload, $plannedworkloadoutputformat);
+ $workingdelay = convertSecondToTime($obj->planned_workload, 'all', 86400, 7); // TODO Replace 86400 and 7 to take account working hours per day and working day per weeks
+ if ($obj->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 ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 't.planned_workload';
+ }
+ $totalarray['val']['t.planned_workload'] += $obj->planned_workload;
+ if (!$i) {
+ $totalarray['totalplannedworkloadfield'] = $totalarray['nbfield'];
+ }
+ $totalarray['totalplannedworkload'] += $obj->planned_workload;
+ }
+ // Time spent
+ if (!empty($arrayfields['t.duration_effective']['checked'])) {
+ $showlineingray = 0; $showproject = 1;
+ print '';
+ if ($showlineingray) {
+ print '';
+ } else {
+ print '';
+ }
+ if ($obj->duration_effective) {
+ print convertSecondToTime($obj->duration_effective, $timespentoutputformat);
+ } else {
+ print '--:--';
+ }
+ if ($showlineingray) {
+ print '';
+ } else {
+ print '';
+ }
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 't.duration_effective';
+ }
+ $totalarray['val']['t.duration_effective'] += $obj->duration_effective;
+ if (!$i) {
+ $totalarray['totaldurationeffectivefield'] = $totalarray['nbfield'];
+ }
+ $totalarray['totaldurationeffective'] += $obj->duration_effective;
+ }
+ // Calculated progress
+ if (!empty($arrayfields['t.progress_calculated']['checked'])) {
+ print '';
+ if ($obj->planned_workload || $obj->duration_effective) {
+ if ($obj->planned_workload) {
+ print round(100 * $obj->duration_effective / $obj->planned_workload, 2).' %';
+ } else {
+ print $form->textwithpicto('', $langs->trans('WorkloadNotDefined'), 1, 'help');
+ }
+ }
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['totalprogress_calculatedfield'] = $totalarray['nbfield'];
+ }
+ }
+ // Declared progress
+ if (!empty($arrayfields['t.progress']['checked'])) {
+ print '';
+ if ($obj->progress != '') {
+ print getTaskProgressBadge($object);
+ }
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 't.progress';
+ }
+ $totalarray['val']['t.progress'] += ($obj->planned_workload * $obj->progress / 100);
+ if (!$i) {
+ $totalarray['totalprogress_declaredfield'] = $totalarray['nbfield'];
+ }
+ $totalarray['totaldurationdeclared'] += $obj->planned_workload * $obj->progress / 100;
+ }
+ // Progress summary
+ if (!empty($arrayfields['t.progress_summary']['checked'])) {
+ print '';
+ if ($obj->progress != '' && $obj->duration_effective) {
+ print getTaskProgressView($object, false, false);
+ }
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['totalprogress_summary'] = $totalarray['nbfield'];
+ }
+ }
+ if (!empty($arrayfields['t.budget_amount']['checked'])) {
+ print '';
+ print price($object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency);
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 't.budget_amount';
+ }
+ $totalarray['val']['t.budget_amount'] += $obj->budget_amount;
+ if (!$i) {
+ $totalarray['totalbudget_amountfield'] = $totalarray['nbfield'];
+ }
+ $totalarray['totalbudgetamount'] += $obj->budget_amount;
+ }
+ // Time not billed
+ if (!empty($arrayfields['t.tobill']['checked'])) {
+ print '';
+ if ($obj->usage_bill_time) {
+ print convertSecondToTime($obj->tobill, 'allhourmin');
+ $totalarray['val']['t.tobill'] += $obj->tobill;
+ $totalarray['totaltobill'] += $obj->tobill;
+ } else {
+ print ''.$langs->trans("NA").'';
+ }
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 't.tobill';
+ }
+ if (!$i) {
+ $totalarray['totaltobillfield'] = $totalarray['nbfield'];
+ }
+ }
+ // Time billed
+ if (!empty($arrayfields['t.billed']['checked'])) {
+ print '';
+ if ($obj->usage_bill_time) {
+ print convertSecondToTime($obj->billed, 'allhourmin');
+ $totalarray['val']['t.billed'] += $obj->billed;
+ $totalarray['totalbilled'] += $obj->billed;
+ } else {
+ print ''.$langs->trans("NA").'';
+ }
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 't.billed';
+ }
+ if (!$i) {
+ $totalarray['totalbilledfield'] = $totalarray['nbfield'];
+ }
+ }
+ // Extra fields
+ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
+ // Fields from hook
+ $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
+ $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
+ print $hookmanager->resPrint;
+ // Date creation
+ if (!empty($arrayfields['t.datec']['checked'])) {
+ print '';
+ print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Date modification
+ if (!empty($arrayfields['t.tms']['checked'])) {
+ print '';
+ print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Status
+ /*if (! empty($arrayfields['p.fk_statut']['checked']))
+ {
+ $projectstatic->statut = $obj->fk_statut;
+ print ''.$projectstatic->getLibStatut(5).' | ';
+ }*/
+ // Action column
+ print '';
+ if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
+ $selected = 0;
+ if (in_array($object->id, $arrayofselected)) {
+ $selected = 1;
+ }
+ print '';
+ }
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+
+ print ''."\n";
+ }
}
$i++;
}
+
// Show total line
if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['totalplannedworkloadfield']) || isset($totalarray['totalprogress_calculatedfield'])
- || isset($totalarray['totaltobill']) || isset($totalarray['totalbilled'])) {
+ || isset($totalarray['totaltobill']) || isset($totalarray['totalbilled']) || isset($totalarray['totalbudget'])) {
print '';
$i = 0;
while ($i < $totalarray['nbfield']) {
@@ -1308,14 +1374,14 @@ if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['tota
$db->free($resql);
-$parameters = array('sql' => $sql);
+$parameters = array('arrayfields'=>$arrayfields, 'sql' => $sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
-print "