diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 261b0bd4c9..a03e605b56 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -10062,7 +10062,7 @@ class upgradeModel extends model } /* Process case link case. */ - $caseList = $this->dao->select('id,story,linkCase')->from(TABLE_CASE)->where('linkCase')->ne('')->orWhere('story')->ne(0)->fetchAll('id'); + $caseList = $this->dao->select('id,story,linkCase,fromBug')->from(TABLE_CASE)->where('linkCase')->ne('')->orWhere('story')->ne(0)->orWhere('fromBug')->ne(0)->fetchAll('id'); foreach($caseList as $caseID => $case) { foreach(explode(',', ",{$case->linkCase},") as $relatedCaseID) @@ -10086,6 +10086,16 @@ class upgradeModel extends model $relation->BID = $caseID; $this->dao->replace(TABLE_RELATION)->data($relation)->exec(); } + if(!empty($case->fromBug)) + { + $relation = new stdClass(); + $relation->AType = 'bug'; + $relation->AID = $case->fromBug; + $relation->relation = 'generated'; + $relation->BType = 'testcase'; + $relation->BID = $caseID; + $this->dao->replace(TABLE_RELATION)->data($relation)->exec(); + } } /* Process issue link risk. */