* Finish task #68925.

This commit is contained in:
tianshujie
2022-09-13 16:53:52 +08:00
parent 2ba29dd574
commit 73f3a6d80a
7 changed files with 54 additions and 6 deletions

View File

@@ -186,7 +186,7 @@ $lang->product->statusList['closed'] = 'Geschlossen';
global $config;
if($config->systemMode == 'new')
{
$lang->product->aclList['private'] = "Privat {$lang->productCommon} ({$lang->executionCommon} Nur Teammitglieder)";
$lang->product->aclList['private'] = "Private {$lang->productCommon} (Stakeholders and owner of the respective program, team members and stakeholders of the associated project can access)";
}
else
{

View File

@@ -186,7 +186,7 @@ $lang->product->statusList['closed'] = 'Closed';
global $config;
if($config->systemMode == 'new')
{
$lang->product->aclList['private'] = "Private {$lang->productCommon} (Stakeholders of the respective program, team members and stakeholders of the associated project can access)";
$lang->product->aclList['private'] = "Private {$lang->productCommon} (Stakeholders and owner of the respective program, team members and stakeholders of the associated project can access)";
}
else
{

View File

@@ -186,7 +186,7 @@ $lang->product->statusList['closed'] = 'Fermé';
global $config;
if($config->systemMode == 'new')
{
$lang->product->aclList['private'] = "{$lang->productCommon} Privé (seuls les membres de l'équipe {$lang->executionCommon} ont les droits)";
$lang->product->aclList['private'] = "Private {$lang->productCommon} (Stakeholders and owner of the respective program, team members and stakeholders of the associated project can access)";
}
else
{

View File

@@ -186,7 +186,7 @@ $lang->product->statusList['closed'] = '结束';
global $config;
if($config->systemMode == 'new')
{
$lang->product->aclList['private'] = "私有({$lang->productCommon}相关负责人、所属项目集的干系人、相关联项目的团队成员和干系人可访问)";
$lang->product->aclList['private'] = "私有({$lang->productCommon}相关负责人、所属项目集的负责人及干系人、相关联项目的团队成员和干系人可访问)";
}
else
{

View File

@@ -841,12 +841,17 @@ class programModel extends model
$this->file->updateObjectID($this->post->uid, $programID, 'project');
$whitelist = explode(',', $program->whitelist);
$this->loadModel('personnel')->updateWhitelist($whitelist, 'program', $programID);
if($program->acl != 'open') $this->loadModel('user')->updateUserView($programID, 'program');
$this->loadModel('user');
if($program->acl != 'open') $this->user->updateUserView($programID, 'program');
/* If the program changes, the authorities of programs and projects under the program should be refreshed. */
$children = $this->dao->select('id, type')->from(TABLE_PROGRAM)->where('path')->like("%,{$programID},%")->andWhere('id')->ne($programID)->andWhere('acl')->eq('program')->fetchPairs('id', 'type');
$this->loadModel('user');
foreach($children as $id => $type) $this->user->updateUserView($id, $type);
if($program->PM != $oldProgram->PM)
{
$productIdList = $this->dao->select('id')->from(TABLE_PRODUCT)->where('program')->eq($programID)->fetchPairs('id');
foreach($productIdList as $productID) $this->user->updateUserView($productID, 'product');
}
if($oldProgram->parent != $program->parent)
{

View File

@@ -557,6 +557,9 @@ class upgradeModel extends model
$this->xuanRecoverCreatedDates();
$this->xuanSetPartitionedMessageIndex();
break;
case '17_6_1':
$this->updateProductView();
break;
}
$this->deletePatch();
@@ -7528,4 +7531,33 @@ class upgradeModel extends model
}
return true;
}
/**
* Update the owner of the program into the product view.
*
* @access public
* @return bool
*/
public function updateProductView()
{
$programs = $this->dao->select('id,PM')->from(TABLE_PROGRAM)->where('type')->eq('program')->andWhere('PM')->ne('')->fetchPairs('id', 'PM');
if(empty($programs)) return true;
$productGroup = $this->dao->select('id,program')->from(TABLE_PRODUCT)->where('program')->in(array_keys($programs))->andWhere('acl')->ne('open')->fetchGroup('program', 'id');
if(empty($productGroup)) return true;
$userView = $this->dao->select('*')->from(TABLE_USERVIEW)->where('account')->in(array_values($programs))->fetchAll('account');
foreach($programs as $programID => $programPM)
{
if(empty($productGroup[$programID])) continue;
$canViewProducts = zget($productGroup, $programID);
$view = $userView[$programPM]->products;
foreach($canViewProducts as $productID => $product)
{
if(strpos(",$view,", ",$productID,") === false) $view .= ',' . $productID;
}
$this->dao->update(TABLE_USERVIEW)->set('products')->eq($view)->where('account')->eq($programPM)->exec();
}
return true;
}
}

View File

@@ -1983,6 +1983,17 @@ class userModel extends model
$productIdList = zget($programProduct, $programStakeholder->objectID, array());
foreach($productIdList as $productID) $stakeholderGroups[$productID][$programStakeholder->user] = $programStakeholder->user;
}
$sql = $this->dao->select('id,PM')->from(TABLE_PROGRAM)
->where('type')->eq('program')
->andWhere('id')->in(array_keys($programProduct))
->query();
while($programOwner = $sql->fetch())
{
$productIdList = zget($programProduct, $programOwner->id, array());
foreach($productIdList as $productID) $stakeholderGroups[$productID][$programOwner->PM] = $programOwner->PM;
}
}
return array($teamGroups, $stakeholderGroups);