dolibarr  17.0.4
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 $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
70 $taskstatic = new Task($db);
71 $tasktmp = new Task($db);
72 
73 $title = $langs->trans("Activities");
74 //if ($mine) $title=$langs->trans("MyActivities");
75 
76 llxHeader("", $title);
77 
78 
79 // Title for combo list see all projects
80 $titleall = $langs->trans("AllAllowedProjects");
81 if (!empty($user->rights->projet->all->lire) && !$socid) {
82  $titleall = $langs->trans("AllProjects");
83 } else {
84  $titleall = $langs->trans("AllAllowedProjects").'<br><br>';
85 }
86 
87 
88 $morehtml = '';
89 $morehtml .= '<form name="projectform">';
90 $morehtml .= '<SELECT name="mode">';
91 $morehtml .= '<option name="all" value="all"'.($mine ? '' : ' selected').'>'.$titleall.'</option>';
92 $morehtml .= '<option name="mine" value="'.$user->id.'"'.(($search_project_user == $user->id) ? ' selected' : '').'>'.$langs->trans("ProjectsImContactFor").'</option>';
93 $morehtml .= '</SELECT>';
94 $morehtml .= '<input type="submit" class="button" name="refresh" value="'.$langs->trans("Refresh").'">';
95 
96 if ($mine) {
97  $tooltiphelp = $langs->trans("MyTasksDesc");
98 } else {
99  if ($user->rights->projet->all->lire && !$socid) {
100  $tooltiphelp = $langs->trans("TasksDesc");
101  } else {
102  $tooltiphelp = $langs->trans("TasksPublicDesc");
103  }
104 }
105 
106 print_barre_liste($form->textwithpicto($title, $tooltiphelp), 0, $_SERVER["PHP_SELF"], '', '', '', '', 0, -1, 'projecttask', 0, $morehtml);
107 
108 print '<div class="fichecenter"><div class="fichethirdleft">';
109 
110 /* Show list of project today */
111 
112 print '<div class="div-table-responsive-no-min">';
113 print '<table class="noborder centpercent">';
114 print '<tr class="liste_titre">';
115 print '<td width="50%">'.$langs->trans('ActivityOnProjectToday').'</td>';
116 print '<td width="50%" class="right">'.$langs->trans("Time").'</td>';
117 print "</tr>\n";
118 
119 $sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb";
120 $sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
121 $sql .= ", ".MAIN_DB_PREFIX."projet_task as t";
122 $sql .= ", ".MAIN_DB_PREFIX."projet_task_time as tt";
123 $sql .= " WHERE t.fk_projet = p.rowid";
124 $sql .= " AND p.entity = ".((int) $conf->entity);
125 $sql .= " AND tt.fk_task = t.rowid";
126 $sql .= " AND tt.fk_user = ".((int) $user->id);
127 $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))."'";
128 $sql .= " AND p.rowid in (".$db->sanitize($projectsListId).")";
129 $sql .= " GROUP BY p.rowid, p.ref, p.title, p.public";
130 
131 $resql = $db->query($sql);
132 if ($resql) {
133  $total = 0;
134 
135  while ($row = $db->fetch_object($resql)) {
136  print '<tr class="oddeven">';
137  print '<td>';
138  $projectstatic->id = $row->rowid;
139  $projectstatic->ref = $row->ref;
140  $projectstatic->title = $row->title;
141  $projectstatic->public = $row->public;
142  print $projectstatic->getNomUrl(1, '', 1);
143  print '</td>';
144  print '<td class="right">'.convertSecondToTime($row->nb, 'allhourmin').'</td>';
145  print "</tr>\n";
146  $total += $row->nb;
147  }
148 
149  $db->free($resql);
150 } else {
151  dol_print_error($db);
152 }
153 print '<tr class="liste_total">';
154 print '<td>'.$langs->trans('Total').'</td>';
155 print '<td class="right">'.convertSecondToTime($total, 'allhourmin').'</td>';
156 print "</tr>\n";
157 print "</table>";
158 print '</div>';
159 
160 
161 print '</div><div class="fichetwothirdright">';
162 
163 
164 /* Affichage de la liste des projets d'hier */
165 print '<div class="div-table-responsive-no-min">';
166 print '<table class="noborder centpercent">';
167 print '<tr class="liste_titre">';
168 print '<td>'.$langs->trans('ActivityOnProjectYesterday').'</td>';
169 print '<td class="right">'.$langs->trans("Time").'</td>';
170 print "</tr>\n";
171 
172 $sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb";
173 $sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
174 $sql .= ", ".MAIN_DB_PREFIX."projet_task as t";
175 $sql .= ", ".MAIN_DB_PREFIX."projet_task_time as tt";
176 $sql .= " WHERE t.fk_projet = p.rowid";
177 $sql .= " AND p.entity = ".((int) $conf->entity);
178 $sql .= " AND tt.fk_task = t.rowid";
179 $sql .= " AND tt.fk_user = ".((int) $user->id);
180 $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'))."'";
181 $sql .= " AND p.rowid in (".$db->sanitize($projectsListId).")";
182 $sql .= " GROUP BY p.rowid, p.ref, p.title, p.public";
183 
184 $resql = $db->query($sql);
185 if ($resql) {
186  $total = 0;
187 
188  while ($row = $db->fetch_object($resql)) {
189  print '<tr class="oddeven">';
190  print '<td>';
191  $projectstatic->id = $row->rowid;
192  $projectstatic->ref = $row->ref;
193  $projectstatic->title = $row->title;
194  $projectstatic->public = $row->public;
195  print $projectstatic->getNomUrl(1, '', 1);
196  print '</td>';
197  print '<td class="right">'.convertSecondToTime($row->nb, 'allhourmin').'</td>';
198  print "</tr>\n";
199  $total += $row->nb;
200  }
201 
202  $db->free($resql);
203 } else {
204  dol_print_error($db);
205 }
206 print '<tr class="liste_total">';
207 print '<td>'.$langs->trans('Total').'</td>';
208 print '<td class="right">'.convertSecondToTime($total, 'allhourmin').'</td>';
209 print "</tr>\n";
210 print "</table>";
211 print '</div>';
212 
213 
214 
215 /*
216 if ($db->type != 'pgsql')
217 {
218  print '<br>';
219 
220  // Affichage de la liste des projets de la semaine
221  print '<div class="div-table-responsive-no-min">';
222  print '<table class="noborder centpercent">';
223  print '<tr class="liste_titre">';
224  print '<td>'.$langs->trans("ActivityOnProjectThisWeek").'</td>';
225  print '<td class="right">'.$langs->trans("Time").'</td>';
226  print "</tr>\n";
227 
228  $sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb";
229  $sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
230  $sql.= " , ".MAIN_DB_PREFIX."projet_task as t";
231  $sql.= " , ".MAIN_DB_PREFIX."projet_task_time as tt";
232  $sql.= " WHERE t.fk_projet = p.rowid";
233  $sql.= " AND p.entity = ".((int) $conf->entity);
234  $sql.= " AND tt.fk_task = t.rowid";
235  $sql.= " AND tt.fk_user = ".((int) $user->id);
236  $sql.= " AND task_date >= '".$db->idate(dol_get_first_day($year, $month)).'" AND ...";
237  $sql.= " AND p.rowid in (".$db->sanitize($projectsListId).")";
238  $sql.= " GROUP BY p.rowid, p.ref, p.title";
239 
240  $resql = $db->query($sql);
241  if ( $resql )
242  {
243  $total = 0;
244 
245  while ($row = $db->fetch_object($resql))
246  {
247  print '<tr class="oddeven">';
248  print '<td>';
249  $projectstatic->id=$row->rowid;
250  $projectstatic->ref=$row->ref;
251  $projectstatic->title=$row->title;
252  $projectstatic->public=$row->public;
253  print $projectstatic->getNomUrl(1, '', 1);
254  print '</td>';
255  print '<td class="right">'.convertSecondToTime($row->nb, 'allhourmin').'</td>';
256  print "</tr>\n";
257  $total += $row->nb;
258  }
259 
260  $db->free($resql);
261  }
262  else
263  {
264  dol_print_error($db);
265  }
266  print '<tr class="liste_total">';
267  print '<td>'.$langs->trans('Total').'</td>';
268  print '<td class="right">'.convertSecondToTime($total, 'allhourmin').'</td>';
269  print "</tr>\n";
270  print "</table></div><br>";
271 
272 }
273 */
274 
275 /* Affichage de la liste des projets du mois */
276 if (!empty($conf->global->PROJECT_TASK_TIME_MONTH)) {
277  print '<div class="div-table-responsive-no-min">';
278  print '<table class="noborder centpercent">';
279  print '<tr class="liste_titre">';
280  print '<td>'.$langs->trans("ActivityOnProjectThisMonth").': '.dol_print_date($now, "%B %Y").'</td>';
281  print '<td class="right">'.$langs->trans("Time").'</td>';
282  print "</tr>\n";
283 
284  $sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb";
285  $sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
286  $sql .= ", ".MAIN_DB_PREFIX."projet_task as t";
287  $sql .= ", ".MAIN_DB_PREFIX."projet_task_time as tt";
288  $sql .= " WHERE t.fk_projet = p.rowid";
289  $sql .= " AND p.entity = ".((int) $conf->entity);
290  $sql .= " AND tt.fk_task = t.rowid";
291  $sql .= " AND tt.fk_user = ".((int) $user->id);
292  $sql .= " AND task_date BETWEEN '".$db->idate(dol_get_first_day($year, $month))."' AND '".$db->idate(dol_get_last_day($year, $month))."'";
293  $sql .= " AND p.rowid in (".$db->sanitize($projectsListId).")";
294  $sql .= " GROUP BY p.rowid, p.ref, p.title, p.public";
295 
296  $resql = $db->query($sql);
297  if ($resql) {
298  while ($row = $db->fetch_object($resql)) {
299  print '<tr class="oddeven">';
300  print '<td>';
301  $projectstatic->id = $row->rowid;
302  $projectstatic->ref = $row->ref;
303  $projectstatic->title = $row->title;
304  print $projectstatic->getNomUrl(1, '', 1);
305  print '</td>';
306  print '<td class="right">'.convertSecondToTime($row->nb, 'allhourmin').'</td>';
307  print "</tr>\n";
308  }
309  $db->free($resql);
310  } else {
311  dol_print_error($db);
312  }
313  print '<tr class="liste_total">';
314  print '<td>'.$langs->trans('Total').'</td>';
315  print '<td class="right">'.convertSecondToTime($total, 'allhourmin').'</td>';
316  print "</tr>\n";
317  print "</table>";
318  print '</div>';
319 }
320 
321 /* Affichage de la liste des projets de l'annee */
322 if (!empty($conf->global->PROJECT_TASK_TIME_YEAR)) {
323  print '<div class="div-table-responsive-no-min">';
324  print '<br><table class="noborder centpercent">';
325  print '<tr class="liste_titre">';
326  print '<td>'.$langs->trans("ActivityOnProjectThisYear").': '.strftime("%Y", $now).'</td>';
327  print '<td class="right">'.$langs->trans("Time").'</td>';
328  print "</tr>\n";
329 
330  $sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb";
331  $sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
332  $sql .= ", ".MAIN_DB_PREFIX."projet_task as t";
333  $sql .= ", ".MAIN_DB_PREFIX."projet_task_time as tt";
334  $sql .= " WHERE t.fk_projet = p.rowid";
335  $sql .= " AND p.entity = ".((int) $conf->entity);
336  $sql .= " AND tt.fk_task = t.rowid";
337  $sql .= " AND tt.fk_user = ".((int) $user->id);
338  $sql .= " AND YEAR(task_date) = '".strftime("%Y", $now)."'";
339  $sql .= " AND p.rowid in (".$db->sanitize($projectsListId).")";
340  $sql .= " GROUP BY p.rowid, p.ref, p.title, p.public";
341 
342  $resql = $db->query($sql);
343  if ($resql) {
344  while ($row = $db->fetch_object($resql)) {
345  print '<tr class="oddeven">';
346  print '<td>';
347  $projectstatic->id = $row->rowid;
348  $projectstatic->ref = $row->ref;
349  $projectstatic->title = $row->title;
350  $projectstatic->public = $row->public;
351  print $projectstatic->getNomUrl(1, '', 1);
352  print '</td>';
353  print '<td class="right">'.convertSecondToTime($row->nb, 'allhourmin').'</td>';
354  print "</tr>\n";
355  }
356  $db->free($resql);
357  } else {
358  dol_print_error($db);
359  }
360  print '<tr class="liste_total">';
361  print '<td>'.$langs->trans('Total').'</td>';
362  print '<td class="right">'.convertSecondToTime($total, 'allhourmin').'</td>';
363  print "</tr>\n";
364  print "</table>";
365  print '</div>';
366 }
367 
368 if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_SHOW_TASK_LIST_ON_PROJECT_AREA)) {
369  // Get id of types of contacts for projects (This list never contains a lot of elements)
370  $listofprojectcontacttype = array();
371  $sql = "SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX."c_type_contact as ctc";
372  $sql .= " WHERE ctc.element = '".$db->escape($projectstatic->element)."'";
373  $sql .= " AND ctc.source = 'internal'";
374  $resql = $db->query($sql);
375  if ($resql) {
376  while ($obj = $db->fetch_object($resql)) {
377  $listofprojectcontacttype[$obj->rowid] = $obj->code;
378  }
379  } else {
380  dol_print_error($db);
381  }
382  if (count($listofprojectcontacttype) == 0) {
383  $listofprojectcontacttype[0] = '0'; // To avoid sql syntax error if not found
384  }
385  // Get id of types of contacts for tasks (This list never contains a lot of elements)
386  $listoftaskcontacttype = array();
387  $sql = "SELECT ctc.rowid, ctc.code FROM ".MAIN_DB_PREFIX."c_type_contact as ctc";
388  $sql .= " WHERE ctc.element = '".$db->escape($taskstatic->element)."'";
389  $sql .= " AND ctc.source = 'internal'";
390  $resql = $db->query($sql);
391  if ($resql) {
392  while ($obj = $db->fetch_object($resql)) {
393  $listoftaskcontacttype[$obj->rowid] = $obj->code;
394  }
395  } else {
396  dol_print_error($db);
397  }
398  if (count($listoftaskcontacttype) == 0) {
399  $listoftaskcontacttype[0] = '0'; // To avoid sql syntax error if not found
400  }
401 
402 
403  // Tasks for all resources of all opened projects and time spent for each task/resource
404  // This list can be very long, so we don't show it by default on task area. We prefer to use the list page.
405  // Add constant PROJECT_SHOW_TASK_LIST_ON_PROJECT_AREA to show this list
406 
407  $max = (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA) ? 1000 : $conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA);
408 
409  $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,";
410  $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";
411  $sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
412  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
413  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid";
414  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_time as tasktime on tasktime.fk_task = t.rowid";
415  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on tasktime.fk_user = u.rowid";
416  if ($mine) {
417  $sql .= ", ".MAIN_DB_PREFIX."element_contact as ect";
418  }
419  $sql .= " WHERE p.entity IN (".getEntity('project').")";
420  if ($mine || empty($user->rights->projet->all->lire)) {
421  $sql .= " AND p.rowid IN (".$db->sanitize($projectsListId).")"; // project i have permission on
422  }
423  if ($mine) { // this may duplicate record if we are contact twice
424  $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);
425  }
426  if ($socid) {
427  $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".((int) $socid).")";
428  }
429  $sql .= " AND p.fk_statut=1";
430  $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";
431  $sql .= " ORDER BY t.dateo desc, t.rowid desc, t.datee";
432  $sql .= $db->plimit($max + 1); // We want more to know if we have more than limit
433 
434  dol_syslog('projet:index.php: affectationpercent', LOG_DEBUG);
435  $resql = $db->query($sql);
436  if ($resql) {
437  $num = $db->num_rows($resql);
438  $i = 0;
439 
440  //print load_fiche_titre($langs->trans("TasksOnOpenedProject"),'','').'<br>';
441 
442  print '<div class="div-table-responsive-no-min">';
443  print '<table class="noborder centpercent">';
444  print '<tr class="liste_titre">';
445  //print '<th>'.$langs->trans('TaskRessourceLinks').'</th>';
446  print '<th>'.$langs->trans('OpenedProjects').'</th>';
447  if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
448  print '<th>'.$langs->trans('OpportunityStatus').'</th>';
449  }
450  print '<th>'.$langs->trans('Task').'</th>';
451  print '<th class="center">'.$langs->trans('DateStart').'</th>';
452  print '<th class="center">'.$langs->trans('DateEnd').'</th>';
453  print '<th class="right">'.$langs->trans('PlannedWorkload').'</th>';
454  print '<th class="right">'.$langs->trans('TimeSpent').'</th>';
455  print '<th class="right">'.$langs->trans("ProgressCalculated").'</td>';
456  print '<th class="right">'.$langs->trans("ProgressDeclared").'</td>';
457  print '</tr>';
458 
459  while ($i < $num && $i < $max) {
460  $obj = $db->fetch_object($resql);
461 
462  $projectstatic->id = $obj->projectid;
463  $projectstatic->ref = $obj->ref;
464  $projectstatic->title = $obj->title;
465  $projectstatic->statut = $obj->status;
466  $projectstatic->public = $obj->public;
467  $projectstatic->dateo = $db->jdate($obj->projdateo);
468  $projectstatic->datee = $db->jdate($obj->projdatee);
469 
470  $taskstatic->projectstatus = $obj->projectstatus;
471  $taskstatic->progress = $obj->progress;
472  $taskstatic->fk_statut = $obj->status;
473  $taskstatic->dateo = $db->jdate($obj->dateo);
474  $taskstatic->datee = $db->jdate($obj->datee);
475 
476  $username = '';
477  if ($obj->userid && $userstatic->id != $obj->userid) { // We have a user and it is not last loaded user
478  $result = $userstatic->fetch($obj->userid);
479  if (!$result) {
480  $userstatic->id = 0;
481  }
482  }
483  if ($userstatic->id) {
484  $username = $userstatic->getNomUrl(0, 0);
485  }
486 
487  print '<tr class="oddeven">';
488  //print '<td>'.$username.'</td>';
489  print '<td>';
490  print $projectstatic->getNomUrl(1, '', 0, '', '<br>');
491  print '</td>';
492  if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
493  print '<td>';
494  $code = dol_getIdFromCode($db, $obj->opp_status, 'c_lead_status', 'rowid', 'code');
495  if ($code) {
496  print $langs->trans("OppStatus".$code);
497  }
498  print '</td>';
499  }
500  print '<td>';
501  if (!empty($obj->taskid)) {
502  $tasktmp->id = $obj->taskid;
503  $tasktmp->ref = $obj->ref;
504  $tasktmp->label = $obj->label;
505  print $tasktmp->getNomUrl(1, 'withproject', 'task', 1, '<br>');
506  } else {
507  print $langs->trans("NoTasks");
508  }
509  print '</td>';
510  print '<td class="center">'.dol_print_date($db->jdate($obj->dateo), 'day').'</td>';
511  print '<td class="center">'.dol_print_date($db->jdate($obj->datee), 'day');
512  if ($taskstatic->hasDelay()) {
513  print img_warning($langs->trans("Late"));
514  }
515  print '</td>';
516  print '<td class="right"><a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$obj->taskid.'&withproject=1">';
517  print convertSecondToTime($obj->planned_workload, 'allhourmin');
518  print '</a></td>';
519  print '<td class="right"><a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$obj->taskid.'&withproject=1">';
520  print convertSecondToTime($obj->timespent, 'allhourmin');
521  print '</a></td>';
522  print '<td class="right">';
523  if (!empty($obj->taskid)) {
524  if (empty($obj->planned_workload) > 0) {
525  $percentcompletion = $langs->trans("WorkloadNotDefined");
526  } else {
527  $percentcompletion = intval($obj->duration_effective * 100 / $obj->planned_workload).'%';
528  }
529  }
530  print $percentcompletion;
531  print '</td>';
532  print '<td class="right">';
533  print ($obj->taskid > 0) ? $obj->progress.'%' : '';
534  print '</td>';
535  print "</tr>\n";
536 
537  $i++;
538  }
539 
540  if ($num > $max) {
541  $colspan = 6;
542  if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
543  $colspan++;
544  }
545  print '<tr><td colspan="'.$colspan.'">'.$langs->trans("WarningTooManyDataPleaseUseMoreFilters").'</td></tr>';
546  }
547 
548  print "</table>";
549  print '</div>';
550 
551 
552  $db->free($resql);
553  } else {
554  dol_print_error($db);
555  }
556 }
557 
558 
559 print '</div></div>';
560 
561 $parameters = array('user' => $user);
562 $reshook = $hookmanager->executeHooks('dashboardActivities', $parameters, $object); // Note that $action and $object may have been modified by hook
563 
564 // End of page
565 llxFooter();
566 $db->close();
Class to manage hooks.
Class to manage projects.
Class to manage tasks.
Definition: task.class.php:38
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:745
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:575
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
Definition: date.lib.php:121
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:238
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
Definition: date.lib.php:594
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.