* Fix bug #23855.
This commit is contained in:
@@ -11,3 +11,5 @@ 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 ('project', 'sprint', 'kanban');
|
||||
|
||||
@@ -1335,17 +1335,16 @@ class programModel extends model
|
||||
/* Process child node path and grade field. */
|
||||
foreach($childNodes as $childNode)
|
||||
{
|
||||
$path = substr($childNode->path, strpos($childNode->path, ",{$programID},"));
|
||||
$grade = $childNode->grade - $oldGrade + 1;
|
||||
$path = substr($childNode->path, strpos($childNode->path, ",{$programID},"));
|
||||
|
||||
/* Only program sets update grade. */
|
||||
$grade = $childNode->type == 'program' ? $childNode->grade - $oldGrade + 1 : $childNode->grade;
|
||||
if($parent)
|
||||
{
|
||||
$path = rtrim($parent->path, ',') . $path;
|
||||
$grade = $parent->grade + $grade;
|
||||
$grade = $childNode->type == 'program' ? $parent->grade + $grade : $grade;
|
||||
}
|
||||
|
||||
/* Only program sets update grade. */
|
||||
if($childNode->type != 'program') $grade = $childNode->grade;
|
||||
|
||||
$this->dao->update(TABLE_PROGRAM)->set('path')->eq($path)->set('grade')->eq($grade)->where('id')->eq($childNode->id)->exec();
|
||||
}
|
||||
|
||||
|
||||
@@ -513,6 +513,7 @@ class upgradeModel extends model
|
||||
break;
|
||||
case '17_0':
|
||||
$this->replaceSetLanePriv();
|
||||
$this->updateGradeOfStage();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -6358,4 +6359,26 @@ class upgradeModel extends model
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update grade of stage.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function updateGradeOfStage()
|
||||
{
|
||||
$allStages = $this->dao->select('*')->from(TABLE_EXECUTION)->where('type')->eq('stage')->fetchAll('id');
|
||||
$updateIDList = array();
|
||||
foreach($allStages as $stageID => $stage)
|
||||
{
|
||||
if($stage->project != $stage->parent) $updateIDList[$stageID] = $stageID;
|
||||
}
|
||||
|
||||
if(!empty($updateIDList))
|
||||
{
|
||||
$this->dao->update(TABLE_EXECUTION)->set('grade')->eq(2)->where('type')->eq('stage')->andWhere('id')->in($updateIDList)->exec();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user