* Adjust codes.
This commit is contained in:
@@ -261,7 +261,7 @@ class projectModel extends model
|
||||
$project->executions = $this->loadModel('execution')->getStatData($projectID, 'undone', 0, 0, false, '', $orderBy, $pager);
|
||||
$project->teamCount = isset($teams[$projectID]) ? $teams[$projectID] : 0;
|
||||
$project->estimate = isset($estimates[$projectID]) ? round($estimates[$projectID]->estimate, 2) : 0;
|
||||
$project->parentName = $project->parent ? $this->projectTao->getParentProgram($project->parent, $project->path, $project->grade) : '';
|
||||
$project->parentName = $project->parent ? $this->projectTao->getParentProgram($project->path, $project->grade) : '';
|
||||
}
|
||||
return $projects;
|
||||
}
|
||||
@@ -1207,7 +1207,7 @@ class projectModel extends model
|
||||
$this->loadModel('personnel')->updateWhitelist($whitelist, 'project', $projectID);
|
||||
|
||||
$program = $project->parent ? $this->getByID((int)$project->parent) : new stdclass();
|
||||
$this->projectTao->createDocLib($projectID, $project, $postData, $program);
|
||||
$this->projectTao->createDocLib($projectID, $project, $program);
|
||||
|
||||
if($project->hasProduct) $this->updateProducts($projectID);
|
||||
|
||||
|
||||
@@ -247,12 +247,11 @@ class projectTao extends projectModel
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param object $project
|
||||
* @param object $postData
|
||||
* @param object $program
|
||||
* @access protected
|
||||
* @return bool
|
||||
*/
|
||||
protected function createDocLib(int $projectID, object $project, object $postData, object $program): bool
|
||||
protected function createDocLib(int $projectID, object $project, object $program): bool
|
||||
{
|
||||
/* Create doc lib. */
|
||||
$this->app->loadLang('doc');
|
||||
@@ -495,13 +494,12 @@ class projectTao extends projectModel
|
||||
* 根据项目集ID查询所有项目集的层级。
|
||||
* Get all program level of a program.
|
||||
*
|
||||
* @param int $program
|
||||
* @param string $path
|
||||
* @param int $grade
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getParentProgram(int $program, string $path, int $grade): string
|
||||
public function getParentProgram(string $path, int $grade): string
|
||||
{
|
||||
$parentName = $this->dao->select('id,name')->from(TABLE_PROGRAM)
|
||||
->where('id')->in(trim($path, ','))
|
||||
@@ -527,8 +525,9 @@ class projectTao extends projectModel
|
||||
*/
|
||||
protected function getExecutionProductGroup(array $executionIDs): array
|
||||
{
|
||||
$oldExecutionProducts = $this->dao->select('project,product')->from(TABLE_PROJECTPRODUCT)->where('project')->in($executionIDs)->fetchGroup('project', 'product');
|
||||
return $oldExecutionProducts;
|
||||
return $this->dao->select('project,product')->from(TABLE_PROJECTPRODUCT)
|
||||
->where('project')->in($executionIDs)
|
||||
->fetchGroup('project', 'product');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -59,8 +59,7 @@ class projectZen extends project
|
||||
*/
|
||||
protected function prepareEditExtras(object $postData): object
|
||||
{
|
||||
$rawdata = $postData->rawdata;
|
||||
$project = $postData ->setDefault('team', $this->post->name)
|
||||
$project = $postData->setDefault('team', $this->post->name)
|
||||
->setDefault('lastEditedBy', $this->app->user->account)
|
||||
->setDefault('lastEditedDate', helper::now())
|
||||
->setDefault('days', '0')
|
||||
@@ -109,8 +108,6 @@ class projectZen extends project
|
||||
|
||||
if($project->parent)
|
||||
{
|
||||
$program = $this->project->getByID((int)$project->parent);
|
||||
|
||||
/* Judge products not empty. */
|
||||
if($project->hasProduct && empty($linkedProductsCount) and !isset($rawdata->newProduct))
|
||||
{
|
||||
@@ -698,7 +695,7 @@ class projectZen extends project
|
||||
/* Record multiple and waterfall project unlinked products. */
|
||||
if($project->multiple and $project->model != 'waterfall' and $project->model != 'waterfallplus')
|
||||
{
|
||||
$this->dealUnlinkedProduct($project, $oldProducts, $newProductIDs, $executionIDs);
|
||||
$this->dealUnlinkedProduct($oldProducts, $newProductIDs, $executionIDs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -706,7 +703,6 @@ class projectZen extends project
|
||||
* 记录多迭代及瀑布类项目移除的产品
|
||||
* Record multiple and waterfall project unlinked products
|
||||
*
|
||||
* @param object $project
|
||||
* @param array $oldProducts
|
||||
* @param array $newProductIDs
|
||||
* @param int|array $executionIDs
|
||||
@@ -714,7 +710,7 @@ class projectZen extends project
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function dealUnlinkedProduct(object $project, array $oldProducts, array $newProductIDs, array $executionIDs): void
|
||||
protected function dealUnlinkedProduct(array $oldProducts, array $newProductIDs, array $executionIDs): void
|
||||
{
|
||||
$oldExecutionProducts = $this->projectTao->getExecutionProductGroup($executionIDs);
|
||||
$unlinkedProducts = array_diff(array_keys($oldProducts), $newProductIDs);
|
||||
@@ -780,7 +776,7 @@ class projectZen extends project
|
||||
}
|
||||
|
||||
/* Initializes the product from other linked products. */
|
||||
if($this->config->systemMode == 'ALM') $this->InitOtherLinkProduct($project, $allProducts, $linkedBranchIdList, $linkedBranches, $linkedProducts);
|
||||
if($this->config->systemMode == 'ALM') $this->initOtherLinkProduct($project, $allProducts, $linkedBranchIdList, $linkedBranches, $linkedProducts);
|
||||
|
||||
$this->view->unmodifiableProducts = $unmodifiableProducts;
|
||||
$this->view->unmodifiableBranches = $unmodifiableBranches;
|
||||
@@ -800,7 +796,7 @@ class projectZen extends project
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function InitOtherLinkProduct(object $project, array $allProducts, array $linkedBranchIdList, array $linkedBranches, array $linkedProducts): void
|
||||
protected function initOtherLinkProduct(object $project, array $allProducts, array $linkedBranchIdList, array $linkedBranches, array $linkedProducts): void
|
||||
{
|
||||
$branchGroups = $this->loadModel('branch')->getByProducts(array_keys($allProducts), 'ignoreNormal|noclosed', $linkedBranchIdList);
|
||||
$topProgramID = $project->parent ? $this->program->getTopByPath($project->path) : 0;
|
||||
|
||||
Reference in New Issue
Block a user