27 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
38 global $db, $langs, $conf, $user;
43 $head[$h][0] = DOL_URL_ROOT.
'/projet/card.php?id='.$project->id;
44 $head[$h][1] = $langs->trans(
"Project");
45 $head[$h][2] =
'project';
49 $head[$h][0] = DOL_URL_ROOT.
'/projet/contact.php?id='.$project->id;
50 $head[$h][1] = $langs->trans(
"ProjectContact");
51 if ($nbContact > 0) $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
52 $head[$h][2] =
'contact';
55 if (empty($conf->global->PROJECT_HIDE_TASKS))
58 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks.php?id='.$project->id;
59 $head[$h][1] = $langs->trans(
"Tasks");
61 require_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
62 $taskstatic =
new Task($db);
63 $nbTasks = count($taskstatic->getTasksArray(0, 0, $project->id, 0, 0));
64 if ($nbTasks > 0) $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbTasks).
'</span>';
65 $head[$h][2] =
'tasks';
69 $sql =
"SELECT t.rowid";
72 $sql .=
" FROM ".MAIN_DB_PREFIX.
"projet_task_time as t, ".MAIN_DB_PREFIX.
"projet_task as pt";
73 $sql .=
" WHERE t.fk_task = pt.rowid";
74 $sql .=
" AND pt.fk_projet =".$project->id;
78 $obj = $db->fetch_object(
$resql);
79 if ($obj) $nbTimeSpent = 1;
82 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/time.php?withproject=1&projectid='.$project->id;
83 $head[$h][1] = $langs->trans(
"TimeSpent");
84 if ($nbTimeSpent > 0) $head[$h][1] .=
'<span class="badge marginleftonlyshort">...</span>';
85 $head[$h][2] =
'timespent';
89 if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))
90 || !empty($conf->propal->enabled) || !empty($conf->commande->enabled)
91 || !empty($conf->facture->enabled) || !empty($conf->contrat->enabled)
92 || !empty($conf->ficheinter->enabled) || !empty($conf->agenda->enabled) || !empty($conf->deplacement->enabled))
96 if (!empty($conf->propal->enabled)) $count += $project->
getElementCount(
'propal',
'propal');
97 if (!empty($conf->commande->enabled)) $count += $project->
getElementCount(
'order',
'commande');
98 if (!empty($conf->facture->enabled)) $count += $project->
getElementCount(
'invoice',
'facture');
99 if (!empty($conf->facture->enabled)) $count += $project->
getElementCount(
'invoice_predefined',
'facture_rec');
100 if (!empty($conf->supplier_proposal->enabled)) $count += $project->
getElementCount(
'proposal_supplier',
'supplier_proposal');
101 if (!empty($conf->supplier_order->enabled)) $count += $project->
getElementCount(
'order_supplier',
'commande_fournisseur');
102 if (!empty($conf->supplier_invoice->enabled)) $count += $project->
getElementCount(
'invoice_supplier',
'facture_fourn');
103 if (!empty($conf->contrat->enabled)) $count += $project->
getElementCount(
'contract',
'contrat');
104 if (!empty($conf->ficheinter->enabled)) $count += $project->
getElementCount(
'intervention',
'fichinter');
105 if (!empty($conf->expedition->enabled)) $count += $project->
getElementCount(
'shipping',
'expedition');
106 if (!empty($conf->mrp->enabled)) $count += $project->
getElementCount(
'mrp',
'mrp_mo',
'fk_project');
107 if (!empty($conf->deplacement->enabled)) $count += $project->
getElementCount(
'trip',
'deplacement');
108 if (!empty($conf->expensereport->enabled)) $count += $project->
getElementCount(
'expensereport',
'expensereport');
109 if (!empty($conf->don->enabled)) $count += $project->
getElementCount(
'donation',
'don');
110 if (!empty($conf->loan->enabled)) $count += $project->
getElementCount(
'loan',
'loan');
111 if (!empty($conf->tax->enabled)) $count += $project->
getElementCount(
'chargesociales',
'chargesociales');
112 if (!empty($conf->projet->enabled)) $count += $project->
getElementCount(
'project_task',
'projet_task');
113 if (!empty($conf->stock->enabled)) $count += $project->
getElementCount(
'stock_mouvement',
'stock');
114 if (!empty($conf->salaries->enabled)) $count += $project->
getElementCount(
'salaries',
'payment_salary');
115 if (!empty($conf->banque->enabled)) $count += $project->
getElementCount(
'variouspayment',
'payment_various');
117 $head[$h][0] = DOL_URL_ROOT.
'/projet/element.php?id='.$project->id;
118 $head[$h][1] = $langs->trans(
"ProjectOverview");
119 if ($count > 0) $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$count.
'</span>';
120 $head[$h][2] =
'element';
131 if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
134 if (!empty($project->note_private)) $nbNote++;
135 if (!empty($project->note_public)) $nbNote++;
136 $head[$h][0] = DOL_URL_ROOT.
'/projet/note.php?id='.$project->id;
137 $head[$h][1] = $langs->trans(
'Notes');
138 if ($nbNote > 0) $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
139 $head[$h][2] =
'notes';
143 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
144 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
146 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
147 $nbLinks =
Link::count($db, $project->element, $project->id);
148 $head[$h][0] = DOL_URL_ROOT.
'/projet/document.php?id='.$project->id;
149 $head[$h][1] = $langs->trans(
'Documents');
150 if (($nbFiles + $nbLinks) > 0) $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
151 $head[$h][2] =
'document';
155 if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT))
158 $head[$h][0] = DOL_URL_ROOT.
'/projet/comment.php?id='.$project->id;
159 $head[$h][1] = $langs->trans(
"CommentLink");
160 if ($nbComments > 0) $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbComments.
'</span>';
161 $head[$h][2] =
'project_comment';
165 $head[$h][0] = DOL_URL_ROOT.
'/projet/info.php?id='.$project->id;
166 $head[$h][1] .= $langs->trans(
"Events");
167 if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read)))
170 $head[$h][1] .= $langs->trans(
"Agenda");
172 $head[$h][2] =
'agenda';
189 global $db, $langs, $conf, $user;
193 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/task.php?id='.$object->id.(GETPOST(
'withproject') ?
'&withproject=1' :
'');
194 $head[$h][1] = $langs->trans(
"Task");
195 $head[$h][2] =
'task_task';
198 $nbContact = count($object->liste_contact(-1,
'internal')) + count($object->liste_contact(-1,
'external'));
199 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/contact.php?id='.$object->id.(GETPOST(
'withproject') ?
'&withproject=1' :
'');
200 $head[$h][1] = $langs->trans(
"TaskRessourceLinks");
201 if ($nbContact > 0) $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
202 $head[$h][2] =
'task_contact';
207 $sql =
"SELECT t.rowid";
210 $sql .=
" FROM ".MAIN_DB_PREFIX.
"projet_task_time as t";
211 $sql .=
" WHERE t.fk_task =".$object->id;
212 $resql = $db->query($sql);
215 $obj = $db->fetch_object(
$resql);
216 if ($obj) $nbTimeSpent = 1;
219 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$object->id.(GETPOST(
'withproject') ?
'&withproject=1' :
'');
220 $head[$h][1] = $langs->trans(
"TimeSpent");
221 if ($nbTimeSpent > 0) $head[$h][1] .=
'<span class="badge marginleftonlyshort">...</span>';
222 $head[$h][2] =
'task_time';
231 if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
234 if (!empty($object->note_private)) $nbNote++;
235 if (!empty($object->note_public)) $nbNote++;
236 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/note.php?id='.$object->id.(GETPOST(
'withproject') ?
'&withproject=1' :
'');
237 $head[$h][1] = $langs->trans(
'Notes');
238 if ($nbNote > 0) $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
239 $head[$h][2] =
'task_notes';
243 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/document.php?id='.$object->id.(GETPOST(
'withproject') ?
'&withproject=1' :
'');
245 include_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
246 include_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
247 $nbFiles = count(
dol_dir_list($filesdir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
248 $nbLinks =
Link::count($db, $object->element, $object->id);
249 $head[$h][1] = $langs->trans(
'Documents');
250 if (($nbFiles + $nbLinks) > 0) $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
251 $head[$h][2] =
'task_document';
255 if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK))
257 $nbComments = $object->getNbComments();
258 $head[$h][0] = DOL_URL_ROOT.
'/projet/tasks/comment.php?id='.$object->id.(GETPOST(
'withproject') ?
'&withproject=1' :
'');
259 $head[$h][1] = $langs->trans(
"CommentLink");
260 if ($nbComments > 0) $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbComments.
'</span>';
261 $head[$h][2] =
'task_comment';
279 global $langs, $conf, $user;
286 $param .= ($mode ?
'&mode='.$mode :
'');
287 if (is_object($fuser) && $fuser->id > 0 && $fuser->id != $user->id) $param .=
'&search_usertoprocessid='.$fuser->id;
289 if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERMONTH))
291 $head[$h][0] = DOL_URL_ROOT.
"/projet/activity/permonth.php".($param ?
'?'.$param :
'');
292 $head[$h][1] = $langs->trans(
"InputPerMonth");
293 $head[$h][2] =
'inputpermonth';
297 if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERWEEK))
299 $head[$h][0] = DOL_URL_ROOT.
"/projet/activity/perweek.php".($param ?
'?'.$param :
'');
300 $head[$h][1] = $langs->trans(
"InputPerWeek");
301 $head[$h][2] =
'inputperweek';
305 if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERTIME))
307 $head[$h][0] = DOL_URL_ROOT.
"/projet/activity/perday.php".($param ?
'?'.$param :
'');
308 $head[$h][1] = $langs->trans(
"InputPerDay");
309 $head[$h][2] =
'inputperday';
336 global $langs, $conf, $user;
342 $head[$h][0] = DOL_URL_ROOT.
"/projet/admin/project.php";
343 $head[$h][1] = $langs->trans(
"Projects");
344 $head[$h][2] =
'project';
349 $head[$h][0] = DOL_URL_ROOT.
"/projet/admin/project_extrafields.php";
350 $head[$h][1] = $langs->trans(
"ExtraFieldsProject");
351 $head[$h][2] =
'attributes';
354 $head[$h][0] = DOL_URL_ROOT.
'/projet/admin/project_task_extrafields.php';
355 $head[$h][1] = $langs->trans(
"ExtraFieldsProjectTask");
356 $head[$h][2] =
'attributes_task';
383 function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId =
'', $addordertick = 0, $projectidfortotallink = 0, $filterprogresscalc =
'', $showbilltime = 0, $arrayfields = array())
385 global $user, $langs, $conf, $db, $hookmanager;
386 global $projectstatic, $taskstatic, $extrafields;
390 $projectsArrayId = explode(
',', $projectsListId);
391 if ($filterprogresscalc !==
'') {
392 foreach ($lines as $key=>$line) {
393 if (!empty($line->planned_workload) && !empty($line->duration)) {
394 $filterprogresscalc = str_replace(
' = ',
' == ', $filterprogresscalc);
395 if (!eval($filterprogresscalc)) {
400 $lines = array_values($lines);
402 $numlines = count($lines);
405 global $total_projectlinesa_spent, $total_projectlinesa_planned, $total_projectlinesa_spent_if_planned, $total_projectlinesa_declared_if_planned, $total_projectlinesa_tobill, $total_projectlinesa_billed;
409 $total_projectlinesa_spent = 0;
410 $total_projectlinesa_planned = 0;
411 $total_projectlinesa_spent_if_planned = 0;
412 $total_projectlinesa_declared_if_planned = 0;
413 $total_projectlinesa_tobill = 0;
414 $total_projectlinesa_billed = 0;
417 for ($i = 0; $i < $numlines; $i++)
419 if ($parent == 0 && $level >= 0) $level = 0;
424 if ($lines[$i]->fk_parent == $parent || $level < 0)
431 if (is_array($taskrole))
434 if (!isset($taskrole[$lines[$i]->
id]) && $lines[$i]->
id != $lines[$i]->fk_parent)
437 $foundtaskforuserdeeper = 0;
440 if ($foundtaskforuserdeeper > 0)
450 if (empty($user->rights->projet->all->lire))
453 if (!in_array($lines[$i]->fk_project, $projectsArrayId))
466 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
469 $lastprojectid = $lines[$i]->fk_project;
472 print '<tr class="oddeven" id="row-'.$lines[$i]->id.
'">'.
"\n";
474 $projectstatic->id = $lines[$i]->fk_project;
475 $projectstatic->ref = $lines[$i]->projectref;
476 $projectstatic->public = $lines[$i]->public;
477 $projectstatic->title = $lines[$i]->projectlabel;
478 $projectstatic->usage_bill_time = $lines[$i]->usage_bill_time;
479 $projectstatic->status = $lines[$i]->projectstatus;
481 $taskstatic->id = $lines[$i]->id;
482 $taskstatic->ref = $lines[$i]->ref;
483 $taskstatic->label = ($taskrole[$lines[$i]->id] ? $langs->trans(
"YourRole").
': '.$taskrole[$lines[$i]->id] :
'');
484 $taskstatic->projectstatus = $lines[$i]->projectstatus;
485 $taskstatic->progress = $lines[$i]->progress;
486 $taskstatic->fk_statut = $lines[$i]->status;
487 $taskstatic->date_start = $lines[$i]->date_start;
488 $taskstatic->date_end = $lines[$i]->date_end;
489 $taskstatic->datee = $lines[$i]->date_end;
490 $taskstatic->planned_workload = $lines[$i]->planned_workload;
491 $taskstatic->duration_effective = $lines[$i]->duration;
499 if ($lines[$i]->
public || in_array($lines[$i]->fk_project, $projectsArrayId) || !empty($user->rights->projet->all->lire))
print $projectstatic->getNomUrl(1);
500 else print $projectstatic->getNomUrl(1,
'nolink');
506 $projectstatic->statut = $lines[$i]->projectstatus;
507 print $projectstatic->getLibStatut(2);
512 if (count($arrayfields) > 0 && !empty($arrayfields[
't.ref'][
'checked'])) {
513 print '<td class="nowraponall">';
514 if ($showlineingray) {
515 print '<i>'.img_object(
'',
'projecttask').
' '.$lines[$i]->ref.
'</i>';
517 print $taskstatic->getNomUrl(1,
'withproject');
523 if (count($arrayfields) > 0 && !empty($arrayfields[
't.label'][
'checked'])) {
528 for ($k = 0; $k < $level; $k++) {
529 print '<div class="marginleftonly">';
531 print $lines[$i]->label;
532 for ($k = 0; $k < $level; $k++) {
541 if (count($arrayfields) > 0 && !empty($arrayfields[
't.description'][
'checked'])) {
543 print $lines[$i]->description;
548 if (count($arrayfields) > 0 && !empty($arrayfields[
't.dateo'][
'checked'])) {
549 print '<td class="center">';
555 if (count($arrayfields) > 0 && !empty($arrayfields[
't.datee'][
'checked'])) {
556 print '<td class="center">';
558 if ($taskstatic->hasDelay())
563 $plannedworkloadoutputformat =
'allhourmin';
564 $timespentoutputformat =
'allhourmin';
565 if (!empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) $plannedworkloadoutputformat = $conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT;
566 if (!empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) $timespentoutputformat = $conf->global->PROJECT_TIME_SPENT_FORMAT;
569 if (count($arrayfields) > 0 && !empty($arrayfields[
't.planned_workload'][
'checked'])) {
570 print '<td class="right">';
571 $fullhour =
convertSecondToTime($lines[$i]->planned_workload, $plannedworkloadoutputformat);
573 if ($lines[$i]->planned_workload !=
'') {
583 if (count($arrayfields) > 0 && !empty($arrayfields[
't.duration_effective'][
'checked'])) {
584 print '<td class="right">';
587 else print '<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$lines[$i]->id.($showproject ?
'' :
'&withproject=1').
'">';
588 if ($lines[$i]->duration)
598 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress_calculated'][
'checked'])) {
599 print '<td class="right">';
600 if ($lines[$i]->planned_workload || $lines[$i]->duration) {
601 if ($lines[$i]->planned_workload)
602 print round(100 * $lines[$i]->duration / $lines[$i]->planned_workload, 2).
' %';
603 else print '<span class="opacitymedium">'.$langs->trans(
'WorkloadNotDefined').
'</span>';
609 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress'][
'checked'])) {
610 print '<td class="right">';
611 if ($lines[$i]->progress !=
'') {
618 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress_summary'][
'checked'])) {
619 print '<td class="right">';
620 if ($lines[$i]->progress !=
'' && $lines[$i]->duration) {
629 if (count($arrayfields) > 0 && !empty($arrayfields[
't.tobill'][
'checked'])) {
630 print '<td class="right">';
631 if ($lines[$i]->usage_bill_time) {
633 $total_projectlinesa_tobill += $lines[$i]->tobill;
635 print '<span class="opacitymedium">'.$langs->trans(
"NA").
'</span>';
641 if (count($arrayfields) > 0 && !empty($arrayfields[
't.billed'][
'checked'])) {
642 print '<td class="right">';
643 if ($lines[$i]->usage_bill_time) {
645 $total_projectlinesa_billed += $lines[$i]->billed;
647 print '<span class="opacitymedium">'.$langs->trans(
"NA").
'</span>';
654 if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST))
657 foreach (array(
'internal',
'external') as $source)
659 $tab = $lines[$i]->liste_contact(-1, $source);
662 foreach ($tab as $contacttask) {
664 if ($source ==
'internal') $c =
new User($db);
666 $c->fetch($contacttask[
'id']);
667 print $c->getNomUrl(1).
' ('.$contacttask[
'libelle'].
')<br>';
675 $extrafieldsobjectkey = $taskstatic->table_element;
677 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
679 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$lines[$i]);
680 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
681 print $hookmanager->resPrint;
684 print '<td class="tdlineupdown center"></td>';
688 if (!$showlineingray) $inc++;
693 if ($lines[$i]->
id)
projectLinesa($inc, $lines[$i]->
id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick, $projectidfortotallink, $filterprogresscalc, $showbilltime, $arrayfields);
697 $total_projectlinesa_spent += $lines[$i]->duration;
698 $total_projectlinesa_planned += $lines[$i]->planned_workload;
699 if ($lines[$i]->planned_workload) $total_projectlinesa_spent_if_planned += $lines[$i]->duration;
700 if ($lines[$i]->planned_workload) $total_projectlinesa_declared_if_planned += $lines[$i]->planned_workload * $lines[$i]->progress / 100;
707 if (($total_projectlinesa_planned > 0 || $total_projectlinesa_spent > 0 || $total_projectlinesa_tobill > 0 || $total_projectlinesa_billed > 0)
710 print '<tr class="liste_total nodrag nodrop">';
711 print '<td class="liste_total">'.$langs->trans(
"Total").
'</td>';
712 if ($showproject)
print '<td></td><td></td>';
713 if (count($arrayfields) > 0 && !empty($arrayfields[
't.label'][
'checked']))
print '<td></td>';
714 if (count($arrayfields) > 0 && !empty($arrayfields[
't.dateo'][
'checked']))
print '<td></td>';
715 if (count($arrayfields) > 0 && !empty($arrayfields[
't.datee'][
'checked']))
print '<td></td>';
716 if (count($arrayfields) > 0 && !empty($arrayfields[
't.planned_workload'][
'checked'])) {
717 print '<td class="nowrap liste_total right">';
721 if (count($arrayfields) > 0 && !empty($arrayfields[
't.duration_effective'][
'checked'])) {
722 print '<td class="nowrap liste_total right">';
723 if ($projectidfortotallink > 0)
724 print '<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?projectid='.$projectidfortotallink.($showproject ?
'' :
'&withproject=1').
'">';
726 if ($projectidfortotallink > 0)
731 if ($total_projectlinesa_planned) {
732 $totalAverageDeclaredProgress = round(100 * $total_projectlinesa_declared_if_planned / $total_projectlinesa_planned, 2);
733 $totalCalculatedProgress = round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned, 2);
736 $warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
739 $progressBarClass =
'progress-bar-info';
740 $badgeClass =
'badge ';
742 if ($totalCalculatedProgress > $totalAverageDeclaredProgress) {
743 $progressBarClass =
'progress-bar-danger';
744 $badgeClass .=
'badge-danger';
745 } elseif ($totalCalculatedProgress * $warningRatio >= $totalAverageDeclaredProgress) {
746 $progressBarClass =
'progress-bar-warning';
747 $badgeClass .=
'badge-warning';
749 $progressBarClass =
'progress-bar-success';
750 $badgeClass .=
'badge-success';
754 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress_calculated'][
'checked'])) {
755 print '<td class="nowrap liste_total right">';
756 if ($total_projectlinesa_planned)
757 print $totalCalculatedProgress.
' %';
760 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress'][
'checked'])) {
761 print '<td class="nowrap liste_total right">';
762 if ($total_projectlinesa_planned)
763 print '<span class="'.$badgeClass.
'" >'.$totalAverageDeclaredProgress.
' %</span>';
769 if (count($arrayfields) > 0 && !empty($arrayfields[
't.progress_summary'][
'checked'])) {
770 print '<td class="right">';
771 if ($total_projectlinesa_planned) {
773 print ' <div class="progress sm" title="'.$totalAverageDeclaredProgress.
'%" >';
774 print ' <div class="progress-bar '.$progressBarClass.
'" style="width: '.$totalAverageDeclaredProgress.
'%"></div>';
783 if (count($arrayfields) > 0 && !empty($arrayfields[
't.tobill'][
'checked'])) {
784 print '<td class="nowrap liste_total right">';
788 if (count($arrayfields) > 0 && !empty($arrayfields[
't.billed'][
'checked'])) {
789 print '<td class="nowrap liste_total right">';
795 if (!empty($conf->global->PROJECT_SHOW_CONTACTS_IN_LIST))
799 print '<td class=""></td>';
824 function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak = 0)
826 global $conf, $db, $user, $langs;
827 global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
830 $totalforeachline = array();
831 $workloadforid = array();
832 $lineswithoutlevel0 = array();
834 $numlines = count($lines);
839 for ($i = 0; $i < $numlines; $i++)
841 if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[] = $lines[$i];
845 if (empty($oldprojectforbreak))
847 $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1);
851 for ($i = 0; $i < $numlines; $i++)
853 if ($parent == 0) $level = 0;
858 if (empty($mine) || !empty($tasksrole[$lines[$i]->
id]))
863 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
865 $lastprojectid = $lines[$i]->fk_project;
868 $projectstatic->id = $lines[$i]->fk_project;
872 if (empty($workloadforid[$projectstatic->id]))
876 $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id);
877 $workloadforid[$projectstatic->id] = 1;
881 $projectstatic->id = $lines[$i]->fk_project;
882 $projectstatic->ref = $lines[$i]->project_ref;
883 $projectstatic->title = $lines[$i]->project_label;
884 $projectstatic->public = $lines[$i]->public;
885 $projectstatic->status = $lines[$i]->project_status;
887 $taskstatic->id = $lines[$i]->task_id;
888 $taskstatic->ref = ($lines[$i]->task_ref ? $lines[$i]->task_ref : $lines[$i]->task_id);
889 $taskstatic->label = $lines[$i]->task_label;
890 $taskstatic->date_start = $lines[$i]->date_start;
891 $taskstatic->date_end = $lines[$i]->date_end;
893 $thirdpartystatic->id = $lines[$i]->socid;
894 $thirdpartystatic->name = $lines[$i]->thirdparty_name;
895 $thirdpartystatic->email = $lines[$i]->thirdparty_email;
897 if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id))
899 print '<tr class="oddeven trforbreak nobold">'.
"\n";
900 print '<td colspan="11">';
901 print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
902 if ($projectstatic->title)
905 print $projectstatic->title;
911 if ($oldprojectforbreak != -1) $oldprojectforbreak = $projectstatic->id;
913 print '<tr class="oddeven">'.
"\n";
924 if ($oldprojectforbreak == -1)
926 print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
927 print '<br>'.$projectstatic->title;
932 print '<td class="tdoverflowmax100">';
933 if ($thirdpartystatic->id > 0)
print $thirdpartystatic->getNomUrl(1,
'project', 10);
938 print '<!-- Task id = '.$lines[$i]->id.
' -->';
939 for ($k = 0; $k < $level; $k++)
print " ";
940 print $taskstatic->getNomUrl(1,
'withproject',
'time');
943 for ($k = 0; $k < $level; $k++)
print " ";
944 print $taskstatic->label;
951 print '<td class="center">';
955 $disabledproject = 1; $disabledtask = 1;
960 if ($lines[$i]->
public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer)
962 $disabledproject = 0;
966 if ($restricteditformytask && empty($tasksrole[$lines[$i]->
id]))
972 print '<td class="nowrap center">';
977 if (!$isavailable[$preselectedday][
'morning'] && !$isavailable[$preselectedday][
'afternoon']) $cssonholiday .=
'onholidayallday ';
978 elseif (!$isavailable[$preselectedday][
'morning']) $cssonholiday .=
'onholidaymorning ';
979 elseif (!$isavailable[$preselectedday][
'afternoon']) $cssonholiday .=
'onholidayafternoon ';
982 print '<td class="duration'.($cssonholiday ?
' '.$cssonholiday :
'').
' center">';
984 $dayWorkLoad = $lines[$i]->timespent_duration;
985 $totalforeachline[$preselectedday] += $lines[$i]->timespent_duration;
988 if ($dayWorkLoad > 0) $alreadyspent =
convertSecondToTime($lines[$i]->timespent_duration,
'allhourmin');
992 $modeinput =
'hours';
994 print '<script type="text/javascript">';
995 print "jQuery(document).ready(function () {\n";
996 print " jQuery('.inputhour, .inputminute').bind('keyup', function(e) { updateTotal(0, '".$modeinput.
"') });";
1003 print '<td class="center">';
1004 print '<textarea name="'.$lines[$i]->id.
'note" rows="'.ROWS_2.
'" id="'.$lines[$i]->id.
'note"'.($disabledtask ?
' disabled="disabled"' :
'').
'>';
1005 print $lines[$i]->timespent_note;
1006 print '</textarea>';
1010 print '<td class="right">';
1030 return $totalforeachline;
1053 function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak = 0, $arrayfields = array(), $extrafields = null)
1055 global $conf, $db, $user, $langs;
1056 global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
1059 $totalforeachday = array();
1060 $workloadforid = array();
1061 $lineswithoutlevel0 = array();
1063 $numlines = count($lines);
1068 for ($i = 0; $i < $numlines; $i++)
1070 if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[] = $lines[$i];
1074 if (empty($oldprojectforbreak))
1076 $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1);
1080 for ($i = 0; $i < $numlines; $i++)
1082 if ($parent == 0) $level = 0;
1084 if ($lines[$i]->fk_task_parent == $parent)
1089 if (empty($mine) || !empty($tasksrole[$lines[$i]->
id]))
1093 if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->
id]))
1099 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
1101 $lastprojectid = $lines[$i]->fk_project;
1102 if ($preselectedday)
1104 $projectstatic->id = $lines[$i]->fk_project;
1108 if (empty($workloadforid[$projectstatic->id]))
1110 if ($preselectedday)
1112 $projectstatic->loadTimeSpent($preselectedday, 0, $fuser->id);
1113 $workloadforid[$projectstatic->id] = 1;
1117 $projectstatic->id = $lines[$i]->fk_project;
1118 $projectstatic->ref = $lines[$i]->projectref;
1119 $projectstatic->title = $lines[$i]->projectlabel;
1120 $projectstatic->public = $lines[$i]->public;
1122 $taskstatic->id = $lines[$i]->id;
1123 $taskstatic->ref = ($lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id);
1124 $taskstatic->label = $lines[$i]->label;
1125 $taskstatic->date_start = $lines[$i]->date_start;
1126 $taskstatic->date_end = $lines[$i]->date_end;
1128 $thirdpartystatic->id = $lines[$i]->socid;
1129 $thirdpartystatic->name = $lines[$i]->thirdparty_name;
1130 $thirdpartystatic->email = $lines[$i]->thirdparty_email;
1132 if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id))
1135 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) $addcolspan++;
1136 if (!empty($arrayfields[
't.progress'][
'checked'])) $addcolspan++;
1137 foreach ($arrayfields as $key => $val)
1139 if ($val[
'checked'] && substr($key, 0, 5) ==
'efpt.') $addcolspan++;
1142 print '<tr class="oddeven trforbreak nobold">'.
"\n";
1143 print '<td colspan="'.(7 + $addcolspan).
'">';
1144 print $projectstatic->getNomUrl(1,
'', 0,
'<strong>'.$langs->transnoentitiesnoconv(
"YourRole").
':</strong> '.$projectsrole[$lines[$i]->fk_project]);
1145 if ($thirdpartystatic->id > 0)
print ' - '.$thirdpartystatic->getNomUrl(1);
1146 if ($projectstatic->title)
1149 print '<span class="secondary">'.$projectstatic->title.
'</span>';
1216 if ($oldprojectforbreak != -1) $oldprojectforbreak = $projectstatic->id;
1218 print '<tr class="oddeven" data-taskid="'.$lines[$i]->id.
'">'.
"\n";
1228 if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT))
1231 if ($oldprojectforbreak == -1)
print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
1236 if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT))
1238 print '<td class="tdoverflowmax100">';
1239 if ($thirdpartystatic->id > 0)
print $thirdpartystatic->getNomUrl(1,
'project', 10);
1245 print '<!-- Task id = '.$lines[$i]->id.
' -->';
1246 for ($k = 0; $k < $level; $k++)
print '<div class="marginleftonly">';
1247 print $taskstatic->getNomUrl(1,
'withproject',
'time');
1250 print '<span class="opacitymedium">'.$taskstatic->label.
'</a>';
1251 for ($k = 0; $k < $level; $k++)
print "</div>";
1255 $extrafieldsobjectkey =
'projet_task';
1256 $extrafieldsobjectprefix =
'efpt.';
1257 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1260 if (!empty($arrayfields[
't.planned_workload'][
'checked']))
1262 print '<td class="leftborder plannedworkload right">';
1269 if (!empty($arrayfields[
't.progress'][
'checked']))
1271 print '<td class="right">';
1272 print $formother->select_percent($lines[$i]->progress, $lines[$i]->
id.
'progress');
1277 print '<td class="right">';
1279 if ($lines[$i]->duration)
1281 print '<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$lines[$i]->id.
'">';
1284 }
else print '--:--';
1288 print '<td class="right">';
1289 $tmptimespent = $taskstatic->getSummaryOfTimeSpent($fuser->id);
1294 $disabledproject = 1; $disabledtask = 1;
1299 if ($lines[$i]->
public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer)
1301 $disabledproject = 0;
1305 if ($restricteditformytask && empty($tasksrole[$lines[$i]->
id]))
1311 print '<td class="nowrap leftborder center">';
1312 $tableCell = $form->selectDate($preselectedday, $lines[$i]->
id, 1, 1, 2,
"addtime", 0, 0, $disabledtask);
1317 if (!$isavailable[$preselectedday][
'morning'] && !$isavailable[$preselectedday][
'afternoon']) $cssonholiday .=
'onholidayallday ';
1318 elseif (!$isavailable[$preselectedday][
'morning']) $cssonholiday .=
'onholidaymorning ';
1319 elseif (!$isavailable[$preselectedday][
'afternoon']) $cssonholiday .=
'onholidayafternoon ';
1324 $idw = ($tmparray[
'wday'] - (empty($conf->global->MAIN_START_WEEK) ? 0 : 1));
1325 global $numstartworkingday, $numendworkingday;
1327 if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday))
1329 $cssweekend =
'weekend';
1333 print '<td class="center duration'.($cssonholiday ?
' '.$cssonholiday :
'').($cssweekend ?
' '.$cssweekend :
'').
'">';
1334 $dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id];
1335 $totalforeachday[$preselectedday] += $dayWorkLoad;
1343 $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>';
1344 $tableCell .=
'<span class="hideonsmartphone"> + </span>';
1346 $tableCell .= $form->select_duration($lines[$i]->
id.
'duration',
'', $disabledtask,
'text', 0, 1);
1350 $modeinput =
'hours';
1352 print '<script type="text/javascript">';
1353 print "jQuery(document).ready(function () {\n";
1354 print " jQuery('.inputhour, .inputminute').bind('keyup', function(e) { updateTotal(0, '".$modeinput.
"') });";
1361 print '<td class="center">';
1362 print '<textarea name="'.$lines[$i]->id.
'note" rows="'.ROWS_2.
'" id="'.$lines[$i]->id.
'note"'.($disabledtask ?
' disabled="disabled"' :
'').
'>';
1363 print '</textarea>';
1367 print '<td class="right">';
1368 if ((!$lines[$i]->
public) && $disabledproject)
print $form->textwithpicto(
'', $langs->trans(
"UserIsNotContactOfProject"));
1369 elseif ($disabledtask)
1371 $titleassigntask = $langs->trans(
"AssignTaskToMe");
1372 if ($fuser->id != $user->id) $titleassigntask = $langs->trans(
"AssignTaskToUser",
'...');
1374 print $form->textwithpicto(
'', $langs->trans(
"TaskIsNotAssignedToUser", $titleassigntask));
1383 if ($lines[$i]->
id > 0)
1387 $ret =
projectLinesPerDay($inc, $lines[$i]->
id, $fuser, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $isavailable, $oldprojectforbreak, $arrayfields, $extrafields);
1390 foreach ($ret as $key => $val)
1392 $totalforeachday[$key] += $val;
1403 return $totalforeachday;
1426 function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, &$isavailable, $oldprojectforbreak = 0, $arrayfields = array(), $extrafields = null)
1428 global $conf, $db, $user, $langs;
1429 global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
1431 $numlines = count($lines);
1434 $workloadforid = array();
1435 $totalforeachday = array();
1436 $lineswithoutlevel0 = array();
1441 for ($i = 0; $i < $numlines; $i++)
1443 if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[] = $lines[$i];
1449 if (empty($oldprojectforbreak))
1451 $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1);
1454 for ($i = 0; $i < $numlines; $i++)
1456 if ($parent == 0) $level = 0;
1458 if ($lines[$i]->fk_task_parent == $parent)
1463 if (empty($mine) || !empty($tasksrole[$lines[$i]->
id]))
1467 if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->
id]))
1473 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
1475 $lastprojectid = $lines[$i]->fk_project;
1476 $projectstatic->id = $lines[$i]->fk_project;
1481 if (empty($workloadforid[$projectstatic->id]))
1483 $projectstatic->loadTimeSpent($firstdaytoshow, 0, $fuser->id);
1484 $workloadforid[$projectstatic->id] = 1;
1489 $projectstatic->id = $lines[$i]->fk_project;
1490 $projectstatic->ref = $lines[$i]->projectref;
1491 $projectstatic->title = $lines[$i]->projectlabel;
1492 $projectstatic->public = $lines[$i]->public;
1493 $projectstatic->thirdparty_name = $lines[$i]->thirdparty_name;
1495 $taskstatic->id = $lines[$i]->id;
1496 $taskstatic->ref = ($lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id);
1497 $taskstatic->label = $lines[$i]->label;
1498 $taskstatic->date_start = $lines[$i]->date_start;
1499 $taskstatic->date_end = $lines[$i]->date_end;
1501 $thirdpartystatic->id = $lines[$i]->thirdparty_id;
1502 $thirdpartystatic->name = $lines[$i]->thirdparty_name;
1503 $thirdpartystatic->email = $lines[$i]->thirdparty_email;
1505 if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id))
1508 if (!empty($arrayfields[
't.planned_workload'][
'checked'])) $addcolspan++;
1509 if (!empty($arrayfields[
't.progress'][
'checked'])) $addcolspan++;
1510 foreach ($arrayfields as $key => $val)
1512 if ($val[
'checked'] && substr($key, 0, 5) ==
'efpt.') $addcolspan++;
1515 print '<tr class="oddeven trforbreak nobold">'.
"\n";
1516 print '<td colspan="'.(11 + $addcolspan).
'">';
1517 print $projectstatic->getNomUrl(1,
'', 0,
'<strong>'.$langs->transnoentitiesnoconv(
"YourRole").
':</strong> '.$projectsrole[$lines[$i]->fk_project]);
1518 if ($thirdpartystatic->id > 0)
print ' - '.$thirdpartystatic->getNomUrl(1);
1519 if ($projectstatic->title)
1522 print '<span class="secondary">'.$projectstatic->title.
'</span>';
1589 if ($oldprojectforbreak != -1) $oldprojectforbreak = $projectstatic->id;
1591 print '<tr class="oddeven" data-taskid="'.$lines[$i]->id.
'">'.
"\n";
1601 if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT))
1603 print '<td class="nowrap">';
1604 if ($oldprojectforbreak == -1)
print $projectstatic->getNomUrl(1,
'', 0, $langs->transnoentitiesnoconv(
"YourRole").
': '.$projectsrole[$lines[$i]->fk_project]);
1609 if (!empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT))
1611 print '<td class="tdoverflowmax100">';
1612 if ($thirdpartystatic->id > 0)
print $thirdpartystatic->getNomUrl(1,
'project');
1617 print '<td class="nowrap">';
1618 print '<!-- Task id = '.$lines[$i]->id.
' -->';
1619 for ($k = 0; $k < $level; $k++)
print '<div class="marginleftonly">';
1620 print $taskstatic->getNomUrl(1,
'withproject',
'time');
1623 print '<span class="opacitymedium">'.$taskstatic->label.
'</span>';
1624 for ($k = 0; $k < $level; $k++)
print "</div>";
1628 $extrafieldsobjectkey =
'projet_task';
1629 $extrafieldsobjectprefix =
'efpt.';
1630 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1633 if (!empty($arrayfields[
't.planned_workload'][
'checked']))
1635 print '<td class="leftborder plannedworkload right">';
1641 if (!empty($arrayfields[
't.progress'][
'checked']))
1644 print '<td class="right">';
1645 print $formother->select_percent($lines[$i]->progress, $lines[$i]->
id.
'progress');
1650 print '<td class="right">';
1652 if ($lines[$i]->duration)
1654 print '<a href="'.DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$lines[$i]->id.
'">';
1657 }
else print '--:--';
1661 print '<td class="right">';
1662 $tmptimespent = $taskstatic->getSummaryOfTimeSpent($fuser->id);
1667 $disabledproject = 1; $disabledtask = 1;
1672 if ($lines[$i]->
public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer)
1674 $disabledproject = 0;
1678 if ($restricteditformytask && empty($tasksrole[$lines[$i]->
id]))
1686 $tableCell =
''; $modeinput =
'hours';
1687 for ($idw = 0; $idw < 7; $idw++)
1692 if (!$isavailable[$tmpday][
'morning'] && !$isavailable[$tmpday][
'afternoon']) $cssonholiday .=
'onholidayallday ';
1693 elseif (!$isavailable[$tmpday][
'morning']) $cssonholiday .=
'onholidaymorning ';
1694 elseif (!$isavailable[$tmpday][
'afternoon']) $cssonholiday .=
'onholidayafternoon ';
1697 $dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id];
1698 $totalforeachday[$tmpday] += $dayWorkLoad;
1702 $alttitle = $langs->trans(
"AddHereTimeSpentForDay", $tmparray[
'day'], $tmparray[
'mon']);
1704 global $numstartworkingday, $numendworkingday;
1706 if (($idw + 1 < $numstartworkingday) || ($idw + 1 > $numendworkingday))
1708 $cssweekend =
'weekend';
1711 $tableCell =
'<td class="center hide'.$idw.($cssonholiday ?
' '.$cssonholiday :
'').($cssweekend ?
' '.$cssweekend :
'').
'">';
1716 $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>';
1720 $tableCell .=
'<input type="text" alt="'.($disabledtask ?
'' : $alttitle).
'" title="'.($disabledtask ?
'' : $alttitle).
'" '.($disabledtask ?
'disabled' : $placeholder).
' class="center smallpadd" size="2" id="timeadded['.$inc.
']['.$idw.
']" name="task['.$lines[$i]->id.
']['.$idw.
']" value="" cols="2" maxlength="5"';
1721 $tableCell .=
' onkeypress="return regexEvent(this,event,\'timeChar\')"';
1722 $tableCell .=
' onkeyup="updateTotal('.$idw.
',\''.$modeinput.
'\')
"';
1723 $tableCell .= ' onblur="regexEvent(
this,event,\
''.$modeinput.
'\'); updateTotal(
'.$idw.',\
''.$modeinput.
'\')
" />';
1724 $tableCell .= '</td>';
1729 print '<td class="right
">';
1730 if ((!$lines[$i]->public) && $disabledproject) print $form->textwithpicto('', $langs->trans("UserIsNotContactOfProject
"));
1731 elseif ($disabledtask)
1733 $titleassigntask = $langs->trans("AssignTaskToMe
");
1734 if ($fuser->id != $user->id) $titleassigntask = $langs->trans("AssignTaskToUser
", '...');
1736 print $form->textwithpicto('', $langs->trans("TaskIsNotAssignedToUser
", $titleassigntask));
1743 // Call to show task with a lower level (task under the current task)
1746 if ($lines[$i]->id > 0)
1748 //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level);
1749 //var_dump($totalforeachday);
1750 $ret = projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak, $arrayfields, $extrafields);
1751 //var_dump('ret with parent='.$lines[$i]->id.' level='.$level);
1753 foreach ($ret as $key => $val)
1755 $totalforeachday[$key] += $val;
1757 //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level.' + subtasks');
1758 //var_dump($totalforeachday);
1766 return $totalforeachday;
1787 function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, &$isavailable, $oldprojectforbreak = 0, $TWeek = array())
1789 global $conf, $db, $user, $langs;
1790 global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic;
1792 $numlines = count($lines);
1795 $workloadforid = array();
1796 $totalforeachweek = array();
1797 $lineswithoutlevel0 = array();
1799 // Create a smaller array with sublevels only to be used later. This increase dramatically performances.
1800 if ($parent == 0) // Always and only if at first level
1802 for ($i = 0; $i < $numlines; $i++)
1804 if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[] = $lines[$i];
1808 //dol_syslog('projectLinesPerWeek inc='.$inc.' firstdaytoshow='.$firstdaytoshow.' task parent id='.$parent.' level='.$level." count(lines)=
".$numlines." count(lineswithoutlevel0)=
".count($lineswithoutlevel0));
1810 if (empty($oldprojectforbreak))
1812 $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1); // 0 = start break, -1 = never break
1815 for ($i = 0; $i < $numlines; $i++)
1817 if ($parent == 0) $level = 0;
1819 if ($lines[$i]->fk_task_parent == $parent)
1821 // If we want all or we have a role on task, we show it
1822 if (empty($mine) || !empty($tasksrole[$lines[$i]->id]))
1824 //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);
1826 // Break on a new project
1827 if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
1829 $lastprojectid = $lines[$i]->fk_project;
1830 $projectstatic->id = $lines[$i]->fk_project;
1833 //var_dump('--- '.$level.' '.$firstdaytoshow.' '.$fuser->id.' '.$projectstatic->id.' '.$workloadforid[$projectstatic->id]);
1834 //var_dump($projectstatic->weekWorkLoadPerTask);
1835 if (empty($workloadforid[$projectstatic->id]))
1837 $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
1838 $workloadforid[$projectstatic->id] = 1;
1840 //var_dump($projectstatic->weekWorkLoadPerTask);
1841 //var_dump('--- '.$projectstatic->id.' '.$workloadforid[$projectstatic->id]);
1843 $projectstatic->id = $lines[$i]->fk_project;
1844 $projectstatic->ref = $lines[$i]->projectref;
1845 $projectstatic->title = $lines[$i]->projectlabel;
1846 $projectstatic->public = $lines[$i]->public;
1847 $projectstatic->thirdparty_name = $lines[$i]->thirdparty_name;
1848 $projectstatic->status = $lines[$i]->projectstatus;
1850 $taskstatic->id = $lines[$i]->id;
1851 $taskstatic->ref = ($lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id);
1852 $taskstatic->label = $lines[$i]->label;
1853 $taskstatic->date_start = $lines[$i]->date_start;
1854 $taskstatic->date_end = $lines[$i]->date_end;
1856 $thirdpartystatic->id = $lines[$i]->thirdparty_id;
1857 $thirdpartystatic->name = $lines[$i]->thirdparty_name;
1858 $thirdpartystatic->email = $lines[$i]->thirdparty_email;
1860 if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id))
1862 print '<tr class="oddeven trforbreak nobold
">'."\n";
1863 print '<td colspan="'.(6 + count($TWeek)).'">';
1864 print $projectstatic->getNomUrl(1, '', 0, '<strong>'.$langs->transnoentitiesnoconv("YourRole
").':</strong> '.$projectsrole[$lines[$i]->fk_project]);
1865 if ($thirdpartystatic->id > 0) print ' - '.$thirdpartystatic->getNomUrl(1);
1866 if ($projectstatic->title)
1869 print '<span class="secondary
">'.$projectstatic->title.'</span>';
1875 if ($oldprojectforbreak != -1) $oldprojectforbreak = $projectstatic->id;
1876 print '<tr class="oddeven
" data-taskid="'.$lines[$i]->id.'">'."\n";
1880 print '<td class="nowrap
">';
1881 print $fuser->getNomUrl(1, 'withproject', 'time');
1886 /*print '<td class="nowrap
">';
1887 if ($oldprojectforbreak == -1) print $projectstatic->getNomUrl(1,'',0,$langs->transnoentitiesnoconv("YourRole
").': '.$projectsrole[$lines[$i]->fk_project]);
1891 /*print '<td class="tdoverflowmax100
">';
1892 if ($thirdpartystatic->id > 0) print $thirdpartystatic->getNomUrl(1, 'project');
1896 print '<td class="nowrap
">';
1897 print '<!-- Task id = '.$lines[$i]->id.' -->';
1898 for ($k = 0; $k < $level; $k++) print '<div class="marginleftonly
">';
1899 print $taskstatic->getNomUrl(1, 'withproject', 'time');
1902 print '<span class="opacitymedium
">'.$taskstatic->label.'</span>';
1903 for ($k = 0; $k < $level; $k++) print "</div>
";
1907 print '<td class="leftborder plannedworkload right
">';
1908 if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload, 'allhourmin');
1912 // Progress declared %
1913 print '<td class="right
">';
1914 print $formother->select_percent($lines[$i]->progress, $lines[$i]->id.'progress');
1917 // Time spent by everybody
1918 print '<td class="right
">';
1919 // $lines[$i]->duration is a denormalised field = summ of time spent by everybody for task. What we need is time consummed by user
1920 if ($lines[$i]->duration)
1922 print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?
id=
'.$lines[$i]->id.'">';
1923 print convertSecondToTime($lines[$i]->duration, 'allhourmin');
1925 } else print '--:--';
1928 // Time spent by user
1929 print '<td class="right
">';
1930 $tmptimespent = $taskstatic->getSummaryOfTimeSpent($fuser->id);
1931 if ($tmptimespent['total_duration']) print convertSecondToTime($tmptimespent['total_duration'], 'allhourmin');
1935 $disabledproject = 1; $disabledtask = 1;
1936 //print "x
".$lines[$i]->fk_project;
1937 //var_dump($lines[$i]);
1938 //var_dump($projectsrole[$lines[$i]->fk_project]);
1939 // If at least one role for project
1940 if ($lines[$i]->public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer)
1942 $disabledproject = 0;
1945 // If $restricteditformytask is on and I have no role on task, i disable edit
1946 if ($restricteditformytask && empty($tasksrole[$lines[$i]->id]))
1951 //var_dump($projectstatic->weekWorkLoadPerTask);
1953 // Fields to show current time
1954 $tableCell = ''; $modeinput = 'hours';
1955 $TFirstDay = getFirstDayOfEachWeek($TWeek, date('Y', $firstdaytoshow));
1956 $TFirstDay[reset($TWeek)] = 1;
1957 foreach ($TFirstDay as &$fday) {
1960 foreach ($TWeek as $weekNb)
1962 $weekWorkLoad = $projectstatic->monthWorkLoadPerTask[$weekNb][$lines[$i]->id];
1963 $totalforeachweek[$weekNb] += $weekWorkLoad;
1966 if ($weekWorkLoad > 0) $alreadyspent = convertSecondToTime($weekWorkLoad, 'allhourmin');
1967 $alttitle = $langs->trans("AddHereTimeSpentForWeek
", $weekNb);
1970 $tableCell = '<td class="center hide weekend
">';
1974 $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>';
1975 //$placeholder=' placeholder="00:00
"';
1979 $tableCell .= '<input type="text
" alt="'.($disabledtask ? '' : $alttitle).'" title="'.($disabledtask ? '' : $alttitle).'" '.($disabledtask ? 'disabled' : $placeholder).' class="center smallpadd
" size="2
" id="timeadded[
'.$inc.'][
'.((int) $weekNb).']
" name="task[
'.$lines[$i]->id.'][
'.$TFirstDay[$weekNb].']
" value="" cols="2
" maxlength="5
"';
1980 $tableCell .= ' onkeypress="return regexEvent(
this,event,\
'timeChar\')"';
1981 $tableCell .=
' onkeyup="updateTotal('.$weekNb.
',\''.$modeinput.
'\')
"';
1982 $tableCell .= ' onblur="regexEvent(
this,event,\
''.$modeinput.
'\'); updateTotal(
'.$weekNb.',\
''.$modeinput.
'\')
" />';
1983 $tableCell .= '</td>';
1988 print '<td class="right
">';
1989 if ((!$lines[$i]->public) && $disabledproject) print $form->textwithpicto('', $langs->trans("UserIsNotContactOfProject
"));
1990 elseif ($disabledtask)
1992 $titleassigntask = $langs->trans("AssignTaskToMe
");
1993 if ($fuser->id != $user->id) $titleassigntask = $langs->trans("AssignTaskToUser
", '...');
1995 print $form->textwithpicto('', $langs->trans("TaskIsNotAssignedToUser
", $titleassigntask));
2002 // Call to show task with a lower level (task under the current task)
2005 if ($lines[$i]->id > 0)
2007 //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level);
2008 //var_dump($totalforeachday);
2009 $ret = projectLinesPerMonth($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak, $TWeek);
2010 //var_dump('ret with parent='.$lines[$i]->id.' level='.$level);
2012 foreach ($ret as $key => $val)
2014 $totalforeachweek[$key] += $val;
2016 //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level.' + subtasks');
2017 //var_dump($totalforeachday);
2025 return $totalforeachweek;
2038 function searchTaskInChild(&$inc, $parent, &$lines, &$taskrole)
2040 //print 'Search in line with parent id = '.$parent.'<br>';
2041 $numlines = count($lines);
2042 for ($i = 0; $i < $numlines; $i++)
2044 // Process line $lines[$i]
2045 if ($lines[$i]->fk_parent == $parent && $lines[$i]->id != $lines[$i]->fk_parent)
2047 // If task is legitimate to show, no more need to search deeper
2048 if (isset($taskrole[$lines[$i]->id]))
2050 //print 'Found a legitimate task id='.$lines[$i]->id.'<br>';
2055 searchTaskInChild($inc, $lines[$i]->id, $lines, $taskrole);
2056 //print 'Found inc='.$inc.'<br>';
2058 if ($inc > 0) return $inc;
2078 function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks = 0, $status = -1, $listofoppstatus = array(), $hiddenfields = array())
2080 global $langs, $conf, $user;
2081 global $theme_datacolor;
2083 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
2085 $listofstatus = array_keys($listofoppstatus);
2087 if (is_array($listofstatus) && !empty($conf->global->USE_COLOR_FOR_PROSPECTION_STATUS)) {
2088 // Define $themeColorId and array $statusOppList for each $listofstatus
2090 $statusOppList = array();
2091 foreach ($listofstatus as $oppStatus) {
2092 $oppStatusCode = dol_getIdFromCode($db, $oppStatus, 'c_lead_status', 'rowid', 'code');
2093 if ($oppStatusCode) {
2094 $statusOppList[$oppStatus]['code'] = $oppStatusCode;
2095 $statusOppList[$oppStatus]['color'] = isset($theme_datacolor[$themeColorId]) ? implode(', ', $theme_datacolor[$themeColorId]) : '';
2101 $projectstatic = new Project($db);
2102 $thirdpartystatic = new Societe($db);
2106 $project_year_filter = 0;
2108 $title = $langs->trans("Projects");
2109 if (strcmp($status, '') && $status >= 0) $title = $langs->trans("Projects").' '.$langs->trans($projectstatic->statuts_long[$status]);
2111 $arrayidtypeofcontact = array();
2113 print '<div class="div-table-responsive-no-min
">';
2114 print '<table class="noborder centpercent
">';
2116 $sql = " FROM
".MAIN_DB_PREFIX."projet as p
";
2119 $sql .= ",
".MAIN_DB_PREFIX."projet_task as t
";
2120 $sql .= ",
".MAIN_DB_PREFIX."element_contact as ec
";
2121 $sql .= ",
".MAIN_DB_PREFIX."c_type_contact as ctc
";
2123 $sql .= " LEFT JOIN
".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet
";
2125 $sql .= " WHERE p.entity IN (
".getEntity('project').")
";
2126 $sql .= " AND p.rowid IN (
".$projectsListId.")
";
2127 if ($socid) $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc =
".$socid.")
";
2130 $sql .= " AND p.rowid = t.fk_projet
";
2131 $sql .= " AND ec.element_id = t.rowid
";
2132 $sql .= " AND ec.fk_socpeople =
".$user->id;
2133 $sql .= " AND ec.fk_c_type_contact = ctc.rowid
"; // Replace the 2 lines with ec.fk_c_type_contact in $arrayidtypeofcontact
2134 $sql .= " AND ctc.element =
'project_task'";
2138 $sql .= " AND p.fk_statut =
".(int) $status;
2140 if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE))
2142 $project_year_filter = GETPOST("project_year_filter
");
2143 //Check if empty or invalid year. Wildcard ignores the sql check
2144 if ($project_year_filter != "*
")
2146 if (empty($project_year_filter) || !ctype_digit($project_year_filter))
2148 $project_year_filter = date("Y
");
2150 $sql .= " AND (p.dateo IS NULL OR p.dateo <=
".$db->idate(dol_get_last_day($project_year_filter, 12, false)).")
";
2151 $sql .= " AND (p.datee IS NULL OR p.datee >=
".$db->idate(dol_get_first_day($project_year_filter, 1, false)).")
";
2155 // Get id of project we must show tasks
2156 $arrayidofprojects = array();
2157 $sql1 = "SELECT p.rowid as projectid
";
2159 $resql = $db->query($sql1);
2163 $num = $db->num_rows($resql);
2166 $objp = $db->fetch_object($resql);
2167 $arrayidofprojects[$objp->projectid] = $objp->projectid;
2170 } else dol_print_error($db);
2171 if (empty($arrayidofprojects)) $arrayidofprojects[0] = -1;
2173 // Get list of project with calculation on tasks
2174 $sql2 = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_soc,
";
2175 $sql2 .= " s.rowid as socid, s.nom as socname, s.name_alias,
";
2176 $sql2 .= " s.code_client, s.code_compta, s.client,
";
2177 $sql2 .= " s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur,
";
2178 $sql2 .= " s.logo, s.email, s.entity,
";
2179 $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,
";
2180 $sql2 .= " p.dateo, p.datee,
";
2181 $sql2 .= " COUNT(t.rowid) as nb, SUM(t.planned_workload) as planned_workload, SUM(t.planned_workload * t.progress / 100) as declared_progess_workload";
2182 $sql2 .= " FROM ".MAIN_DB_PREFIX."projet as p";
2183 $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.
rowid = p.fk_soc";
2184 $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.
rowid = t.fk_projet";
2185 $sql2 .= " WHERE p.
rowid IN (".join(',', $arrayidofprojects).")";
2186 $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,";
2187 $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";
2188 $sql2 .= " ORDER BY p.title, p.ref";
2190 $resql = $db->query($sql2);
2194 $total_opp_amount = 0;
2195 $ponderated_opp_amount = 0;
2197 $num = $db->num_rows($resql);
2200 print '<tr class="liste_titre">';
2201 print_liste_field_titre($title.
'<span class="badge marginleftonlyshort">'.$num.
'</span>',
$_SERVER[
"PHP_SELF"],
"",
"",
"",
"", $sortfield, $sortorder);
2203 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
2205 if (!in_array(
'prospectionstatus', $hiddenfields))
print_liste_field_titre(
"OpportunityStatus",
"",
"",
"",
"",
'', $sortfield, $sortorder,
'right ');
2209 if (empty($conf->global->PROJECT_HIDE_TASKS))
2212 if (!in_array(
'plannedworkload', $hiddenfields))
print_liste_field_titre(
"PlannedWorkload",
"",
"",
"",
"",
'', $sortfield, $sortorder,
'right ');
2213 if (!in_array(
'declaredprogress', $hiddenfields))
print_liste_field_titre(
"ProgressDeclared",
"",
"",
"",
"",
'', $sortfield, $sortorder,
'right ');
2215 if (!in_array(
'projectstatus', $hiddenfields))
print_liste_field_titre(
"Status",
"",
"",
"",
"",
'', $sortfield, $sortorder,
'right ');
2218 $total_plannedworkload = 0;
2219 $total_declaredprogressworkload = 0;
2222 $objp = $db->fetch_object($resql);
2224 $projectstatic->id = $objp->projectid;
2225 $projectstatic->user_author_id = $objp->fk_user_creat;
2226 $projectstatic->public = $objp->public;
2229 $userAccess = $projectstatic->restrictedProjectArea($user);
2230 if ($userAccess >= 0)
2232 $projectstatic->ref = $objp->ref;
2233 $projectstatic->status = $objp->status;
2234 $projectstatic->title = $objp->title;
2235 $projectstatic->datee = $db->jdate($objp->datee);
2236 $projectstatic->dateo = $db->jdate($objp->dateo);
2238 print '<tr class="oddeven">';
2240 print '<td class="tdoverflowmax150">';
2241 print $projectstatic->getNomUrl(1,
'', 0,
'',
'-', 0, -1,
'nowraponall');
2242 if (!in_array(
'projectlabel', $hiddenfields))
print '<br><span class="opacitymedium">'.dol_trunc($objp->title, 24).
'</span>';
2245 print '<td class="nowraponall tdoverflowmax100">';
2246 if ($objp->fk_soc > 0)
2248 $thirdpartystatic->id = $objp->socid;
2249 $thirdpartystatic->name = $objp->socname;
2252 $thirdpartystatic->code_compta = $objp->code_compta;
2253 $thirdpartystatic->client = $objp->client;
2255 $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
2256 $thirdpartystatic->fournisseur = $objp->fournisseur;
2257 $thirdpartystatic->logo = $objp->logo;
2258 $thirdpartystatic->email = $objp->email;
2259 $thirdpartystatic->entity = $objp->entity;
2260 print $thirdpartystatic->getNomUrl(1);
2264 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
2266 if (!in_array(
'prospectionstatus', $hiddenfields)) {
2267 print '<td class="center tdoverflowmax75">';
2269 if (empty($conf->global->USE_COLOR_FOR_PROSPECTION_STATUS)) {
2270 $oppStatusCode =
dol_getIdFromCode($db, $objp->opp_status,
'c_lead_status',
'rowid',
'code');
2271 if ($langs->trans(
"OppStatus".$oppStatusCode) !=
"OppStatus".$oppStatusCode) {
2272 print $langs->trans(
"OppStatus".$oppStatusCode);
2275 if (isset($statusOppList[$objp->opp_status])) {
2276 $oppStatusCode = $statusOppList[$objp->opp_status][
'code'];
2277 $oppStatusColor = $statusOppList[$objp->opp_status][
'color'];
2279 $oppStatusCode =
dol_getIdFromCode($db, $objp->opp_status,
'c_lead_status',
'rowid',
'code');
2280 $oppStatusColor =
'';
2282 if ($oppStatusCode) {
2283 if (!empty($oppStatusColor)) {
2284 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>';
2286 print '<a href="'.dol_buildpath(
'/projet/list.php?search_opp_status='.$objp->opp_status, 1).
'" title="'.$langs->trans(
"OppStatus".$oppStatusCode).
'">'.$oppStatusCode.
'</a>';
2293 print '<td class="right">';
2294 if ($objp->opp_percent && $objp->opp_amount) {
2295 $opp_weighted_amount = $objp->opp_percent * $objp->opp_amount / 100;
2296 $alttext = $langs->trans(
"OpportunityWeightedAmount").
' '.
price($opp_weighted_amount, 0,
'', 1, -1, 0, $conf->currency);
2297 $ponderated_opp_amount +=
price2num($opp_weighted_amount);
2299 if ($objp->opp_amount)
print '<span title="'.$alttext.
'">'.
price($objp->opp_amount, 0,
'', 1, -1, 0, $conf->currency).
'</span>';
2303 if (empty($conf->global->PROJECT_HIDE_TASKS))
2305 print '<td class="right">'.$objp->nb.
'</td>';
2307 $plannedworkload = $objp->planned_workload;
2308 $total_plannedworkload += $plannedworkload;
2309 if (!in_array(
'plannedworkload', $hiddenfields))
2313 if (!in_array(
'declaredprogress', $hiddenfields))
2315 $declaredprogressworkload = $objp->declared_progess_workload;
2316 $total_declaredprogressworkload += $declaredprogressworkload;
2317 print '<td class="right">';
2319 print ($plannedworkload ?round(100 * $declaredprogressworkload / $plannedworkload, 0).
'%' :
'');
2324 if (!in_array(
'projectstatus', $hiddenfields)) {
2325 print '<td class="right">';
2326 print $projectstatic->getLibStatut(3);
2332 $total_task = $total_task + $objp->nb;
2333 $total_opp_amount = $total_opp_amount + $objp->opp_amount;
2339 print '<tr class="liste_total">';
2340 print '<td>'.$langs->trans(
"Total").
"</td><td></td>";
2341 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
2343 if (!in_array(
'prospectionstatus', $hiddenfields)) {
2344 print '<td class="liste_total"></td>';
2346 print '<td class="liste_total right">';
2348 print $form->textwithpicto(
price($total_opp_amount, 0,
'', 1, -1, 0, $conf->currency), $langs->trans(
"OpportunityPonderatedAmountDesc").
' : '.
price($ponderated_opp_amount, 0,
'', 1, -1, 0, $conf->currency));
2351 if (empty($conf->global->PROJECT_HIDE_TASKS))
2353 print '<td class="liste_total right">'.$total_task.
'</td>';
2354 if (!in_array(
'plannedworkload', $hiddenfields))
print '<td class="liste_total right">'.($total_plannedworkload ?
convertSecondToTime($total_plannedworkload) :
'').
'</td>';
2355 if (!in_array(
'declaredprogress', $hiddenfields))
print '<td class="liste_total right">'.($total_plannedworkload ?round(100 * $total_declaredprogressworkload / $total_plannedworkload, 0).
'%' :
'').
'</td>';
2357 if (!in_array(
'projectstatus', $hiddenfields)) {
2358 print '<td class="liste_total"></td>';
2370 if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE))
2373 print '<form method="get" action="'.$_SERVER[
"PHP_SELF"].
'">';
2374 print '<table width="100%">';
2376 print '<td>'.$langs->trans(
"Year").
'</td>';
2377 print '<td class="right"><input type="text" size="4" class="flat" name="project_year_filter" value="'.$project_year_filter.
'"/>';
2379 print '</table></form>';
2392 function getTaskProgressView($task, $label =
true, $progressNumber =
true, $hideOnProgressNull =
false, $spaced =
false)
2394 global $langs, $conf;
2398 $plannedworkloadoutputformat =
'allhourmin';
2399 $timespentoutputformat =
'allhourmin';
2400 if (!empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) $plannedworkloadoutputformat = $conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT;
2401 if (!empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) $timespentoutputformat = $conf->global->PROJECT_TIME_SPENT_FORMAT;
2403 if (empty($task->progress) && !empty($hideOnProgressNull)) {
2407 $spaced = !empty($spaced) ?
'spaced' :
'';
2412 $progressBarClass =
'progress-bar-info';
2413 if ($task->planned_workload) {
2414 $progressCalculated = round(100 * doubleval($task->duration_effective) / doubleval($task->planned_workload), 2);
2417 $warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
2419 $diffTitle =
'<br>'.$langs->trans(
'ProgressDeclared').
' : '.$task->progress.($task->progress ?
'%' :
'');
2420 $diffTitle .=
'<br>'.$langs->trans(
'ProgressCalculated').
' : '.$progressCalculated.($progressCalculated ?
'%' :
'');
2423 if (doubleval($progressCalculated) > doubleval($task->progress * $warningRatio)) {
2424 $progressBarClass =
'progress-bar-danger';
2425 $title = $langs->trans(
'TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress - $progressCalculated).
' '.$langs->trans(
"point"));
2426 $diff =
'<span class="text-danger classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).
'" ><i class="fa fa-caret-down"></i> '.($task->progress - $progressCalculated).
'%</span>';
2427 } elseif (doubleval($progressCalculated) > doubleval($task->progress)) {
2428 $progressBarClass =
'progress-bar-warning';
2429 $title = $langs->trans(
'TheReportedProgressIsLessThanTheCalculatedProgressionByX', abs($task->progress - $progressCalculated).
' '.$langs->trans(
"point"));
2430 $diff =
'<span class="text-warning classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).
'" ><i class="fa fa-caret-left"></i> '.($task->progress - $progressCalculated).
'%</span>';
2432 $progressBarClass =
'progress-bar-success';
2433 $title = $langs->trans(
'TheReportedProgressIsMoreThanTheCalculatedProgressionByX', ($task->progress - $progressCalculated).
' '.$langs->trans(
"point"));
2434 $diff =
'<span class="text-success classfortooltip paddingrightonly" title="'.dol_htmlentities($title.$diffTitle).
'" ><i class="fa fa-caret-up"></i> '.($task->progress - $progressCalculated).
'%</span>';
2438 $out .=
'<div class="progress-group">';
2440 if ($label !==
false)
2442 $out .=
' <span class="progress-text">';
2444 if ($label !==
true) {
2453 if ($progressNumber !==
false)
2455 $out .=
' <span class="progress-number">';
2456 if ($progressNumber !==
true) {
2457 $out .= $progressNumber;
2459 if ($task->hasDelay()) $out .=
img_warning($langs->trans(
"Late")).
' ';
2461 $url = DOL_URL_ROOT.
'/projet/tasks/time.php?id='.$task->id;
2463 $out .= !empty($diff) ? $diff.
' ' :
'';
2464 $out .=
'<a href="'.$url.
'" >';
2465 $out .=
'<b title="'.$langs->trans(
'TimeSpent').
'" >';
2466 if ($task->duration_effective) $out .=
convertSecondToTime($task->duration_effective, $timespentoutputformat);
2467 else $out .=
'--:--';
2473 $out .=
'<a href="'.$url.
'" >';
2474 $out .=
'<span title="'.$langs->trans(
'PlannedWorkload').
'" >';
2475 if ($task->planned_workload) $out .=
convertSecondToTime($task->planned_workload, $plannedworkloadoutputformat);
2476 else $out .=
'--:--';
2484 $out .=
' <div class="progress sm '.$spaced.
'">';
2485 $diffval = doubleval($task->progress) - doubleval($progressCalculated);
2486 if ($diffval >= 0) {
2488 $out .=
' <div class="progress-bar '.$progressBarClass.
'" style="width: '.doubleval($task->progress).
'%" title="'.doubleval($task->progress).
'%">';
2489 if (!empty($task->progress)) {
2490 $out .=
' <div class="progress-bar progress-bar-consumed" style="width: '.doubleval($progressCalculated / $task->progress * 100).
'%" title="'.doubleval($progressCalculated).
'%"></div>';
2495 $out .=
' <div class="progress-bar progress-bar-consumed" style="width: '.doubleval($progressCalculated).
'%" title="'.doubleval($progressCalculated).
'%">';
2496 $out .=
' <div class="progress-bar '.$progressBarClass.
'" style="width: '.($task->progress ? doubleval($task->progress / $progressCalculated * 100).
'%' :
'1px').
'" title="'.doubleval($task->progress).
'%"></div>';
2515 global $conf, $langs;
2519 if ($task->progress !=
'')
2524 $badgeClass =
'badge ';
2525 if ($task->planned_workload) {
2526 $progressCalculated = round(100 * doubleval($task->duration_effective) / doubleval($task->planned_workload), 2);
2529 $warningRatio = !empty($conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT) ? (1 + $conf->global->PROJECT_TIME_SPEND_WARNING_PERCENT / 100) : 1.10;
2531 if (doubleval($progressCalculated) > doubleval($task->progress * $warningRatio)) {
2532 $badgeClass .=
'badge-danger';
2533 if (empty($tooltip)) {
2534 $tooltip = $task->progress.
'% < '.$langs->trans(
"TimeConsumed").
' '.$progressCalculated.
'%';
2536 } elseif (doubleval($progressCalculated) > doubleval($task->progress)) {
2537 $badgeClass .=
'badge-warning';
2538 if (empty($tooltip)) $tooltip = $task->progress.
'% < '.$langs->trans(
"TimeConsumed").
' '.$progressCalculated.
'%';
2540 $badgeClass .=
'badge-success';
2541 if (empty($tooltip)) $tooltip = $task->progress.
'% >= '.$langs->trans(
"TimeConsumed").
' '.$progressCalculated.
'%';
2547 if (!empty($tooltip)) {
2548 $badgeClass .=
' classfortooltip';
2549 $title =
'title="'.dol_htmlentities($tooltip).
'"';
2552 if (empty($label)) {
2553 $label = $task->progress.
' %';
2556 if (!empty($label)) {
2557 $out =
'<span class="'.$badgeClass.
'" '.$title.
' >'.$label.
'</span>';
</td >< tdcolspan="3">< spanclass="opacitymedium"></span ></td ></tr >< trclass="liste_total"> CREANCES DETTES< tdcolspan="3"class="right"></td >< tdcolspan="3"class="right"></td ></tr > CREANCES DETTES RECETTES DEPENSES trips CREANCES DETTES Y m expensereport p date_valid Y m expensereport pe datep $db idate($date_start)."' AND $column < p rowid
Class to manage Dolibarr users.
dol_htmlentities($string, $flags=null, $encoding= 'UTF-8', $double_encode=false)
Replace htmlentities functions.
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.
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.
img_warning($titlealt= 'default', $moreatt= '', $morecss= 'pictowarning')
Show warning logo.
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...
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.
getElementCount($type, $tablename, $projectkey= 'fk_projet')
Return the count of a type of linked elements of this project.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
searchTaskInChild(&$inc, $parent, &$lines, &$taskrole)
Search in task lines with a particular parent if there is a task for a particular user (in taskrole) ...
Class to manage projects.
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is '...
if(!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'] s nom
projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask, $preselectedday, &$isavailable, $oldprojectforbreak=0)
Output a task line into a pertime intput mode.
dol_getdate($timestamp, $fast=false, $forcetimezone= '')
Return an array with locale date info.
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0)
Scan a directory and return a list of files/directories.
getTaskProgressView($task, $label=true, $progressNumber=true, $hideOnProgressNull=false, $spaced=false)
liste_contact($status=-1, $source= 'external', $list=0, $code= '')
Get array of all contacts for an object.
print $_SERVER["PHP_SELF"]
Edit parameters.
getTaskProgressBadge($task, $label= '', $tooltip= '')
static count($db, $objecttype, $objectid)
Return nb of links.
dol_getIdFromCode($db, $key, $tablename, $fieldkey= 'code', $fieldid= 'id', $entityfilter=0)
Return an id or code from a code or id.
project_prepare_head(Project $project)
Prepare array with list of tabs.
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
print $_SERVER["PHP_SELF"] n
Edit parameters.
getNbComments()
Return nb comments already posted.
project_admin_prepare_head()
Prepare array with list of tabs.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode= 'add')
Complete or removed entries into a head array (used to build tabs).
project_timesheet_prepare_head($mode, $fuser=null)
Prepare array with list of tabs.
dol_time_plus_duree($time, $duration_value, $duration_unit)
Add a delay to a date.
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.
convertSecondToTime($iSecond, $format= 'all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.
task_prepare_head($object)
Prepare array with list of tabs.