Merge branch 'sprint/238_tianshujie_68925' into 'sprint/238'

Sprint/238 tianshujie 68925

See merge request easycorp/zentaopms!5323
This commit is contained in:
李玉春
2022-09-15 00:25:03 +00:00
8 changed files with 60 additions and 23 deletions
+1 -1
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
{
+1 -1
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
{
+1 -1
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
{
+1 -1
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
{
+7 -2
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(isset($program->PM) and $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)
{
+32
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;
}
}
+11
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);
+6 -17
View File
@@ -15,8 +15,6 @@ pid=1
更新项目集名称为空时 >> 『项目集名称』不能为空。
当计划开始为空时更新项目集信息 >> 『计划开始』不能为空。
当计划完成为空时更新项目集信息 >> 『计划完成』不能为空。
父项目集的开始日期大于子项目集的开始日期时 >> 子项目集的最小开始日期:2022-02-01,父项目集的开始日期不能大于子项目集的最小开始日期
项目集开始、结束日期和子项目不符的情况 >> 父项目集的开始日期:2022-03-26,开始日期不能小于父项目集的开始日期;父项目集的完成日期:2022-06-02,完成日期不能大于父项目集的完成日期
更新未开始的项目集实际开始时间 >> doing
*/
@@ -47,21 +45,12 @@ $emptyBeginProgram['begin'] = '';
$emptyEndProgram = $data;
$emptyEndProgram['end'] = '';
$beginGtEndProgram = $data;
$beginGtEndProgram['begin'] = '2022-07-01';
$beginLtParentProgram = $data;
$beginLtParentProgram['parent'] = '9';
$beginLtParentProgram['begin'] = '2019-01-01';
$realBeganProgram = $data;
$realBeganProgram['realBegan'] = '2020-11-10';
r($program->update(10, $normalProgram)) && p('name') && e('测试更新项目集十'); // 正常更新项目集的情况
r($program->update(10, $emptyTitleProgram)) && p('message[name]:0') && e('『项目集名称』不能为空。'); // 更新项目集名称为空时
r($program->update(10, $emptyBeginProgram)) && p('message[begin]:0') && e('『计划开始』不能为空。'); // 当计划开始为空时更新项目集信息
r($program->update(10, $emptyEndProgram)) && p('message:end') && e('『计划完成』不能为空。'); // 当计划完成为空时更新项目集信息
r($program->update(10, $beginGtEndProgram)) && p('message:begin') && e('子项目集的最小开始日期:2022-02-01,父项目集的开始日期不能大于子项目集的最小开始日期'); // 父项目集的开始日期大于子项目集的开始日期时
r($program->update(10, $beginLtParentProgram)) && p('message:begin;message:end') && e('父项目集的开始日期:2022-03-26,开始日期不能小于父项目集的开始日期;父项目集的完成日期:2022-06-02,完成日期不能大于父项目集的完成日期'); // 项目集开始、结束日期和子项目不符的情况
r($program->update(10, $realBeganProgram)) && p('status') && e('doing'); // 更新未开始的项目集实际开始时间
$db->restoreDB();
r($program->update(10, $normalProgram)) && p('name') && e('测试更新项目集十'); // 正常更新项目集的情况
r($program->update(10, $emptyTitleProgram)) && p('message[name]:0') && e('『项目集名称』不能为空。'); // 更新项目集名称为空时
r($program->update(10, $emptyBeginProgram)) && p('message[begin]:0') && e('『计划开始』不能为空。'); // 当计划开始为空时更新项目集信息
r($program->update(10, $emptyEndProgram)) && p('message[end]:0') && e('『计划完成』不能为空。'); // 当计划完成为空时更新项目集信息
r($program->update(10, $realBeganProgram)) && p('status') && e('doing'); // 更新未开始的项目集实际开始时间
$db->restoreDB();