diff --git a/module/tree/model.php b/module/tree/model.php index 5971b0c427..6cb96e74da 100644 --- a/module/tree/model.php +++ b/module/tree/model.php @@ -1396,6 +1396,7 @@ class treeModel extends model $this->fixModulePath($module->root, $module->type); + if($module->type == 'line') $this->dao->update(TABLE_PRODUCT)->set('line')->eq('0')->where('line')->eq($moduleID)->exec(); if($module->type == 'task') $this->dao->update(TABLE_TASK)->set('module')->eq($module->parent)->where('module')->in($childs)->exec(); if($module->type == 'bug') $this->dao->update(TABLE_BUG)->set('module')->eq($module->parent)->where('module')->in($childs)->exec(); if($module->type == 'case') $this->dao->update(TABLE_CASE)->set('module')->eq($module->parent)->where('module')->in($childs)->exec(); diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 4dd59a3924..ab5780e094 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -211,6 +211,7 @@ class upgradeModel extends model $this->execSQL($this->getUpgradeFile('9.8.1')); $this->fixTaskAssignedTo(); $this->fixProjectClosedInfo(); + $this->resetProductLine(); } $this->deletePatch(); @@ -2237,4 +2238,17 @@ class upgradeModel extends model } return !dao::isError(); } + + /** + * Set the value of deleted product line to 0. + * + * @access public + * @return bool + */ + public function resetProductLine() + { + $deletedLines = $this->dao->select('id')->from(TABLE_MODULE)->where('type')->eq('line')->andWhere('deleted')->eq('1')->fetchPairs(); + $this->dao->update(TABLE_PRODUCT)->set('line')->eq(0)->where('line')->in($deletedLines)->exec(); + return !dao::isError(); + } }