From b25022e3b036bd57b214d0fb63bdde1bceee0646 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Tue, 7 Mar 2023 06:52:09 +0000 Subject: [PATCH] * Fix bug #31827. --- module/project/control.php | 4 ++-- module/project/model.php | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/module/project/control.php b/module/project/control.php index 260801420f..f6f57af86a 100755 --- a/module/project/control.php +++ b/module/project/control.php @@ -2190,7 +2190,7 @@ class project extends control } $oldProducts = $this->product->getProducts($projectID); - 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'); + if($project->multiple and $project->model != 'waterfall' and $project->model != 'waterfallplus') $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())); @@ -2216,7 +2216,7 @@ class project extends control } } - if($project->multiple and $project->model != 'waterfall') + if($project->multiple and $project->model != 'waterfall' and $project->model != 'waterfallplus') { $unlinkedProducts = array_diff($oldProductIDs, $newProductIDs); if(!empty($unlinkedProducts)) diff --git a/module/project/model.php b/module/project/model.php index ce5b643326..eae3191b79 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -2502,6 +2502,13 @@ class projectModel extends model $this->dao->update(TABLE_PROJECT)->set('division')->eq('1')->where('id')->eq((int)$projectID)->exec(); $this->dao->update(TABLE_EXECUTION)->set('division')->eq('1')->where('project')->eq((int)$projectID)->exec(); } + + $project = $this->getByID($projectID); + if(!empty($project) and ($project->model == 'waterfall' or $project->model == 'waterfallplus') and empty($project->division) and !empty($executions)) + { + $this->loadModel('execution'); + foreach($executions as $executionID) $this->execution->updateProducts($executionID); + } } $oldProductKeys = array_keys($oldProjectProducts);