Merge branch 'sprint/189_zhouxudong_53651' into 'master'

Sprint/189 zhouxudong 53651

See merge request easycorp/zentaopms!3323
This commit is contained in:
孙广明
2022-05-11 05:51:12 +00:00
6 changed files with 40 additions and 17 deletions
+21
View File
@@ -684,6 +684,27 @@ class executionModel extends model
$projectID = isset($execution->project) ? $execution->project : $oldExecution->project;
$project = $this->project->getByID($projectID);
if(isset($execution->project))
{
$executionProductList = $this->loadModel('product')->getProducts($executionID);
$projectProductList = $this->product->getProducts($execution->project);
$executionProductIdList = array_keys($executionProductList);
$projectProductIdList = array_keys($projectProductList);
$diffProductIdList = array_diff($executionProductIdList, $projectProductIdList);
if(!empty($diffProductIdList))
{
foreach($diffProductIdList as $key => $newProductID)
{
$data = $this->dao->select('*')->from(TABLE_PROJECTPRODUCT)
->where('project')->eq($executionID)
->andWhere('product')->eq($newProductID)
->fetch();
$data->project = $execution->project;
$this->dao->insert(TABLE_PROJECTPRODUCT)->data($data)->exec();
}
}
}
if($project and $execution->begin < $project->begin)
{
dao::$errors['begin'] = sprintf($this->lang->execution->errorLetterProject, $project->begin);