* [task#133223,doing,1.5h] sync stage data.

This commit is contained in:
tianshujie
2024-12-03 13:25:42 +08:00
committed by 田淑杰
parent b7b6941166
commit 94b82fb8f4
2 changed files with 30 additions and 1 deletions
+4 -1
View File
@@ -329,7 +329,6 @@ class programplanModel extends model
*/
public function create(array $plans, int $projectID = 0, int $productID = 0, int $parentID = 0): bool
{
if(!$this->isCreateTask($parentID)) dao::$errors['message'][] = $this->lang->programplan->error->createdTask;
if(empty($plans)) dao::$errors['message'][] = sprintf($this->lang->error->notempty, $this->lang->programplan->name);
if(dao::isError()) return false;
@@ -343,6 +342,7 @@ class programplanModel extends model
$updateUserViewIdList = array();
$enabledPoints = array();
$parallel = 0;
$firstStageID = 0;
foreach($plans as $plan)
{
$parallel = isset($plan->parallel) ? $plan->parallel : 0;
@@ -374,12 +374,15 @@ class programplanModel extends model
$this->execution->updateProducts($stageID, $linkProducts);
if($plan->acl != 'open') $updateUserViewIdList[] = $stageID;
if(!$firstStageID) $firstStageID = $stageID;
}
}
if($project && $project->model == 'ipd') $this->dao->update(TABLE_PROJECT)->set('parallel')->eq($parallel)->where('id')->eq($projectID)->exec();
if($updateUserViewIdList) $this->loadModel('user')->updateUserView($updateUserViewIdList, 'sprint');
if($enabledPoints) $this->programplanTao->updatePoint($projectID, $enabledPoints);
if(!$this->isCreateTask($parentID) && $firstStageID) $this->programplanTao->syncParentData($firstStageID, $parentID);
return true;
}
+26
View File
@@ -941,4 +941,30 @@ class programplanTao extends programplanModel
return $plans;
}
/**
* 将父阶段数据转移到第一个子阶段中。
* Sync parent data to first stage.
*
* @param int $executionID
* @param int $parentID
* @access protected
* @return bool
*/
protected function syncParentData(int $executionID, int $parentID): bool
{
$this->dao->update(TABLE_TASK)->set('execution')->eq($executionID)->where('execution')->eq($parentID)->exec();
$this->dao->update(TABLE_PROJECTSTORY)->set('project')->eq($executionID)->where('project')->eq($parentID)->exec();
$this->dao->update(TABLE_BUG)->set('execution')->eq($executionID)->where('execution')->eq($parentID)->exec();
$this->dao->update(TABLE_CASE)->set('execution')->eq($executionID)->where('execution')->eq($parentID)->exec();
$this->dao->update(TABLE_PROJECTCASE)->set('project')->eq($executionID)->where('project')->eq($parentID)->exec();
$this->dao->update(TABLE_TESTTASK)->set('execution')->eq($executionID)->where('execution')->eq($parentID)->exec();
$this->dao->update(TABLE_TESTREPORT)->set('execution')->eq($executionID)->where('execution')->eq($parentID)->exec();
$this->dao->update(TABLE_BUILD)->set('execution')->eq($executionID)->where('execution')->eq($parentID)->exec();
$this->dao->update(TABLE_EFFORT)->set('execution')->eq($executionID)->where('execution')->eq($parentID)->exec();
$this->dao->update(TABLE_ACTION)->set('execution')->eq($executionID)->where('execution')->eq($parentID)->andWhere('objectType')->ne('execution')->exec();
$this->dao->update(TABLE_ACTIONRECENT)->set('execution')->eq($executionID)->where('execution')->eq($parentID)->andWhere('objectType')->ne('execution')->exec();
$this->dao->update(TABLE_DOCLIB)->set('execution')->eq($executionID)->where('type')->eq('execution')->andWhere('execution')->eq($parentID)->andWhere('main')->eq('0')->exec();
return !dao::isError();
}
}