28 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
40 global $db, $langs, $conf, $user;
45 $head[$h][0] = DOL_URL_ROOT.
'/projet/card.php?id='.((int) $project->id).($moreparam ?
'&'.$moreparam :
'');
46 $head[$h][1] = $langs->trans(
"Project");
47 $head[$h][2] =
'project';
51 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
52 $cachekey =
'count_contacts_project_'.$project->id;
55 if (!is_null($dataretrieved)) {
56 $nbContacts = $dataretrieved;
58 $nbContacts = count($project->liste_contact(-1,
'internal')) + count($project->liste_contact(-1,
'external'));
61 $head[$h][0] = DOL_URL_ROOT.
'/projet/contact.php?id='.((int) $project->id).($moreparam ?
'&'.$moreparam :
'');
62 $head[$h][1] = $langs->trans(
"ProjectContact");
63 if ($nbContacts > 0) {
64 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContacts.
'</span>';
66 $head[$h][2] =
'contact';
69 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
73 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
74 $cachekey =
'count_tasks_project_'.$project->id;
77 if (!is_null($dataretrieved)) {
78 $nbTasks = $dataretrieved;
80 require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
81 $taskstatic =
new Task($db);
82 $nbTasks = count($taskstatic->getTasksArray(0, 0, $project->id, 0, 0));
85 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks.php?id='.((int) $project->id).($moreparam ?
'&'.$moreparam :
'');
86 $head[$h][1] = $langs->trans(
"Tasks");
88 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbTasks).
'</span>';
90 $head[$h][2] =
'tasks';
95 $cachekey =
'count_timespent_project_'.$project->id;
97 if (!is_null($dataretrieved)) {
98 $nbTimeSpent = $dataretrieved;
100 $sql =
"SELECT t.rowid";
103 $sql .=
" FROM ".MAIN_DB_PREFIX.
"projet_task_time as t, ".MAIN_DB_PREFIX.
"projet_task as pt";
104 $sql .=
" WHERE t.fk_task = pt.rowid";
105 $sql .=
" AND pt.fk_projet =".((int) $project->id);
106 $resql = $db->query($sql);
108 $obj = $db->fetch_object(
$resql);
118 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/time.php?withproject=1&projectid='.((int) $project->id).($moreparam ?
'&'.$moreparam :
'');
119 $head[$h][1] = $langs->trans(
"TimeSpent");
120 if ($nbTimeSpent > 0) {
121 $head[$h][1] .=
'<span class="badge marginleftonlyshort">...</span>';
123 $head[$h][2] =
'timespent';
133 $cachekey =
'count_elements_project_'.$project->id;
135 if (!is_null($dataretrieved)) {
136 $nbElements = $dataretrieved;
139 $nbElements += $project->getElementCount(
'stock',
'entrepot',
'fk_project');
142 $nbElements += $project->getElementCount(
'propal',
'propal');
145 $nbElements += $project->getElementCount(
'order',
'commande');
148 $nbElements += $project->getElementCount(
'invoice',
'facture');
151 $nbElements += $project->getElementCount(
'invoice_predefined',
'facture_rec');
154 $nbElements += $project->getElementCount(
'proposal_supplier',
'supplier_proposal');
157 $nbElements += $project->getElementCount(
'order_supplier',
'commande_fournisseur');
160 $nbElements += $project->getElementCount(
'invoice_supplier',
'facture_fourn');
163 $nbElements += $project->getElementCount(
'contract',
'contrat');
166 $nbElements += $project->getElementCount(
'intervention',
'fichinter');
169 $nbElements += $project->getElementCount(
'shipping',
'expedition');
172 $nbElements += $project->getElementCount(
'mrp',
'mrp_mo',
'fk_project');
175 $nbElements += $project->getElementCount(
'trip',
'deplacement');
178 $nbElements += $project->getElementCount(
'expensereport',
'expensereport');
181 $nbElements += $project->getElementCount(
'donation',
'don');
183 if (!empty($conf->loan->enabled)) {
184 $nbElements += $project->getElementCount(
'loan',
'loan');
187 $nbElements += $project->getElementCount(
'chargesociales',
'chargesociales');
190 $nbElements += $project->getElementCount(
'project_task',
'projet_task');
193 $nbElements += $project->getElementCount(
'stock_mouvement',
'stock');
195 if (!empty($conf->salaries->enabled)) {
196 $nbElements += $project->getElementCount(
'salaries',
'payment_salary');
199 $nbElements += $project->getElementCount(
'variouspayment',
'payment_various');
203 $head[$h][0] = DOL_URL_ROOT.
'/projet/element.php?id='.$project->id;
204 $head[$h][1] = $langs->trans(
"ProjectOverview");
205 if ($nbElements > 0) {
206 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbElements.
'</span>';
208 $head[$h][2] =
'element';
212 if (
isModEnabled(
'ticket') && $user->hasRight(
'ticket',
'read')) {
213 require_once DOL_DOCUMENT_ROOT.
'/ticket/class/ticket.class.php';
214 $Tickettatic =
new Ticket($db);
215 $nbTicket = count($Tickettatic->getAllItemsLinkedByObjectID($project->id,
'*',
'fk_project',
'ticket'));
216 $head[$h][0] = DOL_URL_ROOT.
'/ticket/list.php?projectid='.((int) $project->id);
217 $head[$h][1] = $langs->trans(
"Ticket");
219 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbTicket).
'</span>';
221 $head[$h][2] =
'ticket';
225 if (
isModEnabled(
'eventorganization') && !empty($project->usage_organize_event)) {
226 $langs->load(
'eventorganization');
227 $head[$h][0] = DOL_URL_ROOT .
'/eventorganization/conferenceorbooth_list.php?projectid=' . $project->id;
228 $head[$h][1] = $langs->trans(
"EventOrganization");
232 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
233 $cachekey =
'count_conferenceorbooth_'.$project->id;
235 if (!is_null($dataretrieved)) {
236 $nbConfOrBooth = $dataretrieved;
238 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorbooth.class.php';
240 $result = $conforbooth->fetchAll(
'',
'', 0, 0, array(
't.fk_project'=>$project->id));
242 if (!is_array($result) && $result<0) {
245 $nbConfOrBooth = count($result);
249 if ($nbConfOrBooth > 0) {
250 $head[$h][1] .=
'<span class="badge marginleftonlyshort">' . $nbConfOrBooth .
'</span>';
252 $head[$h][2] =
'eventorganisation';
263 if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
265 if (!empty($project->note_private)) {
268 if (!empty($project->note_public)) {
271 $head[$h][0] = DOL_URL_ROOT.
'/projet/note.php?id='.$project->id;
272 $head[$h][1] = $langs->trans(
'Notes');
274 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
276 $head[$h][2] =
'notes';
283 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
284 $cachekey =
'count_attached_project_'.$project->id;
286 if (!is_null($dataretrieved)) {
287 $totalAttached = $dataretrieved;
289 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
290 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
292 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
293 $nbLinks =
Link::count($db, $project->element, $project->id);
294 $totalAttached = $nbFiles + $nbLinks;
297 $head[$h][0] = DOL_URL_ROOT.
'/projet/document.php?id='.$project->id;
298 $head[$h][1] = $langs->trans(
'Documents');
299 if (($totalAttached) > 0) {
300 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($totalAttached).
'</span>';
302 $head[$h][2] =
'document';
306 if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT)) {
309 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
310 $cachekey =
'count_attached_project_'.$project->id;
312 if (!is_null($dataretrieved)) {
313 $nbComments = $dataretrieved;
315 $nbComments = $project->getNbComments();
318 $head[$h][0] = DOL_URL_ROOT.
'/projet/comment.php?id='.$project->id;
319 $head[$h][1] = $langs->trans(
"CommentLink");
320 if ($nbComments > 0) {
321 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbComments.
'</span>';
323 $head[$h][2] =
'project_comment';
327 $head[$h][0] = DOL_URL_ROOT.
'/projet/messaging.php?id='.$project->id;
328 $head[$h][1] = $langs->trans(
"Events");
329 if (
isModEnabled(
'agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
331 $head[$h][1] .= $langs->trans(
"Agenda");
333 $head[$h][2] =
'agenda';
352 global $db, $langs, $conf, $user;
356 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/task.php?id='.$object->id.(GETPOST(
'withproject') ?
'&withproject=1' :
'');
357 $head[$h][1] = $langs->trans(
"Task");
358 $head[$h][2] =
'task_task';
361 $nbContact = count($object->liste_contact(-1,
'internal')) + count($object->liste_contact(-1,
'external'));
362 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/contact.php?id='.$object->id.(GETPOST(
'withproject') ?
'&withproject=1' :
'');
363 $head[$h][1] = $langs->trans(
"TaskRessourceLinks");
364 if ($nbContact > 0) {
365 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
367 $head[$h][2] =
'task_contact';
372 $sql =
"SELECT t.rowid";
375 $sql .=
" FROM ".MAIN_DB_PREFIX.
"projet_task_time as t";
376 $sql .=
" WHERE t.fk_task = ".((int) $object->id);
377 $resql = $db->query($sql);
379 $obj = $db->fetch_object(
$resql);
387 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/time.php?id='.urlencode($object->id).(GETPOST(
'withproject') ?
'&withproject=1' :
'');
388 $head[$h][1] = $langs->trans(
"TimeSpent");
389 if ($nbTimeSpent > 0) {
390 $head[$h][1] .=
'<span class="badge marginleftonlyshort">...</span>';
392 $head[$h][2] =
'task_time';
401 if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
403 if (!empty($object->note_private)) {
406 if (!empty($object->note_public)) {
409 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/note.php?id='.urlencode($object->id).(GETPOST(
'withproject') ?
'&withproject=1' :
'');
410 $head[$h][1] = $langs->trans(
'Notes');
412 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
414 $head[$h][2] =
'task_notes';
418 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/document.php?id='.$object->id.(GETPOST(
'withproject') ?
'&withproject=1' :
'');
420 include_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
421 include_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
422 $nbFiles = count(
dol_dir_list($filesdir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
423 $nbLinks =
Link::count($db, $object->element, $object->id);
424 $head[$h][1] = $langs->trans(
'Documents');
425 if (($nbFiles + $nbLinks) > 0) {
426 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
428 $head[$h][2] =
'task_document';
432 if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK)) {
433 $nbComments = $object->getNbComments();
434 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/comment.php?id='.$object->id.(GETPOST(
'withproject') ?
'&withproject=1' :
'');
435 $head[$h][1] = $langs->trans(
"CommentLink");
436 if ($nbComments > 0) {
437 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbComments.
'</span>';
439 $head[$h][2] =
'task_comment';
459 global $langs, $conf, $user;
466 $param .= ($mode ?
'&mode='.$mode :
'');
467 if (is_object($fuser) && $fuser->id > 0 && $fuser->id != $user->id) {
468 $param .=
'&search_usertoprocessid='.$fuser->id;
471 if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERMONTH)) {
472 $head[$h][0] = DOL_URL_ROOT.
"/projet/activity/permonth.php".($param ?
'?'.$param :
'');
473 $head[$h][1] = $langs->trans(
"InputPerMonth");
474 $head[$h][2] =
'inputpermonth';
478 if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERWEEK)) {
479 $head[$h][0] = DOL_URL_ROOT.
"/projet/activity/perweek.php".($param ?
'?'.$param :
'');
480 $head[$h][1] = $langs->trans(
"InputPerWeek");
481 $head[$h][2] =
'inputperweek';
485 if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERTIME)) {
486 $head[$h][0] = DOL_URL_ROOT.
"/projet/activity/perday.php".($param ?
'?'.$param :
'');
487 $head[$h][1] = $langs->trans(
"InputPerDay");
488 $head[$h][2] =
'inputperday';
507 global $langs, $conf, $user, $db;
510 $extrafields->fetch_name_optionals_label(
'projet');
511 $extrafields->fetch_name_optionals_label(
'projet_task');
516 $head[$h][0] = DOL_URL_ROOT.
"/projet/admin/project.php";
517 $head[$h][1] = $langs->trans(
"Projects");
518 $head[$h][2] =
'project';
523 $head[$h][0] = DOL_URL_ROOT.
"/projet/admin/project_extrafields.php";
524 $head[$h][1] = $langs->trans(
"ExtraFieldsProject");
525 $nbExtrafields = $extrafields->attributes[
'projet'][
'count'];
526 if ($nbExtrafields > 0) {
527 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
529 $head[$h][2] =
'attributes';
532 $head[$h][0] = DOL_URL_ROOT.
'/projet/admin/project_task_extrafields.php';
533 $head[$h][1] = $langs->trans(
"ExtraFieldsProjectTask");
534 $nbExtrafields = $extrafields->attributes[
'projet_task'][
'count'];
535 if ($nbExtrafields > 0) {
536 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
538 $head[$h][2] =
'attributes_task';
541 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
542 $langs->load(
"members");
544 $head[$h][0] = DOL_URL_ROOT.
'/projet/admin/website.php';
545 $head[$h][1] = $langs->trans(
"BlankSubscriptionForm");
546 $head[$h][2] =
'website';
574 function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId =
'', $addordertick = 0, $projectidfortotallink = 0, $filterprogresscalc =
'', $showbilltime = 0, $arrayfields = array())
576 global $user, $langs, $conf, $db, $hookmanager;
577 global $projectstatic, $taskstatic, $extrafields;
581 $projectsArrayId = explode(
',', $projectsListId);
582 if ($filterprogresscalc !==
'') {
583 foreach ($lines as $key => $line) {
584 if (!empty($line->planned_workload) && !empty($line->duration)) {
585 $filterprogresscalc = str_replace(
' = ',
' == ', $filterprogresscalc);
586 if (!eval($filterprogresscalc)) {
591 $lines = array_values($lines);
593 $numlines = count($lines);
596 global $total_projectlinesa_spent, $total_projectlinesa_planned, $total_projectlinesa_spent_if_planned, $total_projectlinesa_declared_if_planned, $total_projectlinesa_tobill, $total_projectlinesa_billed, $total_budget_amount;
599 $total_projectlinesa_spent = 0;
600 $total_projectlinesa_planned = 0;
601 $total_projectlinesa_spent_if_planned = 0;
602 $total_projectlinesa_declared_if_planned = 0;
603 $total_projectlinesa_tobill = 0;
604 $total_projectlinesa_billed = 0;
605 $total_budget_amount = 0;
608 for ($i = 0; $i < $numlines; $i++) {
609 if ($parent == 0 && $level >= 0) {
616 if ($lines[$i]->fk_parent == $parent || $level < 0) {
622 if (is_array($taskrole)) {
624 if (!isset($taskrole[$lines[$i]->
id]) && $lines[$i]->
id != $lines[$i]->fk_parent) {
626 $foundtaskforuserdeeper = 0;
629 if ($foundtaskforuserdeeper > 0) {
638 if (empty($user->rights->projet->all->lire)) {
640 if (!in_array($lines[$i]->fk_project, $projectsArrayId)) {
651 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
653 $lastprojectid = $lines[$i]->fk_project;
656 print
'<tr class="oddeven" id="row-'.$lines[$i]->id.
'">'.
"\n";
658 $projectstatic->id = $lines[$i]->fk_project;
659 $projectstatic->ref = $lines[$i]->projectref;
660 $projectstatic->public = $lines[$i]->public;
661 $projectstatic->title = $lines[$i]->projectlabel;
662 $projectstatic->usage_bill_time = $lines[$i]->usage_bill_time;
663 $projectstatic->status = $lines[$i]->projectstatus;
665 $taskstatic->id = $lines[$i]->id;
666 $taskstatic->ref = $lines[$i]->ref;
667 $taskstatic->label = (!empty($taskrole[$lines[$i]->
id]) ? $langs->trans(
"YourRole").
': '.$taskrole[$lines[$i]->id] :
'');
668 $taskstatic->projectstatus = $lines[$i]->projectstatus;
669 $taskstatic->progress = $lines[$i]->progress;
670 $taskstatic->fk_statut = $lines[$i]->status;
671 $taskstatic->date_start = $lines[$i]->date_start;
672 $taskstatic->date_end = $lines[$i]->date_end;
673 $taskstatic->datee = $lines[$i]->date_end;
674 $taskstatic->planned_workload = $lines[$i]->planned_workload;
675 $taskstatic->duration_effective = $lines[$i]->duration;
676 $taskstatic->budget_amount = $lines[$i]->budget_amount;
681 print
'<td class="nowraponall">';
683 if ($lines[$i]->
public || in_array($lines[$i]->fk_project, $projectsArrayId) || !empty($user->rights->projet->all->lire)) {
684 print $projectstatic->getNomUrl(1);
686 print $projectstatic->getNomUrl(1,
'nolink');
693 $projectstatic->statut = $lines[$i]->projectstatus;
694 print $projectstatic->getLibStatut(2);
699 if (count($arrayfields) > 0 && !empty($arrayfields[
't.ref'][
'checked'])) {
700 print
'<td class="nowraponall">';
701 if ($showlineingray) {
702 print
'<i>'.img_object(
'',
'projecttask').
' '.$lines[$i]->ref.
'</i>';
704 print $taskstatic->getNomUrl(1,
'withproject');
710 if (count($arrayfields) > 0 && !empty($arrayfields[
't.label'][
'checked'])) {
712 if ($showlineingray) {
713 $labeltoshow .=
'<i>';
716 for ($k = 0; $k < $level; $k++) {
717 $labeltoshow .=
'<div class="marginleftonly">';
720 for ($k = 0; $k < $level; $k++) {
721 $labeltoshow .=
'</div>';
723 if ($showlineingray) {
724 $labeltoshow .=
'</i>';
726 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($labeltoshow).
'">';
731 if (count($arrayfields) > 0 && !empty($arrayfields[
't.description'][
'checked'])) {
732 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($lines[$i]->
description).
'">';
733 print $lines[$i]->description;
738 if (count($arrayfields) > 0 && !empty($arrayfields[
't.dateo'][
'checked'])) {
739 print
'<td class="center nowraponall">';
745 if (count($arrayfields) > 0 && !empty($arrayfields[
't.datee'][
'checked'])) {
746 print
'<td class="center nowraponall">';
748 if ($taskstatic->hasDelay()) {
754 $plannedworkloadoutputformat =
'allhourmin';
755 $timespentoutputformat =
'allhourmin';
756 if (!empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) {
757 $plannedworkloadoutputformat = $conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT;
759 if (!empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) {
760 $timespentoutputformat = $conf->global->PROJECT_TIME_SPENT_FORMAT;
764 if (count($arrayfields) > 0 && !empty($arrayfields[
't.planned_workload'][
'checked'])) {
765 print
'<td class="right">';
766 $fullhour =
convertSecondToTime($lines[$i]->planned_workload, $plannedworkloadoutputformat);
768 if ($lines[$i]->planned_workload !=
'') {
778 if (count($arrayfields) > 0 && !empty($arrayfields[
't.duration_effective'][
'checked'])) {
779 print
'<td class="right">';
780 if ($showlineingray) {
783 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$lines[$i]->id.($showproject ?
'' :
'&withproject=1').
'">';
785 if ($lines[$i]->duration) {
790 if ($showlineingray) {
799 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress_calculated'][
'checked'])) {
800 print
'<td class="right">';
801 if ($lines[$i]->planned_workload || $lines[$i]->duration) {
802 if ($lines[$i]->planned_workload) {
803 print round(100 * $lines[$i]->duration / $lines[$i]->planned_workload, 2).
' %';
805 print
'<span class="opacitymedium">'.$langs->trans(
'WorkloadNotDefined').
'</span>';
812 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress'][
'checked'])) {
813 print
'<td class="right">';
814 if ($lines[$i]->progress !=
'') {
821 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress_summary'][
'checked'])) {
822 print
'<td class="right">';
823 if ($lines[$i]->progress !=
'' && $lines[$i]->duration) {
831 if (count($arrayfields) > 0 && !empty($arrayfields[
't.tobill'][
'checked'])) {
832 print
'<td class="right">';
833 if ($lines[$i]->usage_bill_time) {
835 $total_projectlinesa_tobill += $lines[$i]->tobill;
837 print
'<span class="opacitymedium">'.$langs->trans(
"NA").
'</span>';
843 if (count($arrayfields) > 0 && !empty($arrayfields[
't.billed'][
'checked'])) {
844 print
'<td class="right">';
845 if ($lines[$i]->usage_bill_time) {
847 $total_projectlinesa_billed += $lines[$i]->billed;
849 print
'<span class="opacitymedium">'.$langs->trans(
"NA").
'</span>';
856 if (count($arrayfields) > 0 && !empty($arrayfields[
't.budget_amount'][
'checked'])) {
857 print
'<td class="center">';
858 if ($lines[$i]->budget_amount) {
859 print
'<span class="amount">'.price($lines[$i]->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).
'</span>';
860 $total_budget_amount += $lines[$i]->budget_amount;
866 if (count($arrayfields) > 0 && !empty($arrayfields[
'c.assigned'][
'checked'])) {
867 print
'<td class="center">';
869 foreach (array(
'internal',
'external') as $source) {
870 $tab = $lines[$i]->liste_contact(-1, $source);
871 $numcontact = count($tab);
872 if (!empty($numcontact)) {
873 foreach ($tab as $contacttask) {
875 if ($source ==
'internal') {
880 $c->fetch($contacttask[
'id']);
881 if (!empty($c->photo)) {
882 if (get_class($c) ==
'User') {
883 print $c->getNomUrl(-2,
'', 0, 0, 24, 1,
'', ($ifisrt ?
'' :
'notfirst'));
885 print $c->getNomUrl(-2,
'', 0,
'', -1, 0, ($ifisrt ?
'' :
'notfirst'));
888 if (get_class($c) ==
'User') {
889 print $c->getNomUrl(2,
'', 0, 0, 24, 1,
'', ($ifisrt ?
'' :
'notfirst'));
891 print $c->getNomUrl(2,
'', 0,
'', -1, 0, ($ifisrt ?
'' :
'notfirst'));
902 $extrafieldsobjectkey = $taskstatic->table_element;
904 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
906 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$lines[$i]);
907 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
908 print $hookmanager->resPrint;
911 print
'<td class="tdlineupdown center"></td>';
915 if (!$showlineingray) {
921 if ($lines[$i]->
id) {
922 projectLinesa($inc, $lines[$i]->
id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick, $projectidfortotallink, $filterprogresscalc, $showbilltime, $arrayfields);
927 $total_projectlinesa_spent += $lines[$i]->duration;
928 $total_projectlinesa_planned += $lines[$i]->planned_workload;
929 if ($lines[$i]->planned_workload) {
930 $total_projectlinesa_spent_if_planned += $lines[$i]->duration;
932 if ($lines[$i]->planned_workload) {
933 $total_projectlinesa_declared_if_planned += $lines[$i]->planned_workload * $lines[$i]->progress / 100;
941 if (($total_projectlinesa_planned > 0 || $total_projectlinesa_spent > 0 || $total_projectlinesa_tobill > 0 || $total_projectlinesa_billed > 0 || $total_budget_amount > 0)
943 print
'<tr class="liste_total nodrag nodrop">';
944 print
'<td class="liste_total">'.$langs->trans(
"Total").
'</td>';
946 print
'<td></td><td></td>';
948 if (count($arrayfields) > 0 && !empty($arrayfields[
't.label'][
'checked'])) {
951 if (count($arrayfields) > 0 && !empty($arrayfields[
't.dateo'][
'checked'])) {
954 if (count($arrayfields) > 0 && !empty($arrayfields[
't.datee'][
'checked'])) {
957 if (count($arrayfields) > 0 && !empty($arrayfields[
't.planned_workload'][
'checked'])) {
958 print
'<td class="nowrap liste_total right">';
962 if (count($arrayfields) > 0 && !empty($arrayfields[
't.duration_effective'][
'checked'])) {
963 print
'<td class="nowrap liste_total right">';
964 if ($projectidfortotallink > 0) {
965 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?projectid='.$projectidfortotallink.($showproject ?
'' :
'&withproject=1').
'">';
968 if ($projectidfortotallink > 0) {
974 if ($total_projectlinesa_planned) {
975 $totalAverageDeclaredProgress = round(100 * $total_projectlinesa_declared_if_planned / $total_projectlinesa_planned, 2);
976 $totalCalculatedProgress = round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned, 2);
979 $warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
982 $progressBarClass =
'progress-bar-info';
983 $badgeClass =
'badge ';
985 if ($totalCalculatedProgress > $totalAverageDeclaredProgress) {
986 $progressBarClass =
'progress-bar-danger';
987 $badgeClass .=
'badge-danger';
988 } elseif ($totalCalculatedProgress * $warningRatio >= $totalAverageDeclaredProgress) {
989 $progressBarClass =
'progress-bar-warning';
990 $badgeClass .=
'badge-warning';
992 $progressBarClass =
'progress-bar-success';
993 $badgeClass .=
'badge-success';
998 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress_calculated'][
'checked'])) {
999 print
'<td class="nowrap liste_total right">';
1000 if ($total_projectlinesa_planned) {
1001 print $totalCalculatedProgress.
' %';
1007 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress'][
'checked'])) {
1008 print
'<td class="nowrap liste_total right">';
1009 if ($total_projectlinesa_planned) {
1010 print
'<span class="'.$badgeClass.
'" >'.$totalAverageDeclaredProgress.
' %</span>';
1017 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress_summary'][
'checked'])) {
1018 print
'<td class="right">';
1019 if ($total_projectlinesa_planned) {
1021 print
' <div class="progress sm" title="'.$totalAverageDeclaredProgress.
'%" >';
1022 print
' <div class="progress-bar '.$progressBarClass.
'" style="width: '.$totalAverageDeclaredProgress.
'%"></div>';
1029 if ($showbilltime) {
1030 if (count($arrayfields) > 0 && !empty($arrayfields[
't.tobill'][
'checked'])) {
1031 print
'<td class="nowrap liste_total right">';
1035 if (count($arrayfields) > 0 && !empty($arrayfields[
't.billed'][
'checked'])) {
1036 print
'<td class="nowrap liste_total right">';
1043 if (count($arrayfields) > 0 && !empty($arrayfields[
't.budget_amount'][
'checked'])) {
1044 print
'<td class="nowrap liste_total center">';
1045 if (strcmp($total_budget_amount,
'')) {
1046 print
price($total_budget_amount, 0, $langs, 1, 0, 0, $conf->currency);
1052 if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST)) {
1056 if (count($arrayfields) > 0 && !empty($arrayfields[
'c.assigned'][
'checked'])) {
1059 print
'<td class=""></td>';
1084 function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak = 0)
1086 global $conf, $db, $user, $langs;
1087 global
$form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
1090 $totalforeachline = array();
1091 $workloadforid = array();
1092 $lineswithoutlevel0 = array();
1094 $numlines = count($lines);
1098 for ($i = 0; $i < $numlines; $i++) {
1099 if ($lines[$i]->fk_task_parent) {
1100 $lineswithoutlevel0[] = $lines[$i];
1105 if (empty($oldprojectforbreak)) {
1106 $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1);
1110 for ($i = 0; $i < $numlines; $i++) {
1118 if (empty($mine) || !empty($tasksrole[$lines[$i]->
id])) {
1122 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
1123 $lastprojectid = $lines[$i]->fk_project;
1124 if ($preselectedday) {
1125 $projectstatic->id = $lines[$i]->fk_project;
1129 if (empty($workloadforid[$projectstatic->id])) {
1130 if ($preselectedday) {
1131 $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id);
1132 $workloadforid[$projectstatic->id] = 1;
1136 $projectstatic->id = $lines[$i]->fk_project;
1137 $projectstatic->ref = $lines[$i]->project_ref;
1138 $projectstatic->title = $lines[$i]->project_label;
1139 $projectstatic->public = $lines[$i]->public;
1140 $projectstatic->status = $lines[$i]->project->status;
1142 $taskstatic->id = $lines[$i]->fk_statut;
1143 $taskstatic->ref = ($lines[$i]->task_ref ? $lines[$i]->task_ref : $lines[$i]->task_id);
1144 $taskstatic->label = $lines[$i]->task_label;
1145 $taskstatic->date_start = $lines[$i]->date_start;
1146 $taskstatic->date_end = $lines[$i]->date_end;
1148 $thirdpartystatic->id = $lines[$i]->socid;
1149 $thirdpartystatic->name = $lines[$i]->thirdparty_name;
1150 $thirdpartystatic->email = $lines[$i]->thirdparty_email;
1152 if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) {
1153 print
'<tr class="oddeven trforbreak nobold">'.
"\n";
1154 print
'<td colspan="11">';
1155 print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
1156 if ($projectstatic->title) {
1158 print $projectstatic->title;
1164 if ($oldprojectforbreak != -1) {
1165 $oldprojectforbreak = $projectstatic->id;
1168 print
'<tr class="oddeven">'.
"\n";
1179 if ($oldprojectforbreak == -1) {
1180 print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
1181 print
'<br>'.$projectstatic->title;
1186 print
'<td class="tdoverflowmax100">';
1187 if ($thirdpartystatic->id > 0) {
1188 print $thirdpartystatic->getNomUrl(1,
'project', 10);
1194 print
'<!-- Task id = '.$lines[$i]->id.
' -->';
1195 for ($k = 0; $k < $level; $k++) {
1196 print
" ";
1198 print $taskstatic->getNomUrl(1,
'withproject',
'time');
1201 for ($k = 0; $k < $level; $k++) {
1202 print
" ";
1204 print $taskstatic->label;
1211 print
'<td class="center">';
1215 $disabledproject = 1;
1221 if ($lines[$i]->
public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) {
1222 $disabledproject = 0;
1226 if ($restricteditformytask && empty($tasksrole[$lines[$i]->
id])) {
1231 print
'<td class="nowrap center">';
1236 if (!$isavailable[$preselectedday][
'morning'] && !$isavailable[$preselectedday][
'afternoon']) {
1237 $cssonholiday .=
'onholidayallday ';
1238 } elseif (!$isavailable[$preselectedday][
'morning']) {
1239 $cssonholiday .=
'onholidaymorning ';
1240 } elseif (!$isavailable[$preselectedday][
'afternoon']) {
1241 $cssonholiday .=
'onholidayafternoon ';
1245 print
'<td class="duration'.($cssonholiday ?
' '.$cssonholiday :
'').
' center">';
1247 $dayWorkLoad = $lines[$i]->timespent_duration;
1248 $totalforeachline[$preselectedday] += $lines[$i]->timespent_duration;
1251 if ($dayWorkLoad > 0) {
1269 print
'<td class="center">';
1270 print
'<textarea name="'.$lines[$i]->id.
'note" rows="'.ROWS_2.
'" id="'.$lines[$i]->id.
'note"'.($disabledtask ?
' disabled="disabled"' :
'').
'>';
1271 print $lines[$i]->timespent_note;
1272 print
'</textarea>';
1276 print
'<td class="right">';
1296 return $totalforeachline;
1319 function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak = 0, $arrayfields = array(), $extrafields =
null)
1321 global $conf, $db, $user, $langs;
1322 global
$form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
1325 $totalforeachday = array();
1326 $workloadforid = array();
1327 $lineswithoutlevel0 = array();
1329 $numlines = count($lines);
1333 for ($i = 0; $i < $numlines; $i++) {
1334 if ($lines[$i]->fk_task_parent) {
1335 $lineswithoutlevel0[] = $lines[$i];
1340 if (empty($oldprojectforbreak)) {
1341 $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1);
1344 $restrictBefore =
null;
1346 if (!empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) {
1347 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
1352 for ($i = 0; $i < $numlines; $i++) {
1357 if ($lines[$i]->fk_task_parent == $parent) {
1361 if (empty($mine) || !empty($tasksrole[$lines[$i]->
id])) {
1364 if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->
id])) {
1369 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
1370 $lastprojectid = $lines[$i]->fk_project;
1371 if ($preselectedday) {
1372 $projectstatic->id = $lines[$i]->fk_project;
1376 if (empty($workloadforid[$projectstatic->id])) {
1377 if ($preselectedday) {
1378 $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id);
1379 $workloadforid[$projectstatic->id] = 1;
1383 $projectstatic->id = $lines[$i]->fk_project;
1384 $projectstatic->ref = $lines[$i]->projectref;
1385 $projectstatic->title = $lines[$i]->projectlabel;
1386 $projectstatic->public = $lines[$i]->public;
1387 $projectstatic->status = $lines[$i]->projectstatus;
1389 $taskstatic->id = $lines[$i]->id;
1390 $taskstatic->ref = ($lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id);
1391 $taskstatic->label = $lines[$i]->label;
1392 $taskstatic->date_start = $lines[$i]->date_start;
1393 $taskstatic->date_end = $lines[$i]->date_end;
1395 $thirdpartystatic->id = $lines[$i]->socid;
1396 $thirdpartystatic->name = $lines[$i]->thirdparty_name;
1397 $thirdpartystatic->email = $lines[$i]->thirdparty_email;
1399 if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) {
1401 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1404 if (!empty($arrayfields[
't.progress'][
'checked'])) {
1407 foreach ($arrayfields as $key => $val) {
1408 if ($val[
'checked'] && substr($key, 0, 5) ==
'efpt.') {
1413 print
'<tr class="oddeven trforbreak nobold">'.
"\n";
1414 print
'<td colspan="'.(7 + $addcolspan).
'">';
1415 print $projectstatic->getNomUrl(1,
'', 0,
'<strong>'.$langs->transnoentitiesnoconv(
"YourRole").
':</strong> '.$projectsrole[$lines[$i]->fk_project]);
1416 if ($thirdpartystatic->id > 0) {
1417 print
' - '.$thirdpartystatic->getNomUrl(1);
1419 if ($projectstatic->title) {
1421 print
'<span class="secondary">'.$projectstatic->title.
'</span>';
1488 if ($oldprojectforbreak != -1) {
1489 $oldprojectforbreak = $projectstatic->id;
1492 print
'<tr class="oddeven" data-taskid="'.$lines[$i]->id.
'">'.
"\n";
1502 if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) {
1504 if ($oldprojectforbreak == -1) {
1505 print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
1511 if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) {
1512 print
'<td class="tdoverflowmax100">';
1513 if ($thirdpartystatic->id > 0) {
1514 print $thirdpartystatic->getNomUrl(1,
'project', 10);
1521 print
'<!-- Task id = '.$lines[$i]->id.
' -->';
1522 for ($k = 0; $k < $level; $k++) {
1523 print
'<div class="marginleftonly">';
1525 print $taskstatic->getNomUrl(1,
'withproject',
'time');
1528 print
'<span class="opacitymedium">'.$taskstatic->label.
'</a>';
1529 for ($k = 0; $k < $level; $k++) {
1535 $extrafieldsobjectkey =
'projet_task';
1536 $extrafieldsobjectprefix =
'efpt.';
1537 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1540 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1541 print
'<td class="leftborder plannedworkload right">';
1542 if ($lines[$i]->planned_workload) {
1551 if (!empty($arrayfields[
't.progress'][
'checked'])) {
1552 print
'<td class="right">';
1553 print $formother->select_percent($lines[$i]->progress, $lines[$i]->
id.
'progress');
1557 if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
1559 print
'<td class="right">';
1561 if ($lines[$i]->duration) {
1562 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$lines[$i]->id.
'">';
1571 print
'<td class="right">';
1572 $tmptimespent = $taskstatic->getSummaryOfTimeSpent($fuser->id);
1573 if ($tmptimespent[
'total_duration']) {
1581 $disabledproject = 1;
1587 if ($lines[$i]->
public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) {
1588 $disabledproject = 0;
1592 if ($restricteditformytask && empty($tasksrole[$lines[$i]->
id])) {
1596 if ($restrictBefore && $preselectedday < $restrictBefore) {
1601 print
'<td class="nowraponall leftborder center minwidth150imp">';
1602 $tableCell =
$form->selectDate($preselectedday, $lines[$i]->
id, 1, 1, 2,
"addtime", 0, 0, $disabledtask);
1607 if (!$isavailable[$preselectedday][
'morning'] && !$isavailable[$preselectedday][
'afternoon']) {
1608 $cssonholiday .=
'onholidayallday ';
1609 } elseif (!$isavailable[$preselectedday][
'morning']) {
1610 $cssonholiday .=
'onholidaymorning ';
1611 } elseif (!$isavailable[$preselectedday][
'afternoon']) {
1612 $cssonholiday .=
'onholidayafternoon ';
1618 $idw = ($tmparray[
'wday'] - (empty($conf->global->MAIN_START_WEEK) ? 0 : 1));
1619 global $numstartworkingday, $numendworkingday;
1621 if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) {
1622 $cssweekend =
'weekend';
1626 print
'<td class="center duration'.($cssonholiday ?
' '.$cssonholiday :
'').($cssweekend ?
' '.$cssweekend :
'').
'">';
1627 $dayWorkLoad = empty($projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id]) ? 0 : $projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id];
1628 if (!isset($totalforeachday[$preselectedday])) {
1629 $totalforeachday[$preselectedday] = 0;
1631 $totalforeachday[$preselectedday] += $dayWorkLoad;
1634 if ($dayWorkLoad > 0) {
1641 $tableCell .=
'<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center" size="2" disabled id="timespent['.$inc.
']['.$idw.
']" name="task['.$lines[$i]->id.
']['.$idw.
']" value="'.$alreadyspent.
'"></span>';
1642 $tableCell .=
'<span class="hideonsmartphone"> + </span>';
1644 $tableCell .=
$form->select_duration($lines[$i]->
id.
'duration',
'', $disabledtask,
'text', 0, 1);
1660 print
'<td class="center">';
1661 print
'<textarea name="'.$lines[$i]->id.
'note" rows="'.ROWS_2.
'" id="'.$lines[$i]->id.
'note"'.($disabledtask ?
' disabled="disabled"' :
'').
'>';
1662 print
'</textarea>';
1666 print
'<td class="right">';
1667 if ((!$lines[$i]->
public) && $disabledproject) {
1668 print
$form->textwithpicto(
'', $langs->trans(
"UserIsNotContactOfProject"));
1669 } elseif ($disabledtask) {
1670 $titleassigntask = $langs->trans(
"AssignTaskToMe");
1671 if ($fuser->id != $user->id) {
1672 $titleassigntask = $langs->trans(
"AssignTaskToUser",
'...');
1675 print
$form->textwithpicto(
'', $langs->trans(
"TaskIsNotAssignedToUser", $titleassigntask));
1684 if ($lines[$i]->
id > 0) {
1687 $ret =
projectLinesPerDay($inc, $lines[$i]->
id, $fuser, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $isavailable, $oldprojectforbreak, $arrayfields, $extrafields);
1690 foreach ($ret as $key => $val) {
1691 $totalforeachday[$key] += $val;
1702 return $totalforeachday;
1725 function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, &$isavailable, $oldprojectforbreak = 0, $arrayfields = array(), $extrafields =
null)
1727 global $conf, $db, $user, $langs;
1728 global
$form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
1730 $numlines = count($lines);
1733 $workloadforid = array();
1734 $totalforeachday = array();
1735 $lineswithoutlevel0 = array();
1739 for ($i = 0; $i < $numlines; $i++) {
1740 if ($lines[$i]->fk_task_parent) {
1741 $lineswithoutlevel0[] = $lines[$i];
1748 if (empty($oldprojectforbreak)) {
1749 $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1);
1752 $restrictBefore =
null;
1754 if (!empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) {
1755 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
1759 for ($i = 0; $i < $numlines; $i++) {
1764 if ($lines[$i]->fk_task_parent == $parent) {
1768 if (empty($mine) || !empty($tasksrole[$lines[$i]->
id])) {
1771 if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->
id])) {
1776 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
1777 $lastprojectid = $lines[$i]->fk_project;
1778 $projectstatic->id = $lines[$i]->fk_project;
1783 if (empty($workloadforid[$projectstatic->id])) {
1784 $projectstatic->loadTimeSpent($firstdaytoshow, 0, $fuser->id);
1785 $workloadforid[$projectstatic->id] = 1;
1790 $projectstatic->id = $lines[$i]->fk_project;
1791 $projectstatic->ref = $lines[$i]->projectref;
1792 $projectstatic->title = $lines[$i]->projectlabel;
1793 $projectstatic->public = $lines[$i]->public;
1794 $projectstatic->thirdparty_name = $lines[$i]->thirdparty_name;
1795 $projectstatic->status = $lines[$i]->projectstatus;
1797 $taskstatic->id = $lines[$i]->id;
1798 $taskstatic->ref = ($lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id);
1799 $taskstatic->label = $lines[$i]->label;
1800 $taskstatic->date_start = $lines[$i]->date_start;
1801 $taskstatic->date_end = $lines[$i]->date_end;
1803 $thirdpartystatic->id = $lines[$i]->thirdparty_id;
1804 $thirdpartystatic->name = $lines[$i]->thirdparty_name;
1805 $thirdpartystatic->email = $lines[$i]->thirdparty_email;
1807 if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) {
1809 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1812 if (!empty($arrayfields[
't.progress'][
'checked'])) {
1815 foreach ($arrayfields as $key => $val) {
1816 if ($val[
'checked'] && substr($key, 0, 5) ==
'efpt.') {
1821 print
'<tr class="oddeven trforbreak nobold">'.
"\n";
1822 print
'<td colspan="'.(11 + $addcolspan).
'">';
1823 print $projectstatic->getNomUrl(1,
'', 0,
'<strong>'.$langs->transnoentitiesnoconv(
"YourRole").
':</strong> '.$projectsrole[$lines[$i]->fk_project]);
1824 if ($thirdpartystatic->id > 0) {
1825 print
' - '.$thirdpartystatic->getNomUrl(1);
1827 if ($projectstatic->title) {
1829 print
'<span class="secondary">'.$projectstatic->title.
'</span>';
1896 if ($oldprojectforbreak != -1) {
1897 $oldprojectforbreak = $projectstatic->id;
1900 print
'<tr class="oddeven" data-taskid="'.$lines[$i]->id.
'">'.
"\n";
1910 if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) {
1911 print
'<td class="nowrap">';
1912 if ($oldprojectforbreak == -1) {
1913 print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
1919 if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)) {
1920 print
'<td class="tdoverflowmax100">';
1921 if ($thirdpartystatic->id > 0) {
1922 print $thirdpartystatic->getNomUrl(1,
'project');
1928 print
'<td class="nowrap">';
1929 print
'<!-- Task id = '.$lines[$i]->id.
' -->';
1930 for ($k = 0; $k < $level; $k++) {
1931 print
'<div class="marginleftonly">';
1933 print $taskstatic->getNomUrl(1,
'withproject',
'time');
1936 print
'<span class="opacitymedium">'.$taskstatic->label.
'</span>';
1937 for ($k = 0; $k < $level; $k++) {
1943 $extrafieldsobjectkey =
'projet_task';
1944 $extrafieldsobjectprefix =
'efpt.';
1945 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1948 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) {
1949 print
'<td class="leftborder plannedworkload right">';
1950 if ($lines[$i]->planned_workload) {
1958 if (!empty($arrayfields[
't.progress'][
'checked'])) {
1960 print
'<td class="right">';
1961 print $formother->select_percent($lines[$i]->progress, $lines[$i]->
id.
'progress');
1965 if (!empty($arrayfields[
'timeconsumed'][
'checked'])) {
1967 print
'<td class="right">';
1969 if ($lines[$i]->duration) {
1970 print
'<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$lines[$i]->id.
'">';
1979 print
'<td class="right">';
1980 $tmptimespent = $taskstatic->getSummaryOfTimeSpent($fuser->id);
1981 if ($tmptimespent[
'total_duration']) {
1989 $disabledproject = 1;
1995 if ($lines[$i]->
public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) {
1996 $disabledproject = 0;
2000 if ($restricteditformytask && empty($tasksrole[$lines[$i]->
id])) {
2008 $modeinput =
'hours';
2009 for ($idw = 0; $idw < 7; $idw++) {
2011 if (!isset($totalforeachday[$tmpday])) $totalforeachday[$tmpday] = 0;
2013 if (!$isavailable[$tmpday][
'morning'] && !$isavailable[$tmpday][
'afternoon']) {
2014 $cssonholiday .=
'onholidayallday ';
2015 } elseif (!$isavailable[$tmpday][
'morning']) {
2016 $cssonholiday .=
'onholidaymorning ';
2017 } elseif (!$isavailable[$tmpday][
'afternoon']) {
2018 $cssonholiday .=
'onholidayafternoon ';
2022 $dayWorkLoad = (!empty($projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id]) ? $projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id] : 0);
2023 $totalforeachday[$tmpday] += $dayWorkLoad;
2026 if ($dayWorkLoad > 0) {
2029 $alttitle = $langs->trans(
"AddHereTimeSpentForDay", !empty($tmparray[
'day']) ? $tmparray[
'day'] : 0, $tmparray[
'mon']);
2031 global $numstartworkingday, $numendworkingday;
2033 if (($idw + 1 < $numstartworkingday) || ($idw + 1 > $numendworkingday)) {
2034 $cssweekend =
'weekend';
2037 $disabledtaskday = $disabledtask;
2039 if (! $disabledtask && $restrictBefore && $tmpday < $restrictBefore) {
2040 $disabledtaskday = 1;
2043 $tableCell =
'<td class="center hide'.$idw.($cssonholiday ?
' '.$cssonholiday :
'').($cssweekend ?
' '.$cssweekend :
'').
'">';
2046 if ($alreadyspent) {
2047 $tableCell .=
'<span class="timesheetalreadyrecorded" title="texttoreplace"><input type="text" class="center smallpadd" size="2" disabled id="timespent['.$inc.
']['.$idw.
']" name="task['.$lines[$i]->id.
']['.$idw.
']" value="'.$alreadyspent.
'"></span>';
2051 $tableCell .=
'<input type="text" alt="'.($disabledtaskday ?
'' : $alttitle).
'" title="'.($disabledtaskday ?
'' : $alttitle).
'" '.($disabledtaskday ?
'disabled' : $placeholder).
' class="center smallpadd" size="2" id="timeadded['.$inc.
']['.$idw.
']" name="task['.$lines[$i]->id.
']['.$idw.
']" value="" cols="2" maxlength="5"';
2052 $tableCell .=
' onkeypress="return regexEvent(this,event,\'timeChar\')"';
2053 $tableCell .=
' onkeyup="updateTotal('.$idw.
',\''.$modeinput.
'\')
"';
2054 $tableCell .= ' onblur="regexEvent(
this,event,\
''.$modeinput.
'\'); updateTotal(
'.$idw.',\
''.$modeinput.
'\')
" />';
2055 $tableCell .= '</td>';
2060 print '<td class="right
">';
2061 if ((!$lines[$i]->public) && $disabledproject) {
2062 print $form->textwithpicto('', $langs->trans("UserIsNotContactOfProject
"));
2063 } elseif ($disabledtask) {
2064 $titleassigntask = $langs->trans("AssignTaskToMe
");
2065 if ($fuser->id != $user->id) {
2066 $titleassigntask = $langs->trans("AssignTaskToUser
", '...');
2069 print $form->textwithpicto('', $langs->trans("TaskIsNotAssignedToUser
", $titleassigntask));
2076 // Call to show task with a lower level (task under the current task)
2079 if ($lines[$i]->id > 0) {
2080 //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level);
2081 //var_dump($totalforeachday);
2082 $ret = projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak, $arrayfields, $extrafields);
2083 //var_dump('ret with parent='.$lines[$i]->id.' level='.$level);
2085 foreach ($ret as $key => $val) {
2086 $totalforeachday[$key] += $val;
2088 //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level.' + subtasks');
2089 //var_dump($totalforeachday);
2097 return $totalforeachday;
2118 function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, &$isavailable, $oldprojectforbreak = 0, $TWeek = array())
2120 global $conf, $db, $user, $langs;
2121 global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
2123 $numlines = count($lines);
2126 $workloadforid = array();
2127 $totalforeachweek = array();
2128 $lineswithoutlevel0 = array();
2130 // Create a smaller array with sublevels only to be used later. This increase dramatically performances.
2131 if ($parent == 0) { // Always and only if at first level
2132 for ($i = 0; $i < $numlines; $i++) {
2133 if ($lines[$i]->fk_task_parent) {
2134 $lineswithoutlevel0[] = $lines[$i];
2139 //dol_syslog('projectLinesPerWeek inc='.$inc.' firstdaytoshow='.$firstdaytoshow.' task parent id='.$parent.' level='.$level." count(lines)=
".$numlines." count(lineswithoutlevel0)=
".count($lineswithoutlevel0));
2141 if (empty($oldprojectforbreak)) {
2142 $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1); // 0 = start break, -1 = never break
2145 $restrictBefore = null;
2147 if (!empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) {
2148 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
2149 $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm');
2152 for ($i = 0; $i < $numlines; $i++) {
2157 if ($lines[$i]->fk_task_parent == $parent) {
2158 // If we want all or we have a role on task, we show it
2159 if (empty($mine) || !empty($tasksrole[$lines[$i]->id])) {
2160 //dol_syslog("projectLinesPerWeek Found line
".$i.", a qualified task (i have role or want to show all tasks) with
id=
".$lines[$i]->id." project
id=
".$lines[$i]->fk_project);
2162 // Break on a new project
2163 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
2164 $lastprojectid = $lines[$i]->fk_project;
2165 $projectstatic->id = $lines[$i]->fk_project;
2168 //var_dump('--- '.$level.' '.$firstdaytoshow.' '.$fuser->id.' '.$projectstatic->id.' '.$workloadforid[$projectstatic->id]);
2169 //var_dump($projectstatic->weekWorkLoadPerTask);
2170 if (empty($workloadforid[$projectstatic->id])) {
2171 $projectstatic->loadTimeSpentMonth($firstdaytoshow, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week
2172 $workloadforid[$projectstatic->id] = 1;
2174 //var_dump($projectstatic->weekWorkLoadPerTask);
2175 //var_dump('--- '.$projectstatic->id.' '.$workloadforid[$projectstatic->id]);
2177 $projectstatic->id = $lines[$i]->fk_project;
2178 $projectstatic->ref = $lines[$i]->projectref;
2179 $projectstatic->title = $lines[$i]->projectlabel;
2180 $projectstatic->public = $lines[$i]->public;
2181 $projectstatic->thirdparty_name = $lines[$i]->thirdparty_name;
2182 $projectstatic->status = $lines[$i]->projectstatus;
2184 $taskstatic->id = $lines[$i]->id;
2185 $taskstatic->ref = ($lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id);
2186 $taskstatic->label = $lines[$i]->label;
2187 $taskstatic->date_start = $lines[$i]->date_start;
2188 $taskstatic->date_end = $lines[$i]->date_end;
2190 $thirdpartystatic->id = $lines[$i]->thirdparty_id;
2191 $thirdpartystatic->name = $lines[$i]->thirdparty_name;
2192 $thirdpartystatic->email = $lines[$i]->thirdparty_email;
2194 if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) {
2195 print '<tr class="oddeven trforbreak nobold
">'."\n
";
2196 print '<td colspan="'.(6 + count($TWeek)).'">';
2197 print $projectstatic->getNomUrl(1, '', 0, '<strong>'.$langs->transnoentitiesnoconv("YourRole
").':</strong> '.$projectsrole[$lines[$i]->fk_project]);
2198 if ($thirdpartystatic->id > 0) {
2199 print ' - '.$thirdpartystatic->getNomUrl(1);
2201 if ($projectstatic->title) {
2203 print '<span class="secondary
">'.$projectstatic->title.'</span>';
2209 if ($oldprojectforbreak != -1) {
2210 $oldprojectforbreak = $projectstatic->id;
2212 print '<tr class="oddeven
" data-taskid="'.$lines[$i]->id.'">'."\n
";
2216 print '<td class="nowrap
">';
2217 print $fuser->getNomUrl(1, 'withproject', 'time');
2222 /*print '<td class="nowrap
">';
2223 if ($oldprojectforbreak == -1) print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole
").': '.$projectsrole[$lines[$i]->fk_project]);
2227 /*print '<td class="tdoverflowmax100
">';
2228 if ($thirdpartystatic->id > 0) print $thirdpartystatic->getNomUrl(1, 'project');
2232 print '<td class="nowrap
">';
2233 print '<!-- Task id = '.$lines[$i]->id.' -->';
2234 for ($k = 0; $k < $level; $k++) {
2235 print '<div class="marginleftonly
">';
2237 print $taskstatic->getNomUrl(1, 'withproject', 'time');
2240 print '<span class="opacitymedium
">'.$taskstatic->label.'</span>';
2241 for ($k = 0; $k < $level; $k++) {
2247 print '<td class="leftborder plannedworkload right
">';
2248 if ($lines[$i]->planned_workload) {
2249 print convertSecondToTime($lines[$i]->planned_workload, 'allhourmin');
2255 // Progress declared %
2256 print '<td class="right
">';
2257 print $formother->select_percent($lines[$i]->progress, $lines[$i]->id.'progress');
2260 // Time spent by everybody
2261 print '<td class="right
">';
2262 // $lines[$i]->duration is a denormalised field = summ of time spent by everybody for task. What we need is time consumed by user
2263 if ($lines[$i]->duration) {
2264 print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?
id=
'.$lines[$i]->id.'">';
2265 print convertSecondToTime($lines[$i]->duration, 'allhourmin');
2272 // Time spent by user
2273 print '<td class="right
">';
2274 $tmptimespent = $taskstatic->getSummaryOfTimeSpent($fuser->id);
2275 if ($tmptimespent['total_duration']) {
2276 print convertSecondToTime($tmptimespent['total_duration'], 'allhourmin');
2282 $disabledproject = 1;
2284 //print "x
".$lines[$i]->fk_project;
2285 //var_dump($lines[$i]);
2286 //var_dump($projectsrole[$lines[$i]->fk_project]);
2287 // If at least one role for project
2288 if ($lines[$i]->public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) {
2289 $disabledproject = 0;
2292 // If $restricteditformytask is on and I have no role on task, i disable edit
2293 if ($restricteditformytask && empty($tasksrole[$lines[$i]->id])) {
2297 //var_dump($projectstatic->weekWorkLoadPerTask);
2299 // Fields to show current time
2301 $modeinput = 'hours';
2302 $TFirstDay = getFirstDayOfEachWeek($TWeek, date('Y', $firstdaytoshow));
2303 $TFirstDay[reset($TWeek)] = 1;
2305 $firstdaytoshowarray = dol_getdate($firstdaytoshow);
2306 $year = $firstdaytoshowarray['year'];
2307 $month = $firstdaytoshowarray['mon'];
2308 foreach ($TWeek as $weekIndex => $weekNb) {
2309 $weekWorkLoad = !empty($projectstatic->monthWorkLoadPerTask[$weekNb][$lines[$i]->id]) ? $projectstatic->monthWorkLoadPerTask[$weekNb][$lines[$i]->id] : 0 ;
2310 if (!isset($totalforeachweek[$weekNb])) $totalforeachweek[$weekNb] = 0;
2311 $totalforeachweek[$weekNb] += $weekWorkLoad;
2314 if ($weekWorkLoad > 0) {
2315 $alreadyspent = convertSecondToTime($weekWorkLoad, 'allhourmin');
2317 $alttitle = $langs->trans("AddHereTimeSpentForWeek
", $weekNb);
2319 $disabledtaskweek = $disabledtask;
2320 $firstdayofweek = dol_mktime(0, 0, 0, $month, $TFirstDay[$weekIndex], $year);
2322 if (! $disabledtask && $restrictBefore && $firstdayofweek < $restrictBefore) {
2323 $disabledtaskweek = 1;
2326 $tableCell = '<td class="center hide weekend
">';
2328 if ($alreadyspent) {
2329 $tableCell .= '<span class="timesheetalreadyrecorded
" title="texttoreplace
"><input type="text
" class="center smallpadd
" size="2
" disabled id="timespent[
'.$inc.'][
'.((int) $weekNb).']
" name="task[
'.$lines[$i]->id.'][
'.$weekNb.']
" value="'.$alreadyspent.'"></span>';
2330 //$placeholder=' placeholder="00:00
"';
2334 $tableCell .= '<input type="text
" alt="'.($disabledtaskweek ? '' : $alttitle).'" title="'.($disabledtaskweek ? '' : $alttitle).'" '.($disabledtaskweek ? 'disabled' : $placeholder).' class="center smallpadd
" size="2
" id="timeadded[
'.$inc.'][
'.((int) $weekNb).']
" name="task[
'.$lines[$i]->id.'][
'.($TFirstDay[$weekNb] - 1).']
" value="" cols="2
" maxlength="5
"';
2335 $tableCell .= ' onkeypress="return regexEvent(
this,event,\
'timeChar\')"';
2336 $tableCell .=
' onkeyup="updateTotal('.$weekNb.
',\''.$modeinput.
'\')
"';
2337 $tableCell .= ' onblur="regexEvent(
this,event,\
''.$modeinput.
'\'); updateTotal(
'.$weekNb.',\
''.$modeinput.
'\')
" />';
2338 $tableCell .= '</td>';
2343 print '<td class="right
">';
2344 if ((!$lines[$i]->public) && $disabledproject) {
2345 print $form->textwithpicto('', $langs->trans("UserIsNotContactOfProject
"));
2346 } elseif ($disabledtask) {
2347 $titleassigntask = $langs->trans("AssignTaskToMe
");
2348 if ($fuser->id != $user->id) {
2349 $titleassigntask = $langs->trans("AssignTaskToUser
", '...');
2352 print $form->textwithpicto('', $langs->trans("TaskIsNotAssignedToUser
", $titleassigntask));
2359 // Call to show task with a lower level (task under the current task)
2362 if ($lines[$i]->id > 0) {
2363 //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level);
2364 //var_dump($totalforeachday);
2365 $ret = projectLinesPerMonth($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak, $TWeek);
2366 //var_dump('ret with parent='.$lines[$i]->id.' level='.$level);
2368 foreach ($ret as $key => $val) {
2369 $totalforeachweek[$key] += $val;
2371 //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level.' + subtasks');
2372 //var_dump($totalforeachday);
2380 return $totalforeachweek;
2393 function searchTaskInChild(&$inc, $parent, &$lines, &$taskrole)
2395 //print 'Search in line with parent id = '.$parent.'<br>';
2396 $numlines = count($lines);
2397 for ($i = 0; $i < $numlines; $i++) {
2398 // Process line $lines[$i]
2399 if ($lines[$i]->fk_parent == $parent && $lines[$i]->id != $lines[$i]->fk_parent) {
2400 // If task is legitimate to show, no more need to search deeper
2401 if (isset($taskrole[$lines[$i]->id])) {
2402 //print 'Found a legitimate task id='.$lines[$i]->id.'<br>';
2407 searchTaskInChild($inc, $lines[$i]->id, $lines, $taskrole);
2408 //print 'Found inc='.$inc.'<br>';
2432 function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks = 0, $status = -1, $listofoppstatus = array(), $hiddenfields = array())
2434 global $langs, $conf, $user;
2435 global $theme_datacolor;
2437 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
2439 $listofstatus = array_keys($listofoppstatus);
2441 if (is_array($listofstatus) && !empty($conf->global->USE_COLOR_FOR_PROSPECTION_STATUS)) {
2442 // Define $themeColorId and array $statusOppList for each $listofstatus
2444 $statusOppList = array();
2445 foreach ($listofstatus as $oppStatus) {
2446 $oppStatusCode = dol_getIdFromCode($db, $oppStatus, 'c_lead_status', 'rowid', 'code');
2447 if ($oppStatusCode) {
2448 $statusOppList[$oppStatus]['code'] = $oppStatusCode;
2449 $statusOppList[$oppStatus]['color'] = isset($theme_datacolor[$themeColorId]) ? implode(', ', $theme_datacolor[$themeColorId]) : '';
2455 $projectstatic = new Project($db);
2456 $thirdpartystatic = new Societe($db);
2460 $project_year_filter = 0;
2462 $title = $langs->trans("Projects");
2463 if (strcmp($status, '') && $status >= 0) {
2464 $title = $langs->trans("Projects").' '.$langs->trans($projectstatic->statuts_long[$status]);
2467 $arrayidtypeofcontact = array();
2469 print '<!-- print_projecttasks_array -->';
2470 print '<div class="div-table-responsive-no-min
">';
2471 print '<table class="noborder centpercent
">';
2473 $sql = " FROM
".MAIN_DB_PREFIX."projet as p
";
2475 $sql .= ",
".MAIN_DB_PREFIX."projet_task as t
";
2476 $sql .= ",
".MAIN_DB_PREFIX."element_contact as ec
";
2477 $sql .= ",
".MAIN_DB_PREFIX."c_type_contact as ctc
";
2479 $sql .= " LEFT JOIN
".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet
";
2481 $sql .= " WHERE p.entity IN (
".getEntity('project').")
";
2482 $sql .= " AND p.rowid IN (
".$db->sanitize($projectsListId).")
";
2484 $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc =
".((int) $socid).")
";
2487 $sql .= " AND p.rowid = t.fk_projet
";
2488 $sql .= " AND ec.element_id = t.rowid
";
2489 $sql .= " AND ec.fk_socpeople =
".((int) $user->id);
2490 $sql .= " AND ec.fk_c_type_contact = ctc.rowid
"; // Replace the 2 lines with ec.fk_c_type_contact in $arrayidtypeofcontact
2491 $sql .= " AND ctc.element =
'project_task'";
2494 $sql .= " AND p.fk_statut =
".(int) $status;
2496 if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE)) {
2497 $project_year_filter = GETPOST("project_year_filter
");
2498 //Check if empty or invalid year. Wildcard ignores the sql check
2499 if ($project_year_filter != "*
") {
2500 if (empty($project_year_filter) || !ctype_digit($project_year_filter)) {
2501 $project_year_filter = date("Y
");
2503 $sql .= " AND (p.dateo IS NULL OR p.dateo <=
".$db->idate(dol_get_last_day($project_year_filter, 12, false)).")
";
2504 $sql .= " AND (p.datee IS NULL OR p.datee >=
".$db->idate(dol_get_first_day($project_year_filter, 1, false)).")
";
2508 // Get id of project we must show tasks
2509 $arrayidofprojects = array();
2510 $sql1 = "SELECT p.rowid as projectid
";
2512 $resql = $db->query($sql1);
2515 $num = $db->num_rows($resql);
2517 $objp = $db->fetch_object($resql);
2518 $arrayidofprojects[$objp->projectid] = $objp->projectid;
2522 dol_print_error($db);
2524 if (empty($arrayidofprojects)) {
2525 $arrayidofprojects[0] = -1;
2528 // Get list of project with calculation on tasks
2529 $sql2 = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_soc,
";
2530 $sql2 .= " s.rowid as socid, s.nom as socname, s.name_alias,
";
2531 $sql2 .= " s.code_client, s.code_compta, s.client,
";
2532 $sql2 .= " s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur,
";
2533 $sql2 .= " s.logo, s.email, s.entity,
";
2534 $sql2 .= " p.fk_user_creat, p.public, p.fk_statut as status, p.fk_opp_status as opp_status, p.opp_percent, p.opp_amount,
";
2535 $sql2 .= " p.dateo, p.datee,
";
2536 $sql2 .= " COUNT(t.rowid) as nb, SUM(t.planned_workload) as planned_workload, SUM(t.planned_workload * t.progress / 100) as declared_progess_workload";
2537 $sql2 .= " FROM ".MAIN_DB_PREFIX."projet as p";
2538 $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.
rowid = p.fk_soc";
2539 $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.
rowid = t.fk_projet";
2540 $sql2 .= " WHERE p.
rowid IN (".$db->sanitize(join(',', $arrayidofprojects)).")";
2541 $sql2 .= " GROUP BY p.
rowid, p.
ref, p.title, p.fk_soc, s.
rowid, s.nom, s.name_alias, s.code_client, s.code_compta, s.client, s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur,";
2542 $sql2 .= " s.logo, s.email, s.entity, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, p.opp_percent, p.opp_amount, p.dateo, p.datee";
2543 $sql2 .= " ORDER BY p.title, p.
ref";
2545 $resql = $db->query($sql2);
2548 $total_opp_amount = 0;
2549 $ponderated_opp_amount = 0;
2551 $num = $db->num_rows(
$resql);
2554 print
'<tr class="liste_titre">';
2555 print_liste_field_titre($title.
'<a href="'.DOL_URL_ROOT.
'/projet/list.php?search_status='.((
int) $status).
'"><span class="badge marginleftonlyshort">'.$num.
'</span></a>', $_SERVER[
"PHP_SELF"],
"",
"",
"",
"", $sortfield, $sortorder);
2557 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
2558 if (!in_array(
'prospectionstatus', $hiddenfields)) {
2559 print_liste_field_titre(
"OpportunityStatus",
"",
"",
"",
"",
'style="max-width: 100px"', $sortfield, $sortorder,
'center ');
2561 print_liste_field_titre(
$form->textwithpicto($langs->trans(
"Amount"), $langs->trans(
"OpportunityAmount").
' ('.$langs->trans(
"Tooltip").
' = '.$langs->trans(
"OpportunityWeightedAmount").
')'),
"",
"",
"",
"",
'style="max-width: 100px"', $sortfield, $sortorder,
'right ');
2564 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
2566 if (!in_array(
'plannedworkload', $hiddenfields)) {
2567 print_liste_field_titre(
"PlannedWorkload",
"",
"",
"",
"",
'style="max-width: 100px"', $sortfield, $sortorder,
'right ');
2569 if (!in_array(
'declaredprogress', $hiddenfields)) {
2570 print_liste_field_titre(
"%",
"",
"",
"",
"",
'', $sortfield, $sortorder,
'right ', $langs->trans(
"ProgressDeclared"));
2573 if (!in_array(
'projectstatus', $hiddenfields)) {
2578 $total_plannedworkload = 0;
2579 $total_declaredprogressworkload = 0;
2581 $objp = $db->fetch_object(
$resql);
2583 $projectstatic->id = $objp->projectid;
2584 $projectstatic->user_author_id = $objp->fk_user_creat;
2585 $projectstatic->public = $objp->public;
2588 $userAccess = $projectstatic->restrictedProjectArea($user);
2589 if ($userAccess >= 0) {
2590 $projectstatic->ref = $objp->ref;
2591 $projectstatic->status = $objp->status;
2592 $projectstatic->title = $objp->title;
2593 $projectstatic->date_end = $db->jdate($objp->datee);
2594 $projectstatic->date_start = $db->jdate($objp->dateo);
2596 print
'<tr class="oddeven">';
2598 print
'<td class="tdoverflowmax150">';
2599 print $projectstatic->getNomUrl(1,
'', 0,
'',
'-', 0, -1,
'nowraponall');
2600 if (!in_array(
'projectlabel', $hiddenfields)) {
2601 print
'<br><span class="opacitymedium small">'.dol_escape_htmltag($objp->title).
'</span>';
2605 print
'<td class="nowraponall tdoverflowmax100">';
2606 if ($objp->fk_soc > 0) {
2607 $thirdpartystatic->id = $objp->socid;
2608 $thirdpartystatic->name = $objp->socname;
2611 $thirdpartystatic->code_compta = $objp->code_compta;
2612 $thirdpartystatic->client = $objp->client;
2614 $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
2615 $thirdpartystatic->fournisseur = $objp->fournisseur;
2616 $thirdpartystatic->logo = $objp->logo;
2617 $thirdpartystatic->email = $objp->email;
2618 $thirdpartystatic->entity = $objp->entity;
2619 print $thirdpartystatic->getNomUrl(1);
2623 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
2624 if (!in_array(
'prospectionstatus', $hiddenfields)) {
2625 print
'<td class="center tdoverflowmax75">';
2627 if (empty($conf->global->USE_COLOR_FOR_PROSPECTION_STATUS)) {
2628 $oppStatusCode =
dol_getIdFromCode($db, $objp->opp_status,
'c_lead_status',
'rowid',
'code');
2629 if ($langs->trans(
"OppStatus".$oppStatusCode) !=
"OppStatus".$oppStatusCode) {
2630 print $langs->trans(
"OppStatus".$oppStatusCode);
2633 if (isset($statusOppList[$objp->opp_status])) {
2634 $oppStatusCode = $statusOppList[$objp->opp_status][
'code'];
2635 $oppStatusColor = $statusOppList[$objp->opp_status][
'color'];
2637 $oppStatusCode =
dol_getIdFromCode($db, $objp->opp_status,
'c_lead_status',
'rowid',
'code');
2638 $oppStatusColor =
'';
2640 if ($oppStatusCode) {
2641 if (!empty($oppStatusColor)) {
2642 print
'<a href="'.dol_buildpath(
'/projet/list.php?search_opp_status='.$objp->opp_status, 1).
'" style="display: inline-block; width: 4px; border: 5px solid rgb('.$oppStatusColor.
'); border-radius: 2px;" title="'.$langs->trans(
"OppStatus".$oppStatusCode).
'"></a>';
2644 print
'<a href="'.dol_buildpath(
'/projet/list.php?search_opp_status='.$objp->opp_status, 1).
'" title="'.$langs->trans(
"OppStatus".$oppStatusCode).
'">'.$oppStatusCode.
'</a>';
2651 print
'<td class="right">';
2652 if ($objp->opp_percent && $objp->opp_amount) {
2653 $opp_weighted_amount = $objp->opp_percent * $objp->opp_amount / 100;
2654 $alttext = $langs->trans(
"OpportunityWeightedAmount").
' '.
price($opp_weighted_amount, 0,
'', 1, -1, 0, $conf->currency);
2655 $ponderated_opp_amount +=
price2num($opp_weighted_amount);
2657 if ($objp->opp_amount) {
2658 print
'<span class="amount" title="'.$alttext.
'">'.
$form->textwithpicto(
price($objp->opp_amount, 0,
'', 1, -1, 0), $alttext).
'</span>';
2663 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
2664 print
'<td class="right">'.$objp->nb.
'</td>';
2666 $plannedworkload = $objp->planned_workload;
2667 $total_plannedworkload += $plannedworkload;
2668 if (!in_array(
'plannedworkload', $hiddenfields)) {
2669 print
'<td class="right nowraponall">'.($plannedworkload ?
convertSecondToTime($plannedworkload) :
'').
'</td>';
2671 if (!in_array(
'declaredprogress', $hiddenfields)) {
2672 $declaredprogressworkload = $objp->declared_progess_workload;
2673 $total_declaredprogressworkload += $declaredprogressworkload;
2674 print
'<td class="right nowraponall">';
2676 print ($plannedworkload ?round(100 * $declaredprogressworkload / $plannedworkload, 0).
'%' :
'');
2681 if (!in_array(
'projectstatus', $hiddenfields)) {
2682 print
'<td class="right">';
2683 print $projectstatic->getLibStatut(3);
2689 $total_task = $total_task + $objp->nb;
2690 $total_opp_amount = $total_opp_amount + $objp->opp_amount;
2696 print
'<tr class="liste_total">';
2697 print
'<td>'.$langs->trans(
"Total").
"</td><td></td>";
2698 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
2699 if (!in_array(
'prospectionstatus', $hiddenfields)) {
2700 print
'<td class="liste_total"></td>';
2702 print
'<td class="liste_total right">';
2704 print
$form->textwithpicto(
price($total_opp_amount, 0,
'', 1, -1, 0), $langs->trans(
"OpportunityPonderatedAmountDesc").
' : '.
price($ponderated_opp_amount, 0,
'', 1, -1, 0, $conf->currency));
2707 if (empty($conf->global->PROJECT_HIDE_TASKS)) {
2708 print
'<td class="liste_total right">'.$total_task.
'</td>';
2709 if (!in_array(
'plannedworkload', $hiddenfields)) {
2710 print
'<td class="liste_total right">'.($total_plannedworkload ?
convertSecondToTime($total_plannedworkload) :
'').
'</td>';
2712 if (!in_array(
'declaredprogress', $hiddenfields)) {
2713 print
'<td class="liste_total right">'.($total_plannedworkload ?round(100 * $total_declaredprogressworkload / $total_plannedworkload, 0).
'%' :
'').
'</td>';
2716 if (!in_array(
'projectstatus', $hiddenfields)) {
2717 print
'<td class="liste_total"></td>';
2729 if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE)) {
2731 print
'<form method="get" action="'.$_SERVER[
"PHP_SELF"].
'">';
2732 print
'<table width="100%">';
2734 print
'<td>'.$langs->trans(
"Year").
'</td>';
2735 print
'<td class="right"><input type="text" size="4" class="flat" name="project_year_filter" value="'.$project_year_filter.
'"/>';
2737 print
'</table></form>';
2750 function getTaskProgressView($task, $label =
true, $progressNumber =
true, $hideOnProgressNull =
false, $spaced =
false)
2752 global $langs, $conf;
2756 $plannedworkloadoutputformat =
'allhourmin';
2757 $timespentoutputformat =
'allhourmin';
2758 if (!empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) {
2759 $plannedworkloadoutputformat = $conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT;
2761 if (!empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) {
2762 $timespentoutputformat = $conf->global->PROJECT_TIME_SPENT_FORMAT;
2765 if (empty($task->progress) && !empty($hideOnProgressNull)) {
2769 $spaced = !empty($spaced) ?
'spaced' :
'';
2774 $progressBarClass =
'progress-bar-info';
2775 $progressCalculated = 0;
2776 if ($task->planned_workload) {
2777 $progressCalculated = round(100 * floatval($task->duration_effective) / floatval($task->planned_workload), 2);
2780 $warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
2782 $diffTitle =
'<br>'.$langs->trans(
'ProgressDeclared').
' : '.$task->progress.($task->progress ?
'%' :
'');
2783 $diffTitle .=
'<br>'.$langs->trans(
'ProgressCalculated').
' : '.$progressCalculated.($progressCalculated ?
'%' :
'');
2786 if (floatval($progressCalculated) > floatval($task->progress * $warningRatio)) {
2787 $progressBarClass =
'progress-bar-danger';
2788 $title = $langs->trans(
'TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress - $progressCalculated).
' '.$langs->trans(
"point"));
2789 $diff =
'<span class="text-danger classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).
'" ><i class="fa fa-caret-down"></i> '.($task->progress - $progressCalculated).
'%</span>';
2790 } elseif (floatval($progressCalculated) > floatval($task->progress)) {
2791 $progressBarClass =
'progress-bar-warning';
2792 $title = $langs->trans(
'TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress - $progressCalculated).
' '.$langs->trans(
"point"));
2793 $diff =
'<span class="text-warning classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).
'" ><i class="fa fa-caret-left"></i> '.($task->progress - $progressCalculated).
'%</span>';
2795 $progressBarClass =
'progress-bar-success';
2796 $title = $langs->trans(
'TheReportedProgressIsMoreThanTheCalculatedProgressionByX', ($task->progress - $progressCalculated).
' '.$langs->trans(
"point"));
2797 $diff =
'<span class="text-success classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).
'" ><i class="fa fa-caret-up"></i> '.($task->progress - $progressCalculated).
'%</span>';
2801 $out .=
'<div class="progress-group">';
2803 if ($label !==
false) {
2804 $out .=
' <span class="progress-text">';
2806 if ($label !==
true) {
2815 if ($progressNumber !==
false) {
2816 $out .=
' <span class="progress-number">';
2817 if ($progressNumber !==
true) {
2818 $out .= $progressNumber;
2820 if ($task->hasDelay()) {
2824 $url = DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$task->id;
2826 $out .= !empty($diff) ? $diff.
' ' :
'';
2827 $out .=
'<a href="'.$url.
'" >';
2828 $out .=
'<b title="'.$langs->trans(
'TimeSpent').
'" >';
2829 if ($task->duration_effective) {
2839 $out .=
'<a href="'.$url.
'" >';
2840 $out .=
'<span title="'.$langs->trans(
'PlannedWorkload').
'" >';
2841 if ($task->planned_workload) {
2853 $out .=
' <div class="progress sm '.$spaced.
'">';
2854 $diffval = floatval($task->progress) - floatval($progressCalculated);
2855 if ($diffval >= 0) {
2857 $out .=
' <div class="progress-bar '.$progressBarClass.
'" style="width: '.floatval($task->progress).
'%" title="'.floatval($task->progress).
'%">';
2858 if (!empty($task->progress)) {
2859 $out .=
' <div class="progress-bar progress-bar-consumed" style="width: '.floatval($progressCalculated / $task->progress * 100).
'%" title="'.floatval($progressCalculated).
'%"></div>';
2864 $out .=
' <div class="progress-bar progress-bar-consumed-late" style="width: '.floatval($progressCalculated).
'%" title="'.floatval($progressCalculated).
'%">';
2865 $out .=
' <div class="progress-bar '.$progressBarClass.
'" style="width: '.($task->progress ? floatval($task->progress / $progressCalculated * 100).
'%' :
'1px').
'" title="'.floatval($task->progress).
'%"></div>';
2884 global $conf, $langs;
2888 if ($task->progress !=
'') {
2892 $badgeClass =
'badge ';
2893 if ($task->planned_workload) {
2894 $progressCalculated = round(100 * floatval($task->duration_effective) / floatval($task->planned_workload), 2);
2897 $warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
2899 if (floatval($progressCalculated) > floatval($task->progress * $warningRatio)) {
2900 $badgeClass .=
'badge-danger';
2901 if (empty($tooltip)) {
2902 $tooltip = $task->progress.
'% < '.$langs->trans(
"TimeConsumed").
' '.$progressCalculated.
'%';
2904 } elseif (floatval($progressCalculated) > floatval($task->progress)) {
2905 $badgeClass .=
'badge-warning';
2906 if (empty($tooltip)) {
2907 $tooltip = $task->progress.
'% < '.$langs->trans(
"TimeConsumed").
' '.$progressCalculated.
'%';
2910 $badgeClass .=
'badge-success';
2911 if (empty($tooltip)) {
2912 $tooltip = $task->progress.
'% >= '.$langs->trans(
"TimeConsumed").
' '.$progressCalculated.
'%';
2919 if (!empty($tooltip)) {
2920 $badgeClass .=
' classfortooltip';
2921 $title =
'title="'.dol_htmlentities($tooltip).
'"';
2924 if (empty($label)) {
2925 $label = $task->progress.
' %';
2928 if (!empty($label)) {
2929 $out =
'<span class="'.$badgeClass.
'" '.$title.
' >'.$label.
'</span>';
Class for ConferenceOrBooth.
static count($dbs, $objecttype, $objectid)
Return nb of links.
Class to manage projects.
Class to manage Dolibarr users.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.
print *****$script_file(".$version.") pid cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
print *****$script_file(".$version.") pid c cd cd cd description as p label as s rowid
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dol_htmlentities($string, $flags=ENT_QUOTES|ENT_SUBSTITUTE, $encoding='UTF-8', $double_encode=false)
Replace htmlentities functions.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
isModEnabled($module)
Is Dolibarr module enabled.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
dol_setcache($memoryid, $data, $expire=0)
Save data into a memory area shared by all users, all sessions on server.
dol_getcache($memoryid)
Read a memory area shared by all users, all sessions on server.
Class to generate the form for creating a new ticket.
projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak=0, $arrayfields=array(), $extrafields=null)
Output a task line into a pertime intput mode.
task_prepare_head($object)
Prepare array with list of tabs.
projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId='', $addordertick=0, $projectidfortotallink=0, $filterprogresscalc='', $showbilltime=0, $arrayfields=array())
Show task lines with a particular parent.
searchTaskInChild(&$inc, $parent, &$lines, &$taskrole)
Search in task lines with a particular parent if there is a task for a particular user (in taskrole)
getTaskProgressView($task, $label=true, $progressNumber=true, $hideOnProgressNull=false, $spaced=false)
projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak=0)
Output a task line into a pertime intput mode.
project_timesheet_prepare_head($mode, $fuser=null)
Prepare array with list of tabs.
project_admin_prepare_head()
Prepare array with list of tabs.
getTaskProgressBadge($task, $label='', $tooltip='')
projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, &$isavailable, $oldprojectforbreak=0, $arrayfields=array(), $extrafields=null)
Output a task line into a perday intput mode.
project_prepare_head(Project $project, $moreparam='')
Prepare array with list of tabs.