* Fix bug.

This commit is contained in:
Yagami
2020-10-22 09:34:52 +08:00
parent 61365c9f78
commit a18eff2a3c
4 changed files with 15 additions and 11 deletions
+1 -1
View File
@@ -510,7 +510,7 @@ class program extends control
$this->loadModel('user')->updateUserView($programID, 'program', array($account));
/* Update children user view. */
$childPgmList = $this->dao->select('id')->from(TABLE_PROJECT)->where('path')->like("%,$programID,%")->andWhere('type')->eq('program')->fetchPairs();
$childPGMList = $this->dao->select('id')->from(TABLE_PROJECT)->where('path')->like("%,$programID,%")->andWhere('type')->eq('program')->fetchPairs();
$childPRJList = $this->dao->select('id')->from(TABLE_PROJECT)->where('path')->like("%,$programID,%")->andWhere('type')->eq('project')->fetchPairs();
$childProducts = $this->dao->select('id')->from(TABLE_PRODUCT)->where('program')->eq($programID)->fetchPairs();
+1 -1
View File
@@ -598,7 +598,7 @@ class programModel extends model
$this->loadModel('user')->updateUserView($programID, 'program', $changedAccounts);
/* Update children user view. */
$childPgmList = $this->dao->select('id')->from(TABLE_PROJECT)->where('path')->like("%,$programID,%")->andWhere('type')->eq('program')->fetchPairs();
$childPGMList = $this->dao->select('id')->from(TABLE_PROJECT)->where('path')->like("%,$programID,%")->andWhere('type')->eq('program')->fetchPairs();
$childPRJList = $this->dao->select('id')->from(TABLE_PROJECT)->where('path')->like("%,$programID,%")->andWhere('type')->eq('project')->fetchPairs();
$childProducts = $this->dao->select('id')->from(TABLE_PRODUCT)->where('program')->eq($programID)->fetchPairs();
+3
View File
@@ -1996,6 +1996,9 @@ class projectModel extends model
$this->loadModel('user')->updateUserView($projectID, $projectType, $changedAccounts);
$childSprints = $this->dao->select('id')->from(TABLE_PROJECT)->where('path')->like("%,$projectID,%")->andWhere('type')->in('sprint,stage')->fetchPairs();
if($childSprints) $this->user->updateUserView($childSprints, 'sprint', $changedAccounts);
$products = $this->getProducts($projectID, false);
if($products) $this->user->updateUserView(array_keys($products), 'product', $changedAccounts);
}
+10 -9
View File
@@ -1838,20 +1838,19 @@ class userModel extends model
->fetchAll('id');
if(empty($sprints)) return true;
$parentIdList = array();
foreach($sprints as $sprint) $parentIdList[$sprint->project] = $sprint->project;
$teamGroups = array();
$stmt = $this->dao->select('root,account')->from(TABLE_TEAM)
->where('type')->eq('sprint')
->andWhere('root')->in($sprintIdList)
->where('type')->in('project,sprint,stage')
->andWhere('root')->in(array_merge($sprintIdList, $parentIdList))
->query();
while($team = $stmt->fetch()) $teamGroups[$team->root][$team->account] = $team->account;
$projectIdList = array();
foreach($sprints as $sprintID => $sprint)
{
$projectIdList[$sprint->parent] = $sprint->parent;
$sprint->project = $sprint->project;
}
foreach($sprints as $sprintID => $sprint) $projectIdList[$sprint->parent] = $sprint->parent;
/* Get parent project stakeholders. */
$stakeholderGroup = $this->loadModel('stakeholder')->getStakeholderGroup($projectIdList);
@@ -1865,8 +1864,9 @@ class userModel extends model
{
$stakeholders = zget($stakeholderGroup, $sprint->project, array());
$teams = zget($teamGroups, $sprint->id, array());
$parentTeams = zget($teamGroups, $sprint->project, array());
$authedUsers += $this->getSprintAuthedUsers($sprint, $stakeholders, $teams);
$authedUsers += $this->getSprintAuthedUsers($sprint, $stakeholders, array_merge($teams, $parentTeams));
}
}
@@ -1885,8 +1885,9 @@ class userModel extends model
{
$stakeholders = zget($stakeholderGroup, $sprint->project, array());
$teams = zget($teamGroups, $sprint->id, array());
$parentTeams = zget($teamGroups, $sprint->project, array());
$hasPriv = $this->checkSprintPriv($sprint, $account, $stakeholders, $teams);
$hasPriv = $this->checkSprintPriv($sprint, $account, $stakeholders, array_merge($teams, $parentTeams));
if($hasPriv and strpos(",{$view},", ",{$sprintID},") === false) $view .= ",{$sprintID}";
if(!$hasPriv and strpos(",{$view},", ",{$sprintID},") !== false) $view = trim(str_replace(",{$sprintID},", ',', ",{$view},"), ',');
}