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