* Fix project and product relation bug.

This commit is contained in:
孙广明
2021-11-24 14:01:50 +08:00
parent 0913466eb7
commit 59172b420e
+5 -2
View File
@@ -1614,8 +1614,11 @@ class projectModel extends model
}
/* Delete the execution linked products that is not linked with the execution. */
$executions = $this->dao->select('id')->from(TABLE_EXECUTION)->where('project')->eq((int)$projectID)->fetchPairs('id');
$this->dao->delete()->from(TABLE_PROJECTPRODUCT)->where('project')->in($executions)->andWhere('product')->notin($products)->exec();
if($projectID)
{
$executions = $this->dao->select('id')->from(TABLE_EXECUTION)->where('project')->eq((int)$projectID)->fetchPairs('id');
$this->dao->delete()->from(TABLE_PROJECTPRODUCT)->where('project')->in($executions)->andWhere('product')->notin($products)->exec();
}
$oldProductKeys = array_keys($oldProjectProducts);
$needUpdate = array_merge(array_diff($oldProductKeys, $products), array_diff($products, $oldProductKeys));