diff --git a/htdocs/lib/project.lib.php b/htdocs/lib/project.lib.php
index a2e567cdc7f..d6147505987 100644
--- a/htdocs/lib/project.lib.php
+++ b/htdocs/lib/project.lib.php
@@ -249,19 +249,13 @@ function PLines(&$inc, $parent, &$lines, &$level, $var, $showproject=1, &$taskro
for ($i = 0 ; $i < sizeof($lines) ; $i++)
{
- // Process line $lines[$i]
-
if ($parent == 0) $level = 0;
+ // Process line
+ // print "i:".$i."-".$lines[$i]->projectid.'
';
+
if ($lines[$i]->fk_parent == $parent)
{
- // Break on a new project
- if ($parent == 0 && $lines[$i]->projectid != $lastprojectid)
- {
- $var = !$var;
- $lastprojectid=$lines[$i]->projectid;
- }
-
// Show task line.
$showline=1;
$showlineingray=0;
@@ -289,6 +283,13 @@ function PLines(&$inc, $parent, &$lines, &$level, $var, $showproject=1, &$taskro
if ($showline)
{
+ // Break on a new project
+ if ($parent == 0 && $lines[$i]->projectid != $lastprojectid)
+ {
+ $var = !$var;
+ $lastprojectid=$lines[$i]->projectid;
+ }
+
print "
\n";
// Ref of task
diff --git a/htdocs/project.class.php b/htdocs/project.class.php
index de970751464..a86c9e04a6b 100644
--- a/htdocs/project.class.php
+++ b/htdocs/project.class.php
@@ -518,9 +518,9 @@ class Project extends CommonObject
if ($this->id) $sql .= " AND t.fk_projet =".$this->id;
if (is_object($usert)) $sql .= " AND t.fk_projet = p.rowid AND ta.fk_projet_task = t.rowid AND ta.fk_user = ".$usert->id;
if (is_object($userp)) $sql .= " AND (p.fk_user_resp = ".$userp->id." OR p.fk_user_resp IS NULL OR p.fk_user_resp = -1)";
- $sql.= " ORDER BY p.ref, t.title";
}
-
+ $sql.= " ORDER BY p.ref, t.title";
+
dol_syslog("Project::getTasksArray sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
diff --git a/htdocs/projet/tasks/index.php b/htdocs/projet/tasks/index.php
index 32dc8b2d5a1..b3dee5d4b7b 100644
--- a/htdocs/projet/tasks/index.php
+++ b/htdocs/projet/tasks/index.php
@@ -96,8 +96,8 @@ print '| '.$langs->trans("LabelTask").' | ';
print ''.$langs->trans("Project").' | ';
print ''.$langs->trans("TimeSpent").' | ';
print "
\n";
-// Show all lines in taskarray (recusrive function to go down on tree)
-$j=0;
+// Show all lines in taskarray (recursive function to go down on tree)
+$j=0; $level=0;
$nboftaskshown=PLines($j, 0, $tasksarray, $level, true, 1, $tasksrole);
print "";