dolibarr  16.0.5
index.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2010 Regis Houssin <regis.houssin@inodbox.com>
5  * Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19  */
20 
27 require "../../main.inc.php";
28 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
29 require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
32 
33 $search_project_user = GETPOST('search_project_user', 'int');
34 $mine = GETPOST('mode', 'aZ09') == 'mine' ? 1 : 0;
35 if ($search_project_user == $user->id) {
36  $mine = 1;
37 }
38 
39 // Security check
40 $socid = 0;
41 if ($user->socid > 0) {
42  $socid = $user->socid;
43 }
44 //$result = restrictedArea($user, 'projet', $projectid);
45 if (!$user->rights->projet->lire) {
47 }
48 
49 $hookmanager = new HookManager($db);
50 
51 // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
52 $hookmanager->initHooks(array('activityindex'));
53 
54 // Load translation files required by the page
55 $langs->load("projects");
56 
57 
58 /*
59  * View
60  */
61 
62 $now = dol_now();
63 $tmp = dol_getdate($now);
64 $day = $tmp['mday'];
65 $month = $tmp['mon'];
66 $year = $tmp['year'];
67 
68 $projectstatic = new Project($db);
69 $taskstatic = new Task($db);
70 $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); // Return all projects I have permission on because I want my tasks and some of my task may be on a public projet that is not my project
71 $taskstatic = new Task($db);
72 $tasktmp = new Task($db);
73 
74 $title = $langs->trans("Activities");
75 //if ($mine) $title=$langs->trans("MyActivities");
76 
77 llxHeader("", $title);
78 
79 
80 // Title for combo list see all projects
81 $titleall = $langs->trans("AllAllowedProjects");
82 if (!empty($user->rights->projet->all->lire) && !$socid) {
83  $titleall = $langs->trans("AllProjects");
84 } else {
85  $titleall = $langs->trans("AllAllowedProjects").'<br><br>';
86 }
87 
88 
89 $morehtml = '';
90 $morehtml .= '<form name="projectform">';
91 $morehtml .= '<SELECT name="mode">';
92 $morehtml .= '<option name="all" value="all"'.($mine ? '' : ' selected').'>'.$titleall.'</option>';
93 $morehtml .= '<option name="mine" value="'.$user->id.'"'.(($search_project_user == $user->id) ? ' selected' : '').'>'.$langs->trans("ProjectsImContactFor").'</option>';
94 $morehtml .= '</SELECT>';
95 $morehtml .= '<input type="submit" class="button" name="refresh" value="'.$langs->trans("Refresh").'">';
96 
97 if ($mine) {
98  $tooltiphelp = $langs->trans("MyTasksDesc");
99 } else {
100  if ($user->rights->projet->all->lire && !$socid) {
101  $tooltiphelp = $langs->trans("TasksDesc");
102  } else {
103  $tooltiphelp = $langs->trans("TasksPublicDesc");
104  }
105 }
106 
107 print_barre_liste($form->textwithpicto($title, $tooltiphelp), 0, $_SERVER["PHP_SELF"], '', '', '', '', 0, -1, 'projecttask', 0, $morehtml);
108 
109 print '<div class="fichecenter"><div class="fichethirdleft">';
110 
111 /* Show list of project today */
112 
113 print '<div class="div-table-responsive-no-min">';
114 print '<table class="noborder centpercent">';
115 print '<tr class="liste_titre">';
116 print '<td width="50%">'.$langs->trans('ActivityOnProjectToday').'</td>';
117 print '<td width="50%" class="right">'.$langs->trans("Time").'</td>';
118 print "</tr>\n";
119 
120 $sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb";
121 $sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
122 $sql .= ", ".MAIN_DB_PREFIX."projet_task as t";
123 $sql .= ", ".MAIN_DB_PREFIX."projet_task_time as tt";
124 $sql .= " WHERE t.fk_projet = p.rowid";
125 $sql .= " AND p.entity = ".((int) $conf->entity);
126 $sql .= " AND tt.fk_task = t.rowid";
127 $sql .= " AND tt.fk_user = ".((int) $user->id);
128 $sql .= " AND task_date BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'";
129 $sql .= " AND p.rowid in (".$db->sanitize($projectsListId).")";
130 $sql .= " GROUP BY p.rowid, p.ref, p.title, p.public";
131 
132 $resql = $db->query($sql);
133 if ($resql) {
134  $total = 0;
135 
136  while ($row = $db->fetch_object($resql)) {
137  print '<tr class="oddeven">';
138  print '<td>';
139  $projectstatic->id = $row->rowid;
140  $projectstatic->ref = $row->ref;
141  $projectstatic->title = $row->title;
142  $projectstatic->public = $row->public;
143  print $projectstatic->getNomUrl(1, '', 1);
144  print '</td>';
145  print '<td class="right">'.convertSecondToTime($row->nb, 'allhourmin').'</td>';
146  print "</tr>\n";
147  $total += $row->nb;
148  }
149 
150  $db->free($resql);
151 } else {
152  dol_print_error($db);
153 }
154 print '<tr class="liste_total">';
155 print '<td>'.$langs->trans('Total').'</td>';
156 print '<td class="right">'.convertSecondToTime($total, 'allhourmin').'</td>';
157 print "</tr>\n";
158 print "</table>";
159 print '</div>';
160 
161 
162 print '</div><div class="fichetwothirdright">';
163 
164 
165 /* Affichage de la liste des projets d'hier */
166 print '<div class="div-table-responsive-no-min">';
167 print '<table class="noborder centpercent">';
168 print '<tr class="liste_titre">';
169 print '<td>'.$langs->trans('ActivityOnProjectYesterday').'</td>';
170 print '<td class="right">'.$langs->trans("Time").'</td>';
171 print "</tr>\n";
172 
173 $sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb";
174 $sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
175 $sql .= ", ".MAIN_DB_PREFIX."projet_task as t";
176 $sql .= ", ".MAIN_DB_PREFIX."projet_task_time as tt";
177 $sql .= " WHERE t.fk_projet = p.rowid";
178 $sql .= " AND p.entity = ".((int) $conf->entity);
179 $sql .= " AND tt.fk_task = t.rowid";
180 $sql .= " AND tt.fk_user = ".((int) $user->id);
181 $sql .= " AND task_date BETWEEN '".$db->idate(dol_time_plus_duree(dol_mktime(0, 0, 0, $month, $day, $year), -1, 'd'))."' AND '".$db->idate(dol_time_plus_duree(dol_mktime(23, 59, 59, $month, $day, $year), -1, 'd'))."'";
182 $sql .= " AND p.rowid in (".$db->sanitize($projectsListId).")";
183 $sql .= " GROUP BY p.rowid, p.ref, p.title, p.public";
184 
185 $resql = $db->query($sql);
186 if ($resql) {
187  $total = 0;
188 
189  while ($row = $db->fetch_object($resql)) {
190  print '<tr class="oddeven">';
191  print '<td>';
192  $projectstatic->id = $row->rowid;
193  $projectstatic->ref = $row->ref;
194  $projectstatic->title = $row->title;
195  $projectstatic->public = $row->public;
196  print $projectstatic->getNomUrl(1, '', 1);
197  print '</td>';
198  print '<td class="right">'.convertSecondToTime($row->nb, 'allhourmin').'</td>';
199  print "</tr>\n";
200  $total += $row->nb;
201  }
202 
203  $db->free($resql);
204 } else {
205  dol_print_error($db);
206 }
207 print '<tr class="liste_total">';
208 print '<td>'.$langs->trans('Total').'</td>';
209 print '<td class="right">'.convertSecondToTime($total, 'allhourmin').'</td>';
210 print "</tr>\n";
211 print "</table>";
212 print '</div>';
213 
214 
215 
216 /*
217 if ($db->type != 'pgsql')
218 {
219  print '<br>';
220 
221  // Affichage de la liste des projets de la semaine
222  print '<div class="div-table-responsive-no-min">';
223  print '<table class="noborder centpercent">';
224  print '<tr class="liste_titre">';
225  print '<td>'.$langs->trans("ActivityOnProjectThisWeek").'</td>';
226  print '<td class="right">'.$langs->trans("Time").'</td>';
227  print "</tr>\n";
228 
229  $sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb";
230  $sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
231  $sql.= " , ".MAIN_DB_PREFIX."projet_task as t";
232  $sql.= " , ".MAIN_DB_PREFIX."projet_task_time as tt";
233  $sql.= " WHERE t.fk_projet = p.rowid";
234  $sql.= " AND p.entity = ".((int) $conf->entity);
235  $sql.= " AND tt.fk_task = t.rowid";
236  $sql.= " AND tt.fk_user = ".((int) $user->id);
237  $sql.= " AND task_date >= '".$db->idate(dol_get_first_day($year, $month)).'" AND ...";
238  $sql.= " AND p.rowid in (".$db->sanitize($projectsListId).")";
239  $sql.= " GROUP BY p.rowid, p.ref, p.title";
240 
241  $resql = $db->query($sql);
242  if ( $resql )
243  {
244  $total = 0;
245 
246  while ($row = $db->fetch_object($resql))
247  {
248  print '<tr class="oddeven">';
249  print '<td>';
250  $projectstatic->id=$row->rowid;
251  $projectstatic->ref=$row->ref;
252  $projectstatic->title=$row->title;
253  $projectstatic->public=$row->public;
254  print $projectstatic->getNomUrl(1, '', 1);
255  print '</td>';
256  print '<td class="right">'.convertSecondToTime($row->nb, 'allhourmin').'</td>';
257  print "</tr>\n";
258  $total += $row->nb;
259  }
260 
261  $db->free($resql);
262  }
263  else
264  {
265  dol_print_error($db);
266  }
267  print '<tr class="liste_total">';
268  print '<td>'.$langs->trans('Total').'</td>';
269  print '<td class="right">'.convertSecondToTime($total, 'allhourmin').'</td>';
270  print "</tr>\n";
271  print "</table></div><br>";
272 
273 }
274 */
275 
276 /* Affichage de la liste des projets du mois */
277 if (!empty($conf->global->PROJECT_TASK_TIME_MONTH)) {
278  print '<div class="div-table-responsive-no-min">';
279  print '<table class="noborder centpercent">';
280  print '<tr class="liste_titre">';
281  print '<td>'.$langs->trans("ActivityOnProjectThisMonth").': '.dol_print_date($now, "%B %Y").'</td>';
282  print '<td class="right">'.$langs->trans("Time").'</td>';
283  print "</tr>\n";
284 
285  $sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb";
286  $sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
287  $sql .= ", ".MAIN_DB_PREFIX."projet_task as t";
288  $sql .= ", ".MAIN_DB_PREFIX."projet_task_time as tt";
289  $sql .= " WHERE t.fk_projet = p.rowid";
290  $sql .= " AND p.entity = ".((int) $conf->entity);
291  $sql .= " AND tt.fk_task = t.rowid";
292  $sql .= " AND tt.fk_user = ".((int) $user->id);
293  $sql .= " AND task_date BETWEEN '".$db->idate(dol_get_first_day($year, $month))."' AND '".$db->idate(dol_get_last_day($year, $month))."'";
294  $sql .= " AND p.rowid in (".$db->sanitize($projectsListId).")";
295  $sql .= " GROUP BY p.rowid, p.ref, p.title, p.public";
296 
297  $resql = $db->query($sql);
298  if ($resql) {
299  while ($row = $db->fetch_object($resql)) {
300  print '<tr class="oddeven">';
301  print '<td>';
302  $projectstatic->id = $row->rowid;
303  $projectstatic->ref = $row->ref;
304  $projectstatic->title = $row->title;
305  print $projectstatic->getNomUrl(1, '', 1);
306  print '</td>';
307  print '<td class="right">'.convertSecondToTime($row->nb, 'allhourmin').'</td>';
308  print "</tr>\n";
309  }
310  $db->free($resql);
311  } else {
312  dol_print_error($db);
313  }
314  print '<tr class="liste_total">';
315  print '<td>'.$langs->trans('Total').'</td>';
316  print '<td class="right">'.convertSecondToTime($total, 'allhourmin').'</td>';
317  print "</tr>\n";
318  print "</table>";
319  print '</div>';
320 }
321 
322 /* Affichage de la liste des projets de l'annee */
323 if (!empty($conf->global->PROJECT_TASK_TIME_YEAR)) {
324  print '<div class="div-table-responsive-no-min">';
325  print '<br><table class="noborder centpercent">';
326  print '<tr class="liste_titre">';
327  print '<td>'.$langs->trans("ActivityOnProjectThisYear").': '.strftime("%Y", $now).'</td>';
328  print '<td class="right">'.$langs->trans("Time").'</td>';
329  print "</tr>\n";
330 
331  $sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb";
332  $sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
333  $sql .= ", ".MAIN_DB_PREFIX."projet_task as t";
334  $sql .= ", ".MAIN_DB_PREFIX."projet_task_time as tt";
335  $sql .= " WHERE t.fk_projet = p.rowid";
336  $sql .= " AND p.entity = ".((int) $conf->entity);
337  $sql .= " AND tt.fk_task = t.rowid";
338  $sql .= " AND tt.fk_user = ".((int) $user->id);
339  $sql .= " AND YEAR(task_date) = '".strftime("%Y", $now)."'";
340  $sql .= " AND p.rowid in (".$db->sanitize($projectsListId).")";
341  $sql .= " GROUP BY p.rowid, p.ref, p.title, p.public";
342 
343  $resql = $db->query($sql);
344  if ($resql) {
345  while ($row = $db->fetch_object($resql)) {
346  print '<tr class="oddeven">';
347  print '<td>';
348  $projectstatic->id = $row->rowid;
349  $projectstatic->ref = $row->ref;
350  $projectstatic->title = $row->title;
351  $projectstatic->public = $row->public;
352  print $projectstatic->getNomUrl(1, '', 1);
353  print '</td>';
354  print '<td class="right">'.convertSecondToTime($row->nb, 'allhourmin').'</td>';
355  print "</tr>\n";
356  }
357  $db->free($resql);
358  } else {
359  dol_print_error($db);
360  }
361  print '<tr class="liste_total">';
362  print '<td>'.$langs->trans('Total').'</td>';
363  print '<td class="right">'.convertSecondToTime($total, 'allhourmin').'</td>';
364  print "</tr>\n";
365  print "</table>";
366  print '</div>';
367 }
368 
369 if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_SHOW_TASK_LIST_ON_PROJECT_AREA)) {
370  // Get id of types of contacts for projects (This list never contains a lot of elements)
371  $listofprojectcontacttype = array();
372  $sql = "SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX."c_type_contact as ctc";
373  $sql .= " WHERE ctc.element = '".$db->escape($projectstatic->element)."'";
374  $sql .= " AND ctc.source = 'internal'";
375  $resql = $db->query($sql);
376  if ($resql) {
377  while ($obj = $db->fetch_object($resql)) {
378  $listofprojectcontacttype[$obj->rowid] = $obj->code;
379  }
380  } else {
381  dol_print_error($db);
382  }
383  if (count($listofprojectcontacttype) == 0) {
384  $listofprojectcontacttype[0] = '0'; // To avoid sql syntax error if not found
385  }
386  // Get id of types of contacts for tasks (This list never contains a lot of elements)
387  $listoftaskcontacttype = array();
388  $sql = "SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX."c_type_contact as ctc";
389  $sql .= " WHERE ctc.element = '".$db->escape($taskstatic->element)."'";
390  $sql .= " AND ctc.source = 'internal'";
391  $resql = $db->query($sql);
392  if ($resql) {
393  while ($obj = $db->fetch_object($resql)) {
394  $listoftaskcontacttype[$obj->rowid] = $obj->code;
395  }
396  } else {
397  dol_print_error($db);
398  }
399  if (count($listoftaskcontacttype) == 0) {
400  $listoftaskcontacttype[0] = '0'; // To avoid sql syntax error if not found
401  }
402 
403 
404  // Tasks for all resources of all opened projects and time spent for each task/resource
405  // This list can be very long, so we don't show it by default on task area. We prefer to use the list page.
406  // Add constant PROJECT_SHOW_TASK_LIST_ON_PROJECT_AREA to show this list
407 
408  $max = (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA) ? 1000 : $conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA);
409 
410  $sql = "SELECT p.ref, p.title, p.rowid as projectid, p.fk_statut as status, p.fk_opp_status as opp_status, p.public, p.dateo as projdateo, p.datee as projdatee,";
411  $sql .= " t.label, t.rowid as taskid, t.planned_workload, t.duration_effective, t.progress, t.dateo, t.datee, SUM(tasktime.task_duration) as timespent";
412  $sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
413  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
414  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid";
415  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_time as tasktime on tasktime.fk_task = t.rowid";
416  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on tasktime.fk_user = u.rowid";
417  if ($mine) {
418  $sql .= ", ".MAIN_DB_PREFIX."element_contact as ect";
419  }
420  $sql .= " WHERE p.entity IN (".getEntity('project').")";
421  if ($mine || empty($user->rights->projet->all->lire)) {
422  $sql .= " AND p.rowid IN (".$db->sanitize($projectsListId).")"; // project i have permission on
423  }
424  if ($mine) { // this may duplicate record if we are contact twice
425  $sql .= " AND ect.fk_c_type_contact IN (".$db->sanitize(join(',', array_keys($listoftaskcontacttype))).") AND ect.element_id = t.rowid AND ect.fk_socpeople = ".((int) $user->id);
426  }
427  if ($socid) {
428  $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".((int) $socid).")";
429  }
430  $sql .= " AND p.fk_statut=1";
431  $sql .= " GROUP BY p.ref, p.title, p.rowid, p.fk_statut, p.fk_opp_status, p.public, t.label, t.rowid, t.planned_workload, t.duration_effective, t.progress, t.dateo, t.datee";
432  $sql .= " ORDER BY t.dateo desc, t.rowid desc, t.datee";
433  $sql .= $db->plimit($max + 1); // We want more to know if we have more than limit
434 
435  dol_syslog('projet:index.php: affectationpercent', LOG_DEBUG);
436  $resql = $db->query($sql);
437  if ($resql) {
438  $num = $db->num_rows($resql);
439  $i = 0;
440 
441  //print load_fiche_titre($langs->trans("TasksOnOpenedProject"),'','').'<br>';
442 
443  print '<div class="div-table-responsive-no-min">';
444  print '<table class="noborder centpercent">';
445  print '<tr class="liste_titre">';
446  //print '<th>'.$langs->trans('TaskRessourceLinks').'</th>';
447  print '<th>'.$langs->trans('OpenedProjects').'</th>';
448  if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
449  print '<th>'.$langs->trans('OpportunityStatus').'</th>';
450  }
451  print '<th>'.$langs->trans('Task').'</th>';
452  print '<th class="center">'.$langs->trans('DateStart').'</th>';
453  print '<th class="center">'.$langs->trans('DateEnd').'</th>';
454  print '<th class="right">'.$langs->trans('PlannedWorkload').'</th>';
455  print '<th class="right">'.$langs->trans('TimeSpent').'</th>';
456  print '<th class="right">'.$langs->trans("ProgressCalculated").'</td>';
457  print '<th class="right">'.$langs->trans("ProgressDeclared").'</td>';
458  print '</tr>';
459 
460  while ($i < $num && $i < $max) {
461  $obj = $db->fetch_object($resql);
462 
463  $projectstatic->id = $obj->projectid;
464  $projectstatic->ref = $obj->ref;
465  $projectstatic->title = $obj->title;
466  $projectstatic->statut = $obj->status;
467  $projectstatic->public = $obj->public;
468  $projectstatic->dateo = $db->jdate($obj->projdateo);
469  $projectstatic->datee = $db->jdate($obj->projdatee);
470 
471  $taskstatic->projectstatus = $obj->projectstatus;
472  $taskstatic->progress = $obj->progress;
473  $taskstatic->fk_statut = $obj->status;
474  $taskstatic->dateo = $db->jdate($obj->dateo);
475  $taskstatic->datee = $db->jdate($obj->datee);
476 
477  $username = '';
478  if ($obj->userid && $userstatic->id != $obj->userid) { // We have a user and it is not last loaded user
479  $result = $userstatic->fetch($obj->userid);
480  if (!$result) {
481  $userstatic->id = 0;
482  }
483  }
484  if ($userstatic->id) {
485  $username = $userstatic->getNomUrl(0, 0);
486  }
487 
488  print '<tr class="oddeven">';
489  //print '<td>'.$username.'</td>';
490  print '<td>';
491  print $projectstatic->getNomUrl(1, '', 0, '', '<br>');
492  print '</td>';
493  if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
494  print '<td>';
495  $code = dol_getIdFromCode($db, $obj->opp_status, 'c_lead_status', 'rowid', 'code');
496  if ($code) {
497  print $langs->trans("OppStatus".$code);
498  }
499  print '</td>';
500  }
501  print '<td>';
502  if (!empty($obj->taskid)) {
503  $tasktmp->id = $obj->taskid;
504  $tasktmp->ref = $obj->ref;
505  $tasktmp->label = $obj->label;
506  print $tasktmp->getNomUrl(1, 'withproject', 'task', 1, '<br>');
507  } else {
508  print $langs->trans("NoTasks");
509  }
510  print '</td>';
511  print '<td class="center">'.dol_print_date($db->jdate($obj->dateo), 'day').'</td>';
512  print '<td class="center">'.dol_print_date($db->jdate($obj->datee), 'day');
513  if ($taskstatic->hasDelay()) {
514  print img_warning($langs->trans("Late"));
515  }
516  print '</td>';
517  print '<td class="right"><a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$obj->taskid.'&withproject=1">';
518  print convertSecondToTime($obj->planned_workload, 'allhourmin');
519  print '</a></td>';
520  print '<td class="right"><a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$obj->taskid.'&withproject=1">';
521  print convertSecondToTime($obj->timespent, 'allhourmin');
522  print '</a></td>';
523  print '<td class="right">';
524  if (!empty($obj->taskid)) {
525  if (empty($obj->planned_workload) > 0) {
526  $percentcompletion = $langs->trans("WorkloadNotDefined");
527  } else {
528  $percentcompletion = intval($obj->duration_effective * 100 / $obj->planned_workload).'%';
529  }
530  }
531  print $percentcompletion;
532  print '</td>';
533  print '<td class="right">';
534  print ($obj->taskid > 0) ? $obj->progress.'%' : '';
535  print '</td>';
536  print "</tr>\n";
537 
538  $i++;
539  }
540 
541  if ($num > $max) {
542  $colspan = 6;
543  if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
544  $colspan++;
545  }
546  print '<tr><td colspan="'.$colspan.'">'.$langs->trans("WarningTooManyDataPleaseUseMoreFilters").'</td></tr>';
547  }
548 
549  print "</table>";
550  print '</div>';
551 
552 
553  $db->free($resql);
554  } else {
555  dol_print_error($db);
556  }
557 }
558 
559 
560 print '</div></div>';
561 
562 $parameters = array('user' => $user);
563 $reshook = $hookmanager->executeHooks('dashboardActivities', $parameters, $object); // Note that $action and $object may have been modified by hook
564 
565 // End of page
566 llxFooter();
567 $db->close();
dol_getdate
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
Definition: functions.lib.php:2713
Project
Class to manage projects.
Definition: project.class.php:35
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
dol_print_error
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Definition: functions.lib.php:4844
img_warning
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
Definition: functions.lib.php:4521
Task
Class to manage tasks.
Definition: task.class.php:37
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
convertSecondToTime
convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.
Definition: date.lib.php:236
dol_print_date
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
Definition: functions.lib.php:2514
llxFooter
llxFooter()
Footer empty.
Definition: index.php:71
dol_getIdFromCode
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
Definition: functions.lib.php:8535
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1603
print_barre_liste
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
Definition: functions.lib.php:5257
dol_get_first_day
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
Definition: date.lib.php:551
llxHeader
if(!defined('NOTOKENRENEWAL')) if(!defined('NOLOGIN')) if(!defined('NOCSRFCHECK')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) if(!defined('NOIPCHECK')) if(!defined('NOBROWSERNOTIF')) llxHeader()
Header empty.
Definition: index.php:63
dol_get_last_day
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
Definition: date.lib.php:570
dol_time_plus_duree
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
Definition: date.lib.php:121
dol_now
dol_now($mode='auto')
Return date for now.
Definition: functions.lib.php:2845
$resql
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice') && $user->rights->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->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:742
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Definition: security.lib.php:933
dol_mktime
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
Definition: functions.lib.php:2757
HookManager
Class to manage hooks.
Definition: hookmanager.class.php:30