Merge branch 'master_xieqiyu_31948' into 'master'

* Code for bug#31948.

See merge request easycorp/zentaopms!6872
This commit is contained in:
王怡栋
2023-02-07 06:56:13 +00:00
2 changed files with 19 additions and 7 deletions
+13 -7
View File
@@ -2171,7 +2171,8 @@ class project extends control
$this->loadModel('program');
$this->loadModel('execution');
$project = $this->project->getById($projectID);
$project = $this->project->getById($projectID);
$executions = $this->execution->getPairs($projectID);
if(!empty($_POST))
{
@@ -2182,11 +2183,7 @@ class project extends control
}
$oldProducts = $this->product->getProducts($projectID);
if($project->multiple and $project->model != 'waterfall')
{
$executions = $this->dao->select('id')->from(TABLE_EXECUTION)->where('project')->eq($projectID)->fetchPairs('id');
$oldExecutionProducts = $this->dao->select('project,product')->from(TABLE_PROJECTPRODUCT)->where('project')->in($executions)->fetchGroup('project', 'product');
}
if($project->multiple and $project->model != 'waterfall') $oldExecutionProducts = $this->dao->select('project,product')->from(TABLE_PROJECTPRODUCT)->where('project')->in(array_keys($executions))->fetchGroup('project', 'product');
$this->project->updateProducts($projectID);
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
@@ -2203,6 +2200,15 @@ class project extends control
$diffProducts = array_merge(array_diff($oldProductIDs, $newProductIDs), array_diff($newProductIDs, $oldProductIDs));
if($diffProducts) $this->loadModel('action')->create('project', $projectID, 'Managed', '', !empty($_POST['products']) ? join(',', $_POST['products']) : '');
if(empty($project->division))
{
foreach(array_keys($executions) as $executionID)
{
$this->execution->updateProducts($executionID);
if($diffProducts) $this->loadModel('action')->create('execution', $executionID, 'Managed', '', implode(',', array_keys($newProducts)));
}
}
if($project->multiple and $project->model != 'waterfall')
{
$unlinkedProducts = array_diff($oldProductIDs, $newProductIDs);
@@ -2317,7 +2323,7 @@ class project extends control
$this->view->unmodifiableBranches = $unmodifiableBranches;
$this->view->unmodifiableMainBranches = $unmodifiableMainBranches;
$this->view->branchGroups = $branchGroups;
$this->view->executions = $this->execution->getPairs($projectID);
$this->view->executions = $executions;
$this->view->allBranches = $this->branch->getByProducts(array_keys($allProducts), 'ignoreNormal');
$this->view->allProducts = $allProducts;
+6
View File
@@ -1634,6 +1634,12 @@ class projectModel extends model
if(!dao::isError())
{
$this->updateProducts($projectID, $_POST['products']);
if(empty($oldProject->division))
{
$executions = $this->loadModel('execution')->getPairs($projectID);
foreach(array_keys($executions) as $executionID) $this->execution->updateProducts($executionID);
}
$this->file->updateObjectID($this->post->uid, $projectID, 'project');
$whitelist = explode(',', $project->whitelist);