Merge branch 'zentaopms_239_task_#71574' into 'zentaopms_239'

* Finish task #71574.

See merge request easycorp/zentaopms!5843
This commit is contained in:
王 于听
2022-10-21 02:34:32 +00:00
6 changed files with 34 additions and 6 deletions
+1
View File
@@ -224,6 +224,7 @@ $lang->action->desc->merged = '$date, merged by <strong>$actor</st
$lang->action->desc->submitreview = '$date, submitted for review by <strong>$actor</strong>.' . "\n";
$lang->action->desc->ganttmove = '$date, sort by <strong>$actor</strong> .' . "\n";
$lang->action->desc->switchtolean = '$date, Switch from new mode to lean mode by <strong>'. $lang->admin->system .'</strong>.' . "\n";
$lang->action->desc->unlinkproduct = '$date, the project is disassociated from the $extra, synchronization disassociates the sprints of the project from the $extra.' . "\n";
/* Used to describe the history of operations related to parent-child tasks. */
$lang->action->desc->createchildren = '$date, <strong>$actor</strong> created a child task <strong>$extra</strong>。' . "\n";
+1
View File
@@ -224,6 +224,7 @@ $lang->action->desc->merged = '$date, merged by <strong>$actor</st
$lang->action->desc->submitreview = '$date, submitted for review by <strong>$actor</strong>.' . "\n";
$lang->action->desc->ganttmove = '$date, sort by <strong>$actor</strong> .' . "\n";
$lang->action->desc->switchtolean = '$date, Switch from new mode to lean mode by <strong>'. $lang->admin->system .'</strong>.' . "\n";
$lang->action->desc->unlinkproduct = '$date, the project is disassociated from the $extra, synchronization disassociates the sprints of the project from the $extra.' . "\n";
/* Used to describe the history of operations related to parent-child tasks. */
$lang->action->desc->createchildren = '$date, <strong>$actor</strong> created a child task <strong>$extra</strong>。' . "\n";
+1
View File
@@ -224,6 +224,7 @@ $lang->action->desc->merged = '$date, merged by <strong>$actor</st
$lang->action->desc->submitreview = '$date, submitted for review by <strong>$actor</strong>.' . "\n";
$lang->action->desc->ganttmove = '$date, sort by <strong>$actor</strong> .' . "\n";
$lang->action->desc->switchtolean = '$date, Switch from new mode to lean mode by <strong>'. $lang->admin->system .'</strong>.' . "\n";
$lang->action->desc->unlinkproduct = '$date, the project is disassociated from the $extra, synchronization disassociates the sprints of the project from the $extra.' . "\n";
/* Used to describe the history of operations related to parent-child tasks. */
$lang->action->desc->createchildren = '$date, <strong>$actor</strong> a créé un sous-tâche <strong>$extra</strong>。' . "\n";
+1
View File
@@ -224,6 +224,7 @@ $lang->action->desc->merged = '$date, 由 <strong>$actor</strong>
$lang->action->desc->submitreview = '$date, 由 <strong>$actor</strong> 提交评审。' . "\n";
$lang->action->desc->ganttmove = '$date, 由 <strong>$actor</strong> 排序。' . "\n";
$lang->action->desc->switchtolean = '$date, 由 <strong>'. $lang->admin->system .'</strong> 从综合模式切换为迅捷模式。' . "\n";
$lang->action->desc->unlinkproduct = '$date, 系统判断由于迭代所属项目与$extra取消关联,同步将迭代与$extra取消关联。' . "\n";
/* 用来描述和父子任务相关的操作历史记录。*/
$lang->action->desc->createchildren = '$date, 由 <strong>$actor</strong> 创建子任务 <strong>$extra</strong>。' . "\n";
+14 -5
View File
@@ -2145,11 +2145,20 @@ class project extends control
if($executionID) $this->execution->updateProducts($executionID);
}
$oldProducts = array_keys($oldProducts);
$newProducts = $this->product->getProducts($projectID);
$newProducts = array_keys($newProducts);
$diffProducts = array_merge(array_diff($oldProducts, $newProducts), array_diff($newProducts, $oldProducts));
if($diffProducts) $this->loadModel('action')->create('project', $projectID, 'Managed', '', !empty($_POST['products']) ? join(',', $_POST['products']) : '');
$newProducts = $this->product->getProducts($projectID);
$oldProductIDs = array_keys($oldProducts);
$newProductIDs = array_keys($newProducts);
$diffProductIDs = array_merge(array_diff($oldProductIDs, $newProductIDs), array_diff($newProductIDs, $oldProductIDs));
if($diffProductIDs) $this->loadModel('action')->create('project', $projectID, 'Managed', '', !empty($_POST['products']) ? join(',', $_POST['products']) : '');
$unlinkedProducts = array_diff($oldProductIDs, $newProductIDs);
if(!empty($unlinkedProducts))
{
$unlinkedProductPairs = array();
foreach($unlinkedProducts as $unlinkedProduct) $unlinkedProductPairs[$unlinkedProduct] = $oldProducts[$unlinkedProduct]->name;
$this->action->create('project', $projectID, 'unlinkproduct', '', implode(',', $unlinkedProductPairs));
}
$locateLink = inLink('manageProducts', "projectID=$projectID");
if($from == 'program') $locateLink = $this->session->projectList;
+16 -1
View File
@@ -1528,7 +1528,7 @@ class projectModel extends model
->checkIF($project->begin != '', 'begin', 'date')
->checkIF($project->end != '', 'end', 'date')
->checkIF($project->end != '', 'end', 'gt', $project->begin)
->checkIF(!empty($project->name), 'name', 'unique', "id != $projectID and `type` = 'project' and `parent` = '$project->parent' and `model` = '{$project->model}' and `deleted` = '0'")
->checkIF(!empty($project->name), 'name', 'unique', "id != $projectID and `type` = 'project' and `parent` = '$oldProject->parent' and `model` = '{$project->model}' and `deleted` = '0'")
->checkIF(!empty($project->code), 'code', 'unique', "id != $projectID and `type` = 'project' and `model` = '{$project->model}' and `deleted` = '0'")
->checkFlow()
->where('id')->eq($projectID)
@@ -1595,10 +1595,18 @@ class projectModel extends model
$oldWhitelist = explode(',', $oldProject->whitelist) and $oldWhitelist = array_filter($oldWhitelist);
$newWhitelist = explode(',', $project->whitelist) and $newWhitelist = array_filter($newWhitelist);
if(count($oldWhitelist) == count($newWhitelist) and count(array_diff($oldWhitelist, $newWhitelist)) == 0) unset($project->whitelist);
/* Add linkedproducts changes. */
$oldProject->linkedProducts = implode(',', $linkedProducts);
$project->linkedProducts = implode(',', $_POST['products']);
$unlinkedProducts = array_diff($linkedProducts, $_POST['products']);
if(!empty($unlinkedProducts))
{
$products = $this->dao->select('name')->from(TABLE_PRODUCT)->where('id')->in($unlinkedProducts)->fetchPairs();
$this->loadModel('action')->create('project', $projectID, 'unlinkproduct', '', implode(',', $products));
}
/* Activate or close the shadow product of the project. */
if(!$oldProject->hasProduct && $oldProject->status != $project->status && strpos('doing,closed', $project->status) !== false)
{
@@ -2301,9 +2309,12 @@ class projectModel extends model
public function updateProducts($projectID, $products = '')
{
$this->loadModel('user');
$products = isset($_POST['products']) ? $_POST['products'] : $products;
$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(empty($products))
{
@@ -2344,6 +2355,10 @@ class projectModel extends model
$existedProducts[$productID][$branch] = true;
}
/* 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();
$oldProductKeys = array_keys($oldProjectProducts);
$needUpdate = array_merge(array_diff($oldProductKeys, $products), array_diff($products, $oldProductKeys));
if($needUpdate) $this->user->updateUserView($needUpdate, 'product', $members);