* finish task #7066.

This commit is contained in:
wangyidong
2020-05-09 08:23:34 +08:00
parent 12718939a0
commit 2a0b9d3f43
3 changed files with 72 additions and 70 deletions
+12 -36
View File
@@ -348,15 +348,9 @@ class projectModel extends model
$lib->acl = 'default';
$this->dao->insert(TABLE_DOCLIB)->data($lib)->exec();
if($project->acl != 'open') $this->loadModel('user')->updateUserView($projectID, 'project');
if(isset($_POST['products']))
{
foreach($this->post->products as $productID)
{
if(empty($productID)) continue;
$this->loadModel('user')->updateUserView($productID, 'product');
}
}
$this->loadModel('user');
if($project->acl != 'open') $this->user->updateUserView($projectID, 'project');
if(isset($_POST['products'])) $this->user->updateUserView($this->post->products, 'product');
if(!dao::isError()) $this->loadModel('score')->create('project', 'create', $projectID);
return $projectID;
@@ -424,11 +418,7 @@ class projectModel extends model
/* Fix bug#3074, Update views for team members. */
$this->loadModel('user')->updateUserView($projectID, 'project', $changedAccounts);
$products = $this->getProducts($projectID, false);
foreach($products as $productID => $productName)
{
if(empty($productID)) continue;
$this->user->updateUserView($productID, 'product', $changedAccounts);
}
if($products) $this->user->updateUserView(array_keys($products), 'product', $changedAccounts);
if(!dao::isError())
{
@@ -1267,9 +1257,10 @@ class projectModel extends model
$this->loadModel('user');
$oldProjectProducts = $this->dao->select('*')->from(TABLE_PROJECTPRODUCT)->where('project')->eq((int)$projectID)->fetchGroup('product', 'branch');
$this->dao->delete()->from(TABLE_PROJECTPRODUCT)->where('project')->eq((int)$projectID)->exec();
$members = array_keys($this->getTeamMembers($projectID));
if(!isset($_POST['products']))
{
foreach($oldProjectProducts as $productID => $branches) $this->user->updateUserView($productID, 'product');
$this->user->updateUserView(array_keys($oldProjectProducts), 'product', $members);
return true;
}
@@ -1302,11 +1293,7 @@ class projectModel extends model
$oldProductKeys = array_keys($oldProjectProducts);
$needUpdate = array_merge(array_diff($oldProductKeys, $products), array_diff($products, $oldProductKeys));
foreach($needUpdate as $productID)
{
if(empty($productID)) continue;
$this->user->updateUserView($productID, 'product');
}
if($needUpdate) $this->user->updateUserView($needUpdate, 'product', $members);
}
/**
@@ -1844,11 +1831,7 @@ class projectModel extends model
$this->loadModel('user')->updateUserView($projectID, 'project', $changedAccounts);
$products = $this->getProducts($projectID, false);
foreach($products as $productID => $productName)
{
if(empty($productID)) continue;
$this->user->updateUserView($productID, 'product', $changedAccounts);
}
if($products) $this->user->updateUserView(array_keys($products), 'product', $changedAccounts);
}
/**
@@ -1865,11 +1848,7 @@ class projectModel extends model
$this->loadModel('user')->updateUserView($projectID, 'project', array($account));
$products = $this->getProducts($projectID, false);
foreach($products as $productID => $productName)
{
if(empty($productID)) continue;
$this->user->updateUserView($productID, 'product', array($account));
}
if($products) $this->user->updateUserView(array_keys($products), 'product', array($account));
}
/**
@@ -2065,7 +2044,7 @@ class projectModel extends model
->andWhere('t1.id')->in(array_keys($taskIdList))
->orderBy($orderBy)
->fetchAll('id');
if(empty($tasks)) return array();
$taskTeam = $this->dao->select('*')->from(TABLE_TEAM)->where('root')->in(array_keys($tasks))->andWhere('type')->eq('task')->fetchGroup('root');
@@ -2080,7 +2059,7 @@ class projectModel extends model
if($task->parent > 0) $parents[$task->parent] = $task->parent;
}
$parents = $this->dao->select('*')->from(TABLE_TASK)->where('id')->in($parents)->fetchAll('id');
foreach($tasks as $task)
{
if($task->parent > 0)
@@ -3023,9 +3002,6 @@ class projectModel extends model
{
$this->loadModel('user')->updateUserView($projectID, 'project');
$products = $this->getProducts($projectID, $withBranch = false);
if(!empty($products))
{
foreach($products as $productID => $productName) $this->loadModel('user')->updateUserView($productID, 'product');
}
if(!empty($products)) $this->user->updateUserView(array_keys($products), 'product');
}
}