Fix: Wrong order

This commit is contained in:
Laurent Destailleur 2009-08-10 17:28:07 +00:00
parent 17048fbc32
commit 766cb6cf64
3 changed files with 14 additions and 13 deletions

View File

@ -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.'<br>';
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 "<tr ".$bc[$var].">\n";
// Ref of task

View File

@ -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)

View File

@ -96,8 +96,8 @@ print '<td>'.$langs->trans("LabelTask").'</td>';
print '<td>'.$langs->trans("Project").'</td>';
print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
print "</tr>\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 "</table>";