From 537ada96a8680df7d06382cd21d79d993a536428 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 26 Apr 2014 21:47:15 +0200 Subject: [PATCH] Fix: [ bug #1354 ] Tasks disapear in same sub-task Conflicts: htdocs/install/mysql/migration/repair.sql htdocs/projet/class/project.class.php --- htdocs/core/class/html.formother.class.php | 47 +++++--- htdocs/core/lib/functions2.lib.php | 122 +++++++++++++++++++++ htdocs/install/mysql/migration/repair.sql | 3 + htdocs/projet/class/project.class.php | 60 ---------- htdocs/projet/tasks.php | 12 +- htdocs/projet/tasks/task.php | 2 +- 6 files changed, 166 insertions(+), 80 deletions(-) diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index f48ec9e6539..472a1c19668 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -424,16 +424,17 @@ class FormOther /** * Return list of project and tasks * - * @param int $selectedtask Pre-selected task - * @param int $projectid Project id - * @param string $htmlname Name of html select - * @param int $modeproject 1 to restrict on projects owned by user - * @param int $modetask 1 to restrict on tasks associated to user - * @param int $mode 0=Return list of tasks and their projects, 1=Return projects and tasks if exists - * @param int $useempty 0=Allow empty values + * @param int $selectedtask Pre-selected task + * @param int $projectid Project id + * @param string $htmlname Name of html select + * @param int $modeproject 1 to restrict on projects owned by user + * @param int $modetask 1 to restrict on tasks associated to user + * @param int $mode 0=Return list of tasks and their projects, 1=Return projects and tasks if exists + * @param int $useempty 0=Allow empty values + * @param int $disablechildoftaskid 1=Disable task that are child of the provided task id * @return void */ - function selectProjectTasks($selectedtask='', $projectid=0, $htmlname='task_parent', $modeproject=0, $modetask=0, $mode=0, $useempty=0) + function selectProjectTasks($selectedtask='', $projectid=0, $htmlname='task_parent', $modeproject=0, $modetask=0, $mode=0, $useempty=0, $disablechildoftaskid=0) { global $user, $langs; @@ -448,7 +449,7 @@ class FormOther if ($useempty) print ''; $j=0; $level=0; - $this->_pLineSelect($j, 0, $tasksarray, $level, $selectedtask, $projectid); + $this->_pLineSelect($j, 0, $tasksarray, $level, $selectedtask, $projectid, $disablechildoftaskid); print ''; } else @@ -458,17 +459,18 @@ class FormOther } /** - * Write all lines of a project (if parent = 0) + * Write lines of a project (all lines of a project if parent = 0) * * @param int &$inc Cursor counter - * @param int $parent Id parent - * @param Object $lines Line object + * @param int $parent Id of parent task we want to see + * @param array $lines Array of task lines * @param int $level Level * @param int $selectedtask Id selected task * @param int $selectedproject Id selected project + * @param int $disablechildoftaskid 1=Disable task that are child of the provided task id * @return void */ - private function _pLineSelect(&$inc, $parent, $lines, $level=0, $selectedtask=0, $selectedproject=0) + private function _pLineSelect(&$inc, $parent, $lines, $level=0, $selectedtask=0, $selectedproject=0, $disablechildoftaskid=0) { global $langs, $user, $conf; @@ -481,12 +483,12 @@ class FormOther { $var = !$var; - //var_dump($selectedtask."--".$selectedtask."--".$lines[$i]->fk_project."_".$lines[$i]->id); + //var_dump($selectedproject."--".$selectedtask."--".$lines[$i]->fk_project."_".$lines[$i]->id); // Break on a new project - if ($parent == 0) + if ($parent == 0) // We are on a task at first level { - if ($lines[$i]->fk_project != $lastprojectid) + if ($lines[$i]->fk_project != $lastprojectid) // Break found on project { if ($i > 0 && $conf->browser->firefox) print ''; print '