* Fix bug #23855.
This commit is contained in:
@@ -11,5 +11,3 @@ DELETE FROM `zt_workflowaction` WHERE `module`='task' AND `action`='browse';
|
||||
DELETE FROM `zt_workflowaction` WHERE `module`='build' AND `action`='browse';
|
||||
|
||||
ALTER TABLE `zt_projectproduct` MODIFY COLUMN `plan` varchar(255) NOT NULL;
|
||||
|
||||
UPDATE `zt_project` SET `grade`=1 WHERE `type` in ('sprint', 'kanban');
|
||||
|
||||
@@ -1337,7 +1337,7 @@ class programModel extends model
|
||||
{
|
||||
$path = substr($childNode->path, strpos($childNode->path, ",{$programID},"));
|
||||
|
||||
/* Only program sets update grade. */
|
||||
/* Only program and project sets update grade. */
|
||||
$grade = in_array($childNode->type, array('program', 'project')) ? $childNode->grade - $oldGrade + 1 : $childNode->grade;
|
||||
if($parent)
|
||||
{
|
||||
|
||||
+66
-10
@@ -513,7 +513,7 @@ class upgradeModel extends model
|
||||
break;
|
||||
case '17_0':
|
||||
$this->replaceSetLanePriv();
|
||||
$this->updateGradeOfStage();
|
||||
$this->updateObjectData();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -6361,24 +6361,80 @@ class upgradeModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Update grade of stage.
|
||||
* Update path and grade of program, project and execution.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
* @return bool
|
||||
*/
|
||||
public function updateGradeOfStage()
|
||||
public function updateObjectData()
|
||||
{
|
||||
$allStages = $this->dao->select('*')->from(TABLE_EXECUTION)->where('type')->eq('stage')->fetchAll('id');
|
||||
$updateIDList = array();
|
||||
foreach($allStages as $stageID => $stage)
|
||||
/* Process programs. */
|
||||
$programs = $this->dao->select('id,parent,grade,path')->from(TABLE_PROJECT)->where('type')->eq('program')->orderBy('parent_asc')->fetchAll('id');
|
||||
foreach($programs as $program)
|
||||
{
|
||||
if($stage->project != $stage->parent) $updateIDList[$stageID] = $stageID;
|
||||
if(!$program->parent)
|
||||
{
|
||||
$program->grade = 1;
|
||||
$program->path = ",$program->id,";
|
||||
}
|
||||
else
|
||||
{
|
||||
$program->grade = $programs[$program->parent]->grade + 1;
|
||||
$program->path = $programs[$program->parent]->path . "$program->id,";
|
||||
}
|
||||
|
||||
$this->dao->update(TABLE_PROGRAM)
|
||||
->set('path')->eq($program->path)
|
||||
->set('grade')->eq($program->grade)
|
||||
->where('id')->eq($program->id)->exec();
|
||||
}
|
||||
|
||||
if(!empty($updateIDList))
|
||||
/* Process projects. */
|
||||
$projects = $this->dao->select('id,project,parent,grade,path')->from(TABLE_PROJECT)->where('type')->eq('project')->orderBy('parent_asc')->fetchAll('id');
|
||||
foreach($projects as $project)
|
||||
{
|
||||
$this->dao->update(TABLE_EXECUTION)->set('grade')->eq(2)->where('type')->eq('stage')->andWhere('id')->in($updateIDList)->exec();
|
||||
if(!$project->parent)
|
||||
{
|
||||
$project->grade = 1;
|
||||
$project->path = ",$project->id,";
|
||||
}
|
||||
else
|
||||
{
|
||||
$project->grade = $programs[$project->parent]->grade + 1;
|
||||
$project->path = $programs[$project->parent]->path . "$project->id,";
|
||||
}
|
||||
|
||||
$this->dao->update(TABLE_PROJECT)
|
||||
->set('path')->eq($project->path)
|
||||
->set('grade')->eq($project->grade)
|
||||
->where('id')->eq($project->id)->exec();
|
||||
}
|
||||
|
||||
/* Process executions. */
|
||||
$sprints = $this->dao->select('id,project,parent,grade,path')->from(TABLE_PROJECT)
|
||||
->where('type')->ne('project')
|
||||
->andWhere('type')->ne('program')
|
||||
->orderBy('parent_asc')->fetchAll('id');
|
||||
|
||||
foreach($sprints as $sprint)
|
||||
{
|
||||
if($sprint->parent == $sprint->project)
|
||||
{
|
||||
$sprint->grade = 1;
|
||||
$sprint->path = ",$sprint->project,$sprint->id,";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sprint->grade = 2;
|
||||
$sprint->path = $sprints[$sprint->parent]->path . "$sprint->id,";
|
||||
}
|
||||
|
||||
$this->dao->update(TABLE_EXECUTION)
|
||||
->set('path')->eq($sprint->path)
|
||||
->set('grade')->eq($sprint->grade)
|
||||
->where('id')->eq($sprint->id)->exec();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user