diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php
index b384ccceabe..637d5e6ccca 100644
--- a/htdocs/core/lib/project.lib.php
+++ b/htdocs/core/lib/project.lib.php
@@ -357,7 +357,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
print '';
// Planned Workload (in working hours)
- print '
';
+ print '
';
$fullhour=convertSecondToTime($lines[$i]->planned_workload,'allhourmin');
$workingdelay=convertSecondToTime($lines[$i]->planned_workload,'all',86400,7); // TODO Replace 86400 and 7 to take account working hours per day and working day per weeks
if ($lines[$i]->planned_workload)
@@ -422,7 +422,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
print '
';
diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang
index 32b7d57e9b0..8d5d7c26a53 100644
--- a/htdocs/langs/en_US/projects.lang
+++ b/htdocs/langs/en_US/projects.lang
@@ -36,6 +36,8 @@ TaskTimeSpent=Time spent on tasks
TaskTimeUser=User
TaskTimeNote=Note
TaskTimeDate=Date
+TasksOnOpenedProject=Tasks on opened projects
+WorkloadNotDefined=Workload not defined
NewTimeSpent=New time spent
MyTimeSpent=My time spent
MyTasks=My tasks
diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php
index bba783bf51e..6f83a42f2f3 100644
--- a/htdocs/projet/index.php
+++ b/htdocs/projet/index.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2004-2010 Laurent Destailleur
+ * Copyright (C) 2004-2014 Laurent Destailleur
* Copyright (C) 2005-2010 Regis Houssin
*
* This program is free software; you can redistribute it and/or modify
@@ -49,6 +49,7 @@ $sortorder = GETPOST("sortorder",'alpha');
$socstatic=new Societe($db);
$projectstatic=new Project($db);
+$userstatic=new User($db);
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,($mine?$mine:(empty($user->rights->projet->all->lire)?0:2)),1);
//var_dump($projectsListId);
@@ -156,20 +157,23 @@ print '';
// Tasks for all resources of all opened projects and time spent for each task/resource
print '
';
-$sql = "SELECT p.ref, p.title, p.rowid as projectid, t.label, t.rowid as taskid, u.rowid as userid, t.planned_workload, t.dateo, t.datee, SUM(tasktime.task_duration) as timespent";
+$max = (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA);
+
+$sql = "SELECT p.ref, p.title, p.rowid as projectid, t.label, t.rowid as taskid, t.planned_workload, t.duration_effective, t.progress, t.dateo, t.datee, SUM(tasktime.task_duration) as timespent";
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."projet_task_time as tasktime on tasktime.fk_task = t.rowid";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u on tasktime.fk_user = u.rowid";
$sql.= " WHERE p.entity = ".$conf->entity;
-if ($mine || ! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")";
+if ($mine || empty($user->rights->projet->all->lire)) $sql.= " AND p.rowid IN (".$projectsListId.")";
if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
$sql.= " AND p.fk_statut=1";
-$sql.= " GROUP BY p.ref, p.title, p.rowid, t.label, t.rowid, u.rowid, t.planned_workload, t.dateo, t.datee";
-$sql.= " ORDER BY u.rowid, t.dateo, t.datee";
+$sql.= " GROUP BY p.ref, p.title, p.rowid, t.label, t.rowid, t.planned_workload, t.duration_effective, t.progress, t.dateo, t.datee";
+$sql.= " ORDER BY t.rowid, t.dateo, t.datee";
+$sql.= $db->plimit($max+1); // We want more to know if we have more than limit
-$userstatic=new User($db);
+$var=true;
dol_syslog('projet:index.php: affectationpercent', LOG_DEBUG);
$resql = $db->query($sql);
@@ -178,75 +182,78 @@ if ( $resql )
$num = $db->num_rows($resql);
$i = 0;
- if ($num > (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA))
+ print ' ';
+
+ print_fiche_titre($langs->trans("TasksOnOpenedProject"),'','').' ';
+
+ print '
';
-
- while ($i < $num)
+ $username='';
+ if ($obj->userid && $userstatic->id != $obj->userid) // We have a user and it is not last loaded user
{
- $obj = $db->fetch_object($resql);
- $var=!$var;
-
- $username='';
- if ($obj->userid && $userstatic->id != $obj->userid) // We have a user and it is not last loaded user
- {
- $result=$userstatic->fetch($obj->userid);
- if (! $result) $userstatic->id=0;
- }
- if ($userstatic->id) $username = $userstatic->getNomUrl(0,0);
-
- print "
';
- /* I disable this because information is wrong. This percent has no meaning for a particular resource. What do we want ?
- * Percent of completion ?
- * If we want to show completion, we must remove "user" into list,
- if (empty($obj->planned_workload)) {
- $percentcompletion = $langs->trans("Unknown");
- } else {
- $percentcompletion = intval($obj->task_duration*100/$obj->planned_workload);
- }*/
- print '
';
diff --git a/htdocs/projet/tasks/index.php b/htdocs/projet/tasks/index.php
index cdf90a918a3..caaa134c931 100644
--- a/htdocs/projet/tasks/index.php
+++ b/htdocs/projet/tasks/index.php
@@ -86,7 +86,7 @@ else
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$socid);
// Get list of tasks in tasksarray and taskarrayfiltered
-// We need all tasks (even not limited to a user because a task to user can have a parent that is not affected to him).
+// We need all tasks (even not limited to a user because a task assigned to a user can have a parent that is not assigned to him and we need such parents).
$tasksarray=$taskstatic->getTasksArray(0, 0, $projectstatic->id, $socid, 0, $search_project, $search_status);
// We load also tasks limited to a particular user
$tasksrole=($mine ? $taskstatic->getUserRolesForProjectsOrTasks(0,$user,$projectstatic->id,0) : '');
@@ -126,7 +126,9 @@ print '';
print '